Python developer mode

The Python Development Mode introduces additional runtime checks that are too expensive to be enabled by default. It should not be more verbose than the default if the code is correct; new warnings are only emitted when an issue is detected. It can b…
Read more →

Detecting a Python virtual environment

From PEP 668 – Marking Python base environments as “externally managed”: A “virtual environment” now has a fairly precise definition: it uses the pyvenv.cfg mechanism, which causes sys.base_prefix != sys.prefix. [...] In older versions of v…
Read more →

Starlite

Starlite is an opinionated Python ASGI web framework with a focus on performance, API development, first class typing support and a full Pydantic integration.
Read more →

Missing package hashes in poetry lockfiles following PyPI warehouse change

The warehouse project (PyPI) applied a breaking change around the end July 2022 which affects poetry lock. The releases key is no longer present in certain API responses which poetry versions before 1.1.14 relied on to get release artifact hashes. Th…
Read more →

Upgrade Python packages to their latest version when using poetry

Poetry currently lacks a command to upgrade all dependencies (packages declared in pyproject.toml ) to their latest available versions in one go (you can do it for individual packages using poetry add package@latest). This is tracked in python-poetry…
Read more →

Python type annotations on classes

You can’t normally access the class itself inside the class’ function declarations (because the class hasn't been finished declaring itself yet, because you’re still declaring its methods). So something like this isn't valid Python: class MyCla…
Read more →