skillfed

asyncpg-stubs

asyncpg stubs

asyncpg-stubs v0.31.3 2.4M downloads/30d#3,061 on PyPI50
Permissive license BSD-3-Clause Active released

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

uv

uv add asyncpg-stubs

poetry

poetry add asyncpg-stubs

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Typing :: Typed

Tags

asyncpg type stubsasyncpg type hintspostgresql async type checkingasyncpg mypy supportasyncpg static typingasyncpg type annotationsasyncpg ide autocomplete
type-stubsasyncpgstatic-typing

More Database packages

psycopg2-binary

psycopg2-binary is a PostgreSQL database…

copyleft · top 1,000 on PyPI

redis

Python client library for connecting to and…

permissive · top 1,000 on PyPI

ydb

YDB Python SDK is the official client library…

permissive · top 1,000 on PyPI

snowflake-connector-python

Connects Python applications to Snowflake data…

permissive · top 1,000 on PyPI

sqlparse

sqlparse tokenizes SQL text into a tree of…

permissive · top 1,000 on PyPI

dbt-adapters

Provides base adapter protocols and shared…

permissive · top 1,000 on PyPI

types-pika

Provides type stubs for the Pika RabbitMQ…

permissive · top 15,000 on PyPI

asyncpg

asyncpg is an asyncio-native PostgreSQL client…

permissive · top 1,000 on PyPI

pika-stubs

Provides type stubs for the pika RabbitMQ…

permissive · top 15,000 on PyPI

opentelemetry-instrumentation-asyncpg

Adds distributed tracing to PostgreSQL queries…

permissive · top 5,000 on PyPI

sqlalchemy-stubs

Provides type stubs and a mypy plugin to enable…

permissive · top 5,000 on PyPI

databases

Provides async database access for PostgreSQL,…

permissive · top 5,000 on PyPI

langchain-postgres

Provides LangChain abstractions for vector…

permissive · top 5,000 on PyPI

sqlalchemy-rdsiam

Provides SQLAlchemy dialects for connecting to…

unclear · top 15,000 on PyPI

motor-types

Provides Python type stubs for Motor, enabling…

permissive · top 15,000 on PyPI

kubernetes-stubs-elephant-fork

Provides type stubs for the Kubernetes Python…

permissive · top 5,000 on PyPI