asyncpg-stubs
asyncpg stubs
What it is and what it does
asyncpg-stubs is a type stub package that adds precise static type information to asyncpg, the popular async PostgreSQL driver for Python. It works alongside asyncpg to enable type checkers like mypy and IDEs to understand the types of asyncpg's API, improving code completion and catching type errors at development time rather than runtime.
The package follows a semantic versioning scheme where its major and minor versions track the corresponding asyncpg release—for example, asyncpg-stubs 0.25.X works with asyncpg 0.25.Y. It requires asyncpg and typing-extensions as runtime dependencies and is actively maintained across Python 3.9 through 3.14.
Use it for:
- Enable mypy or pyright to catch type errors in asyncpg code before runtime.
- Improve IDE autocomplete and inline documentation when writing asyncpg queries.
- Maintain type safety in large async database applications with strict type checking.
- Provide better developer experience when working with asyncpg in typed Python projects.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides type stubs for asyncpg to enable static type checking and improved IDE autocompletion when using the asyncpg PostgreSQL driver.
Yes. If you use asyncpg and want static type checking, this is the standard way to get accurate types for the library. Installation is frictionless, maintenance is active, and the BSD-3-Clause license poses no restrictions. Version matching with asyncpg is straightforward via the documented semver scheme.
Install
asyncpg-stubs on PyPI
pip
pip install asyncpg-stubsuv
uv add asyncpg-stubspoetry
poetry add asyncpg-stubsInstalling asyncpg-stubs
Before you install
Low friction installation with active maintenance—last release 35 days ago. Depends only on asyncpg and typing-extensions, both lightweight. Supports Python 3.9 through 3.14.
License in practice
BSD-3-Clause permissive license allows use in most projects without restriction.
Quickstart
pip install asyncpg-stubs
import asyncpg
conn = await asyncpg.connect('postgresql://user:pass@localhost/db')
Requires asyncpg to be installed separately; version matching recommended (asyncpg-stubs major.minor should match asyncpg major.minor).
Verify before relying
- Whether type coverage is complete for all asyncpg APIs or if gaps remain.
- Performance impact of type checking with these stubs in large codebases.
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (<4.0,>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — asyncpg, typing-extensions |
| Maintenance | actively maintained — 35 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,447,804/month — #3,061 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: asyncpg_stubs-0.31.3-py3-none-any.whl
Tags
More Database packages
psycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
redisPython client library for connecting to and…
permissive · top 1,000 on PyPI
ydbYDB Python SDK is the official client library…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
sqlparsesqlparse tokenizes SQL text into a tree of…
permissive · top 1,000 on PyPI
dbt-adaptersProvides base adapter protocols and shared…
permissive · top 1,000 on PyPI
types-pikaProvides type stubs for the Pika RabbitMQ…
permissive · top 15,000 on PyPI
asyncpgasyncpg is an asyncio-native PostgreSQL client…
permissive · top 1,000 on PyPI
pika-stubsProvides type stubs for the pika RabbitMQ…
permissive · top 15,000 on PyPI
opentelemetry-instrumentation-asyncpgAdds distributed tracing to PostgreSQL queries…
permissive · top 5,000 on PyPI
sqlalchemy-stubsProvides type stubs and a mypy plugin to enable…
permissive · top 5,000 on PyPI
databasesProvides async database access for PostgreSQL,…
permissive · top 5,000 on PyPI
langchain-postgresProvides LangChain abstractions for vector…
permissive · top 5,000 on PyPI
sqlalchemy-rdsiamProvides SQLAlchemy dialects for connecting to…
unclear · top 15,000 on PyPI
motor-typesProvides Python type stubs for Motor, enabling…
permissive · top 15,000 on PyPI
kubernetes-stubs-elephant-forkProvides type stubs for the Kubernetes Python…
permissive · top 5,000 on PyPI