All jobs restore built wheels (e.g., `rpy2`) and the Python versions
instead of building or fetching them again.
Only the "lint" job saves the cache, pruned to what is expensive to rebuild,
and only when its key changed; so, five jobs do not compress the same archive
in parallel, and unchanged runs skip the 15s of packing.
The test sessions run as a matrix, each with its own database.
This also adds the "test-with" sessions to CI;
so, the setup installs all `SUPPORTED_PYTHONS` via `uv`,
as `nox` would otherwise pick the system Python 3.13,
which lacks the headers to build `rpy2`.
The version in the name broke the required status check
when 3.14 became the `MAIN_PYTHON`.
The timeout ensures the CI server stays ready
even when something goes badly wrong.
Without a configured version, `mypy` and `pyright`
check against the Python that runs them.
With `MAIN_PYTHON` at 3.14, they would accept
`stdlib` APIs and `typing` features new in 3.14.
Yet, `requires-python` promises 3.13;
so, the type checkers must flag such code.
`black` and `ruff` already target 3.13 for the same reason.
In the "sequentially" variant of the test database,
`current_db_revision()` must return the head of the migrations;
in the "all_at_once" variant, there is no version table.
The `@db_revision` decorator no longer runs `alembic current` in a subprocess,
which only worked from the project folder and reported any failure as a wrong revision.
Also, its docstring now explains that it locks completed stages of the data pipeline.
The column is of type `JSON`,
but the code stored a JSON-encoded string in it;
so, the data was encoded twice.
A later data migration converts the existing rows.
The global `db.session` is now a `scoped_session`,
like, for example, in Flask-SQLAlchemy.
Importing the package no longer creates an engine;
so, the placeholder for the tests is obsolete.
The `db_session` fixture replaces `db.session` with `monkeypatch`
such that it is reset after each test.
Tests without the fixture get a placeholder that fails loudly
instead of opening a real session,
which would block the `DROP SCHEMA` at the end of the test run.
`Session.query()` is the legacy API in SQLAlchemy 2.x.
`.one_or_none()` expresses that the unique constraint
on the five filtered columns allows at most one cached `Forecast`.
`Session.query()` is the legacy API in SQLAlchemy 2.x.
The addresses with restaurants are now selected with a subquery in one statement.
The `_restaurants_mock` fixture mocks the new call chain.
`Session.query()` is the legacy API in SQLAlchemy 2.x.
Unlike `Query`, `select()` does not deduplicate single entities from a `JOIN`;
so, `Grid.gridify()` calls `.unique()` explicitly.
The `addresses_mock` fixtures mock the new call chain.
The migrations create foreign keys from the `CLEAN_SCHEMA`
into the `ORIGINAL_SCHEMA` to ensure the cleaned data still
refer to the original data.
The ORM models do not know the original tables.
Also, print the `diff` as indented JSON.