PyPgConfig
Access pg_config from Python
Decision gist · record as of 2026-08-14
Yes, if you need to programmatically query PostgreSQL configuration at runtime and can accept an alpha-stage, dormant package. The low install friction and permissive license are in its favor, and there are no known vulnerabilities. However, the lack of updates since 2023-11-28 and alpha status mean you should verify it works with your PostgreSQL version and be prepared to maintain a fork if needed.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- PostgreSQL and pg_config must be installed on the system where this code runs.
- Installation is straightforward with low friction—the package is a pure Python wheel with only setuptools and pip as runtime dependencies.
- However, the project is dormant; the last commit was 2023-11-28 and no updates have been released since the initial 0.1.0a2 alpha version.
License · maintenance · safety
Apache License, Version 2.0 (permissive) — Licensed under Apache License, Version 2.0 (permissive), so you may use, modify, and distribute the package freely in commercial and private projects, provided you include a copy of the license.
last release 2023-11-27 (991 days) · last repo commit 2023-11-28
0 known vulnerabilities (OSV.dev, 2026-08-14) · 98,966 downloads/mo, #13,046 on PyPI
Alternatives
Verify before relying
pip install PyPgConfig
from pypgconfig import detect
pgconf = detect()
pgconf.version # "15.4"
pgconf.libs # ["pgcommon", "pgport", "lz4", "xml2"]- Whether detect() raises an exception or returns a specific value if pg_config is not found.
- Whether the package works with PostgreSQL versions other than the 15.4 example shown.
- Stability guarantees for the 0.1.0a2 alpha release and whether a stable 1.0 is planned.
What it is and what it does
PyPgConfig is a thin Python wrapper around the PostgreSQL pg_config utility. It runs pg_config on the system and parses its output to expose PostgreSQL metadata—version number (with major/minor breakdown), linked libraries, and build-time options like Python support—as Python objects and attributes.
The package is useful when you need to programmatically discover PostgreSQL installation details at runtime, such as which libraries PostgreSQL was compiled with or whether Python support is enabled. It requires that PostgreSQL and pg_config be installed on the system where the code runs.
Use it for
- Detect PostgreSQL version at runtime to conditionally enable or disable features in a Python application.
- Query which libraries PostgreSQL was compiled with to verify compatibility before attempting a connection.
- Locate the Python installation path that PostgreSQL was built with to ensure consistent Python environments.
- Automate build or deployment scripts that need to confirm PostgreSQL is installed and inspect its configuration.
- Validate PostgreSQL build options (e.g., Python support) before initializing a database client.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to programmatically query PostgreSQL configuration at runtime and can accept an alpha-stage, dormant package.
The low install friction and permissive license are in its favor, and there are no known vulnerabilities. However, the lack of updates since 2023-11-28 and alpha status mean you should verify it works with your PostgreSQL version and be prepared to maintain a fork if needed.
Install
pypgconfig on PyPI
Before you install
Installation is straightforward with low friction—the package is a pure Python wheel with only setuptools and pip as runtime dependencies. However, the project is dormant; the last commit was 2023-11-28 and no updates have been released since the initial 0.1.0a2 alpha version.
PostgreSQL and pg_config must be installed on the system where this code runs.
License in practice
Licensed under Apache License, Version 2.0 (permissive), so you may use, modify, and distribute the package freely in commercial and private projects, provided you include a copy of the license.
Quickstart
pip install PyPgConfig
from pypgconfig import detect
pgconf = detect()
pgconf.version # "15.4"
pgconf.libs # ["pgcommon", "pgport", "lz4", "xml2"]
Verify before relying
- Whether detect() raises an exception or returns a specific value if pg_config is not found.
- Whether the package works with PostgreSQL versions other than the 15.4 example shown.
- Stability guarantees for the 0.1.0a2 alpha release and whether a stable 1.0 is planned.
Package facts
| License | Apache License, Version 2.0 permissive |
| Python support | Supports the current Python release >=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagessetuptoolspip |
| Maintenance | Dormant 991 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 98,966 / month, #13,046 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: PyPgConfig-0.1.0a2-py3-none-any.whl
Tags
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 › “postgres configuration detection”
- PyPgConfigPyPgConfig detects and exposes PostgreSQL configuration details from…
- django-pglockProvides Postgres advisory locks, table locks, and lock management…
- pgsanityPgSanity validates PostgreSQL SQL syntax by wrapping the ecpg parser,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Database packages
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.
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.
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.
Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.
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.
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.
See also pgdb · py-pglite · psycopg · pgserver · aws-psycopg2 · testing.postgresql · detect-installer · postgres · pg0-embedded · findpython