$npx skillfedfor your agent

types-psycopg2

Typing stubs for psycopg2

With conditionsPyPI DatabaseReleased Jul 20268.6M downloads / moApache-2.0Pure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — types_psycopg2-2.9.21.20260724-py3-none-any.whl
v2.9.21.20260724 · released 2026-07-24 · Python >=3.10

Yes, if you use psycopg2 and run static type checking. The package is lightweight, has no dependencies, and is actively maintained. Install it alongside psycopg2 to enable type checking in your development workflow. Not necessary if you do not use a type checker or do not use psycopg2.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python >= 3.10.
  • Type checking requires a compatible type checker (mypy 2.3.0 or pyright 1.1.411 or later).
  • Low install friction with no runtime dependencies.

License · maintenance · safety

Apache-2.0 (permissive) — Apache-2.0 is permissive; you may use, modify, and distribute this package freely in most contexts without restriction.

last release 2026-07-24 (21 days) · last repo commit 2026-08-14 · 37 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 8,579,609 downloads/mo, #1,605 on PyPI

Verify before relying

pip install types-psycopg2

import psycopg2
conn = psycopg2.connect("dbname=test user=postgres")
  • Coverage of psycopg2 API surface beyond 2.9.12 (e.g., newer versions or extensions).
  • Whether stubs are kept in sync with psycopg2 releases after 2.9.12.
Same gist for agents: .md · .json

What it is and what it does

types-psycopg2 is a type stub package that adds static type information to psycopg2, the widely-used PostgreSQL adapter for Python. It allows type checkers like mypy and pyright to understand the types and signatures of psycopg2's API, catching type errors at development time rather than runtime. The stubs are maintained as part of the typeshed project and aim to provide accurate annotations for psycopg2 version 2.9.12.

This package has no runtime dependencies and installs as a pure Python wheel. It is intended to be used alongside psycopg2 itself during development and type-checking workflows. The stubs have been tested with mypy 2.3.0 and pyright 1.1.411, and the package is actively maintained with recent updates.

Use it for

  • Enable mypy or pyright to type-check code that imports and uses psycopg2 for database connections.
  • Catch type errors in psycopg2 method calls and result handling before running tests.
  • Provide IDE autocomplete and inline type hints when working with psycopg2 in a type-aware editor.
  • Validate that database query results and cursor operations match expected types in a CI/CD pipeline.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you use psycopg2 and run static type checking.

The package is lightweight, has no dependencies, and is actively maintained. Install it alongside psycopg2 to enable type checking in your development workflow. Not necessary if you do not use a type checker or do not use psycopg2.

Install

types-psycopg2 on PyPI

Before you install

Low install friction with no runtime dependencies. Actively maintained as part of typeshed; last commit 2026-08-14 and release 21 days ago.

Requires Python >= 3.10. Type checking requires a compatible type checker (mypy 2.3.0 or pyright 1.1.411 or later).

License in practice

Apache-2.0 is permissive; you may use, modify, and distribute this package freely in most contexts without restriction.

Quickstart

pip install types-psycopg2

import psycopg2
conn = psycopg2.connect("dbname=test user=postgres")

Verify before relying

  • Coverage of psycopg2 API surface beyond 2.9.12 (e.g., newer versions or extensions).
  • Whether stubs are kept in sync with psycopg2 releases after 2.9.12.

Package facts

LicenseApache-2.0 permissive
Python supportSupports the current Python release >=3.10
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceActively maintained 21 days since the last release
Last repo commit
First released
Downloads8,579,609 / month, #1,605 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Programming Language :: Python :: 3Typing :: Stubs Only

Evidence: types_psycopg2-2.9.21.20260724-py3-none-any.whl

Tags

Capabilities
psycopg2 type hintspsycopg2 type stubspostgresql adapter typingmypy psycopg2 supportpyright psycopg2 annotationstype checking postgresqlpsycopg2 static analysis
Topics
type-stubspostgresql

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “psycopg2 type hints”

  • types-psycopg2Provides type hints for psycopg2, enabling static type checkers like…
  • queriesQueries is a simplified wrapper around psycopg2 that provides a…
  • pgcopypgcopy wraps PostgreSQL's binary COPY protocol to load data into…

Give your agent the search over MCP, or paste the wish link into any chat.

More Database packages

psycopg2-binary Worth it
PyPI · Software Development · released Apr 2026

psycopg2-binary is a PostgreSQL database adapter for Python that implements the DB API 2.0 specification, enabling Python applications to connect to and query PostgreSQL databases with thread-safe concurrent operations.

copyleftcompiled wheel · 3.9+
271.6Mdownloads / mo
redis Worth it
PyPI · Database · released Jul 2026

Python client library for connecting to and executing commands against Redis key-value stores, supporting both synchronous and asynchronous operations.

Install it if your application needs to interact with Redis; the only prerequisite is a running Redis server instance.

MITpure Python · 3.10+
268.3Mdownloads / mo
ydb Worth it
PyPI · Database · released Jul 2026

YDB Python SDK is the official client library for connecting to and querying YDB databases from Python applications.

Install it if you need to connect Python applications to YDB databases.

permissive licensepure Python · 3.10+
210.0Mdownloads / mo
snowflake-connector-python Worth it
PyPI · Software Development · released Aug 2026

Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.

Apache-2.0compiled wheel · 3.10+
193.6Mdownloads / mo
sqlparse Worth it
PyPI · Software Development · released Aug 2026

sqlparse tokenizes SQL text into a tree of statements, clauses, and expressions, and provides functions to split scripts, format queries, and inspect parsed tokens without validating dialect or syntax.

Install it if you need to manipulate, format, or analyze SQL text programmatically.

BSD-3-Clausepure Python · 3.10+
148.9Mdownloads / mo
dbt-adapters With conditions
PyPI · Database · released Jul 2026

Provides base adapter protocols and shared functionality that database adapters use to integrate with dbt-core, handling connections, dialect translation, relation caching, and core interface management.

Apache-2.0pure Python · 3.10.0+
121.3Mdownloads / mo

See also types-pyflakes · types-mypy-extensions · types-paramiko · types-docutils · types-fpdf2 · optype · types-httplib2 · types-PyMySQL · psycopg-binary · psycopg-c