Skip to content

Stop calling deprecated APIs and refresh dependencies - #43

Merged
mdfarhankc merged 1 commit into
mainfrom
chore/deprecations-and-deps
Sep 24, 2026
Merged

mdfarhankc merged 1 commit into
mainfrom
chore/deprecations-and-deps

Conversation

@mdfarhankc

Copy link
Copy Markdown
Owner

Solves the deprecations rather than suppressing them, so downstream applications running warnings-as-errors do not need an ignore for this library.

What was wrong

  • _BaseSQLAlchemyAdapter called session.execute() 40 times. SQLModel's AsyncSession deprecates it, and docs/adapters/sqlmodel.md offers that session class as one of two supported setups.
  • Three Redis writes used setex, deprecated since redis-py 2.6.12.
  • Nothing would have caught either. Every test built sessions with SQLAlchemy's AsyncSession, so the SQLModel path had no coverage, and deprecations were not errors.

Changes

  1. A helper calls SQLAlchemy's execute() directly. exec() cannot be used: a plain SQLAlchemy session has none, and the base serves both adapters. SQLModel's override does nothing but delegate, so behaviour is identical and results stay Row objects.
  2. setex becomes set(..., ex=).
  3. The SQLModel adapter conformance suite runs a second time with class_=AsyncSession from SQLModel. Verified it bites: reverting the helper fails 30 of those tests and none of the SQLAlchemy ones, which is precisely why the bug escaped.
  4. filterwarnings = ["error::DeprecationWarning", "error::PendingDeprecationWarning"], with no ignore entries.
  5. uv lock --upgrade, verified against uuid-utils 1.0, SQLModel 0.0.47, SQLAlchemy 2.0.54, PyJWT 2.15, Starlette 1.7, pymdown-extensions 12.

Version floors

Left unchanged deliberately. For a library the floor states the oldest release it works with, not the newest it was tested against; raising it forces consumers to upgrade for no benefit. Nothing here needs a newer version, including uuid-utils 1.0, whose result we convert via bytes.

Checks

ruff, ruff format, mypy --strict, pytest (588 passed on 3.14, 587 on 3.10), mkdocs build --strict.

The shared SQL base called session.execute() 40 times. SQLModel's
AsyncSession deprecates it, so every consumer using that session class,
one of the two setups the docs offer, got a DeprecationWarning from our
internals, and those treating warnings as errors failed outright. exec()
cannot replace it because a plain SQLAlchemy session has none and the base
serves both, so the calls go through a helper that invokes SQLAlchemy's
execute() directly. SQLModel's override only delegates to it.

Redis writes move from setex to set(ex=), deprecated since redis-py 2.6.12.

This reached an application rather than CI because no test built a session
with SQLModel's AsyncSession, so the adapter contract now runs against both
documented session classes. With that in place the suite treats deprecations
as errors and needs no ignore entries.

Dependencies verified against the newest releases, including uuid-utils 1.0
and SQLModel 0.0.47. Declared floors are unchanged; nothing requires a
newer version.
@coderabbitai

coderabbitai Bot commented Sep 24, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: c5fcc176-b2dc-496c-9d57-667a1056fd49


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mdfarhankc
mdfarhankc merged commit b361701 into main Sep 24, 2026
7 checks passed
@mdfarhankc
mdfarhankc deleted the chore/deprecations-and-deps branch September 24, 2026 10:48
@mdfarhankc mdfarhankc mentioned this pull request Sep 24, 2026
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