skillfed

sqlalchemy-stubs

SQLAlchemy stubs and mypy plugin

sqlalchemy-stubs v0.4 2.1M downloads/30d#3,276 on PyPI584
Permissive license MIT License DORMANT released

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-stubs

uv

uv add sqlalchemy-stubs

poetry

poetry add sqlalchemy-stubs

Installing 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

Development Status :: 3 - AlphaProgramming Language :: Python :: 3

Tags

sqlalchemy type stubsmypy sqlalchemy pluginsqlalchemy static typingtype checking sqlalchemysqlalchemy type inferencemypy sqlalchemy supportsqlalchemy type hints
type-checkingsqlalchemymypy-plugin

More Quality Assurance packages