DEV.co
Open-Source Databases · psycopg

psycopg

Psycopg 3 is a modern PostgreSQL database adapter for Python that provides both pure-Python and optimized C implementations. It supports connection pooling, async operations, and is designed as a successor to earlier Psycopg versions.

Source: GitHub — github.com/psycopg/psycopg
2.4k
GitHub stars
251
Forks
Python
Primary language
LGPL-3.0
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositorypsycopg/psycopg
Ownerpsycopg
Primary languagePython
LicenseLGPL-3.0 — OSI-approved
Stars2.4k
Forks251
Open issues71
Latest releaseUnknown
Last updated2026-07-01
Sourcehttps://github.com/psycopg/psycopg

What psycopg is

A Python database driver for PostgreSQL with modular architecture: pure Python core (psycopg), optional C/Cython performance module (psycopg_c), and separate connection pool package (psycopg_pool). Runtime dependency on libpq; development requires C build tools for optimizations.

Quickstart

Get the psycopg source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/psycopg/psycopg.gitcd psycopg# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Production PostgreSQL applications in Python

Primary use case for new projects needing modern PostgreSQL connectivity with async support and connection pooling capabilities.

High-performance database layers

Applications requiring optimized query execution can use the optional C speedup extension (psycopg_c) for reduced overhead.

Web frameworks and APIs

Suitable for Django, FastAPI, and other web applications needing reliable PostgreSQL integration with pool management.

Implementation considerations

  • libpq system library must be installed pre-deployment (Debian, macOS, Windows all supported); verify availability in target environment.
  • Repository contains multiple independent packages (psycopg, psycopg_c, psycopg_pool) with potentially different release cycles; plan updates accordingly.
  • C extension (psycopg_c) is optional but requires development tools and compilation; performance gains vs. deployment complexity tradeoff should be evaluated.
  • Connection pool (psycopg_pool) is separate package; applications using pooling require explicit installation beyond base psycopg.
  • Pure Python implementation works without C toolchain; suitable for rapid prototyping but may have performance overhead vs. compiled version.

When to avoid it — and what to weigh

  • PostgreSQL not available — This is a PostgreSQL-specific adapter; projects using other databases (MySQL, SQLite, etc.) require different drivers.
  • Minimal deployment dependencies required — Runtime requires libpq system library; environments with strict dependency restrictions or no package management may face friction.
  • No version stability guarantee needed — Latest release status is listed as n/a; unclear versioning or release cadence may be problematic for projects requiring strict SLA versions.
  • Proprietary/closed-source commercial software — LGPL-3.0 requires careful review; LGPL obligations regarding linking and source distribution disclosure must be evaluated by legal/compliance teams.

License & commercial use

Licensed under LGPL-3.0 (GNU Lesser General Public License v3.0). This is a copyleft license with source-code-level obligations.

LGPL-3.0 permits commercial use, but imposes obligations: derivative works must be distributed under LGPL-3.0, and if you distribute the software, you must provide recipients access to source code and allow modification. Linking (static or dynamic) triggers obligations. Requires legal review before use in proprietary products; web/SaaS deployment may have different obligations than traditional distribution. Do not assume freedom to use without compliance assessment.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityModerate
DEV.co fitGood
Assessment confidenceHigh
Security considerations

No security audit data, known CVEs, or security posture documented in provided sources. Standard database driver attack surface applies: SQL injection depends on application code (not driver), connection string handling, and libpq configuration. LGPL source availability aids third-party audits. Requires review of official security policy/changelog for vulnerability history.

Alternatives to consider

asyncpg

Pure-Python async PostgreSQL driver; faster for async workloads, no libpq dependency, but less feature-parity with psycopg3 for synchronous use.

SQLAlchemy (with psycopg)

ORM abstraction over psycopg; adds data modeling layer and database portability, but introduces abstraction overhead and dependency chain.

psycopg2

Earlier Psycopg generation; stable and widely deployed, but no async support and less modern architecture than psycopg3.

Software development agency

Build on psycopg with DEV.co software developers

Review licensing obligations, libpq dependencies, and modular architecture before adopting. Consult our team if compliance or deployment complexity are concerns.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

psycopg FAQ

Do I need libpq installed?
Yes, libpq (PostgreSQL client library) is a runtime dependency. Install via apt (Debian), brew (macOS), or EnterpriseDB installers (Windows).
Is the C extension required?
No, the base psycopg is pure Python. The C extension (psycopg_c) is optional and provides performance optimization; include only if needed.
Can I use this for async applications?
Likely yes, but not confirmed in provided README. Documentation at psycopg.org should clarify async API support; verify against your framework.
What is the difference between psycopg, psycopg_c, and psycopg_pool?
psycopg is the core driver; psycopg_c is an optional C speedup module; psycopg_pool is a separate connection pool implementation with independent versioning.

Software developers & web developers for hire

DEV.co is a software development agency delivering custom software development services to companies building on open source. Our software developers and web developers design, integrate, and ship production systems — spanning web development, APIs, AI, data, and cloud. If psycopg is part of your open-source databases roadmap, our team can implement, customize, migrate, and maintain it.

Evaluate Psycopg 3 for Your PostgreSQL Project

Review licensing obligations, libpq dependencies, and modular architecture before adopting. Consult our team if compliance or deployment complexity are concerns.