Skip to content

chore(deps): SQLAlchemy 2.1.4 with the asyncio extra - #21

Merged
JsNcAr merged 1 commit into
mainfrom
chore/sqlalchemy-2-1
Oct 14, 2026
Merged

JsNcAr merged 1 commit into
mainfrom
chore/sqlalchemy-2-1

Conversation

@JsNcAr

@JsNcAr JsNcAr commented Oct 14, 2026

Copy link
Copy Markdown
Owner

Closes the Known Issue that #20 added: SQLAlchemy 2.0.x has no Python 3.15 wheel, so since the move to 3.15 it ran as pure Python. 2.1.4 ships a cp315 wheel and SQLModel 0.0.48 added 2.1 support.

Changes

  • pyproject.toml: sqlalchemy (>=2.0.54,<2.1) becomes sqlalchemy[asyncio] (>=2.1.4,<3.0). The extra matters: in 2.1 greenlet, which the asyncio extension needs, is only installed through [asyncio]. The comment now says why the dependency is declared at all (direct imports in database.py and services/users.py, plus the extra).
  • poetry.lock: one version changes, SQLAlchemy 2.0.54 to 2.1.4. greenlet 3.5.6 stays.
  • Known Issues: the pure-wheel entry is removed. AGENTS.md drops the sentence about holding SQLAlchemy below 2.1.
  • Changelog entry under Dependencies.

2.1 behaviour changes, checked against the migration guide

  • Default PostgreSQL driver is now psycopg 3 for postgresql:// URLs. Not applicable: config.py and tests/conftest.py build postgresql+asyncpg:// URLs, and a test asserts the scheme.
  • PostgreSQL named types (ENUM, DOMAIN) are now bound to MetaData. Not applicable: the models have none.
  • Autoflush is now unconditional, also before Core statements. The only Core statement is the health check's SELECT 1 on a session that has no pending changes; the test cleanup uses its own session.
  • Row is typed without Tuple. Not used: results go through session.exec(...).first().
  • Python 3.11 floor: irrelevant on 3.15.

Verification, local on Python 3.15.0 with PostgreSQL 17

  • black, flake8, mypy (2.1 typing changes included), pip-audit: clean.
  • Importing the app with every warning turned into an error, except slowapi's known one: clean.
  • Full suite, 138 passed, with SADeprecationWarning, SAWarning and SQLModel DeprecationWarning turned into errors.

🤖 Generated with Claude Code

The <2.1 constraint existed because 2.1 had no wheels, then because 2.1 is a
new minor. SQLModel 0.0.48 added 2.1 support, and 2.1 is the first SQLAlchemy
with a Python 3.15 wheel, so 2.0 ran as pure Python since the move to 3.15.
Declared as sqlalchemy[asyncio]: 2.1 installs greenlet only through that
extra. The lock changes one version; greenlet stays at 3.5.6.

Checked against the 2.1 migration guide: asyncpg is named in the URL (the
psycopg default does not apply), no named types, unconditional autoflush
is harmless here. Full suite passes on 3.15 with SADeprecationWarning,
SAWarning and SQLModel DeprecationWarnings as errors; lint, mypy and
pip-audit clean. Removes the Known Issues entry about the pure wheel.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@JsNcAr
JsNcAr merged commit cf5cc84 into main Oct 14, 2026
2 checks passed
@JsNcAr
JsNcAr deleted the chore/sqlalchemy-2-1 branch October 14, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant