sqlalchemy-stubs
SQLAlchemy stubs and mypy plugin
What it is and what it does
sqlalchemy-stubs is a type-checking plugin for mypy that adds static type support to SQLAlchemy code. SQLAlchemy uses dynamic Python features that static type checkers cannot easily understand, so this package bridges that gap by providing type stubs and a mypy plugin that work together to infer types more precisely.
The package requires mypy and typing-extensions as runtime dependencies and must be enabled in your mypy configuration file by adding 'plugins = sqlmypy' to your mypy config. It currently supports basic use cases like inferring model field types, though the project is in alpha status and dormant—the last release was 2021-01-12, so compatibility with recent versions is uncertain.
Use it for:
- Enable mypy type checking on SQLAlchemy ORM models to catch type errors at development time.
- Infer column and relationship types automatically in SQLAlchemy model definitions.
- Integrate SQLAlchemy type checking into a CI/CD pipeline that runs mypy.
- Improve IDE autocomplete and type hints for SQLAlchemy query results and model attributes.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides type stubs and a mypy plugin to enable static type checking of SQLAlchemy code, helping type checkers understand SQLAlchemy's dynamic features.
Yes-with-conditions. The package is useful if you need mypy support for SQLAlchemy, but its dormant status (last release 2021-01-12) means you should verify compatibility with your current SQLAlchemy and mypy versions before relying on it.
Install
sqlalchemy-stubs on PyPI
pip
pip install sqlalchemy-stubsuv
uv add sqlalchemy-stubspoetry
poetry add sqlalchemy-stubsInstalling sqlalchemy-stubs
Before you install
Low install friction with only two runtime dependencies (mypy and typing-extensions). However, the package is dormant—last release was 2021-01-12, and there has been no recent activity despite the repository remaining unarchived.
License in practice
Licensed under MIT License (permissive), so you can use it freely in commercial and private projects with minimal restrictions.
Quickstart
pip install sqlalchemy-stubs
# Add to mypy.ini or setup.cfg:
# [mypy]
# plugins = sqlmypy
import mypy # mypy plugin is configured via config file
Requires mypy and typing-extensions to be installed; the plugin must be explicitly enabled in your mypy configuration file.
Verify before relying
- Whether the plugin remains compatible with recent SQLAlchemy and mypy versions given the age of the last release.
- What 'basic use cases like inferring model field types' concretely covers and what patterns remain unsupported.
- Whether the package works with modern Python versions.
Package facts
| License | MIT License (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — mypy, typing-extensions |
| Maintenance | dormant — 2,040 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,122,244/month — #3,276 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sqlalchemy_stubs-0.4-py3-none-any.whl
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
sqlalchemy2-stubsProvides PEP-484 typing stubs for SQLAlchemy…
permissive · top 5,000 on PyPI
types-SQLAlchemyProvides PEP 561 type stubs for SQLAlchemy,…
permissive · top 15,000 on PyPI
django-stubsProvides type stubs and a mypy plugin to enable…
permissive · top 5,000 on PyPI
joblib-stubsProvides type stubs for joblib, enabling static…
permissive · top 15,000 on PyPI
scipy-stubsProvides type stubs for the entire SciPy…
permissive · top 5,000 on PyPI
asyncpg-stubsProvides type stubs for asyncpg to enable…
permissive · top 5,000 on PyPI
pika-stubsProvides type stubs for the pika RabbitMQ…
permissive · top 15,000 on PyPI
mypy-zopeA mypy plugin that treats zope.interface…
permissive · top 15,000 on PyPI
types-pikaProvides type stubs for the Pika RabbitMQ…
permissive · top 15,000 on PyPI
types-mypy-extensionsProvides type stubs for mypy-extensions,…
permissive · top 15,000 on PyPI