Type annotations for SQLAlchemy
Switch branches/tags
Nothing to show
Clone or download
Latest commit 5e89b66 Nov 14, 2017




This repository contains external type annotations (see PEP 484) for the SQLAlchemy package. Such type annotations are normally included in typeshed, but SQLAlchemy's annotations were frequently problematic and have therefore been deleted from typeshed. This repo provides SQLAlchemy stubs with some issues fixed for those who find them useful. Hopefully it can eventually be merged back into typeshed.


To use these stubs, clone this repo and point your type checker to it. For example, to use them in mypy, you can set the $MYPYPATH environment variable or set mypy_path = /path/to/sqlalchemy-stubs in your mypy.ini.


Contributions should follow the same style guidelines as typeshed.

Git history

The early git history of this repo contains commits from typeshed, filtered to only changes that affect typeshed (using git filter-branch). The SQLAlchemy stubs were moved around a few times (from third_party/2.7 to third_party/2 to third_party/2and3), and commits from all of these locations are included.


This repository was created by Jelle Zijlstra. Numerous others have contributed to the SQLAlchemy stubs; see the git history for details.


  • Provide testing (both a local test script and a Travis setup)
  • Document in this file what problems led to SQLAlchemy being deleted from typeshed.
  • Maybe provide an automated installation script. (For example, I think we could make a pip package that depends on mypy and installs these stubs inside mypy's copy of typeshed. Or we could wait for mypy to provide a standardized way to add third-party stubs.)