* feat: detect psycopg[binary] and skip apt packages
When using psycopg2-binary or psycopg[binary], the PostgreSQL client
libraries (libpq-dev, libpq5) are not needed because these variants
ship with pre-compiled binaries. This change:
- Adds usesBinaryPsycopg() to detect binary variants
- Updates usesPostgres() to return false when binary variants are used
- Skips libpq-dev (build) and libpq5 (runtime) apt package installation
- Adds comprehensive unit tests for binary psycopg detection
This reduces image size and build time for projects using binary variants.
* test: add psycopg[binary] integration test
Adds a dedicated test example for psycopg[binary] to verify that the
bracket syntax for optional dependencies is correctly detected. This
ensures the binary detection works for both psycopg2-binary and
psycopg[binary] variants.
Test coverage now includes:
- psycopg2-binary (existing python-system-deps example)
- psycopg[binary] (new python-psycopg-binary example)
- psycopg non-binary (existing python-latest-psycopg example)
- psycopg2 non-binary (existing python-django example)
* test: snapshot update
* test: add binary pyscogp test
* test: ensure libpq is installed for pyscog operation
* build: add helper for running the current dir tests
* test: check to make sure the libpg library is not installed when a binary postgres connection is requested
* test: update snapshot
---------
Co-authored-by: Hanzo Dev <[email protected]>
* feat: add psycopg (psycopg3) to postgres dependency detection
Added psycopg to the list of Python dependencies that trigger installation
of PostgreSQL libraries (libpq-dev for build, libpq5 for runtime).
While psycopg[binary] includes a bundled libpq, the base psycopg package
and psycopg[c] both require system libpq. Since we cannot determine which
variant is being used from dependency files, we conservatively install
libpq when any psycopg dependency is detected.
Also added integration test example for psycopg3 to verify the dependency
detection works correctly.
* chore: add tmp/ to .gitignore
* test: enhance psycopg3 example to test actual database connectivity
Updated the python-psycopg3 example to:
- Connect to a real PostgreSQL database
- Execute test queries to verify connectivity
- Use docker-compose.yml to provide postgres service for integration tests
- Assert on multiple output strings to verify full connection lifecycle
This provides a comprehensive test that psycopg can successfully use
the system libpq libraries to connect to and query PostgreSQL.
* test: upgrade psycopg3 example to Python 3.14 and assert major version
Updated the python-psycopg3 example to:
- Use Python 3.14 (latest stable release)
- Specify psycopg>=3.2,<4.0 to ensure psycopg3 is used
- Add runtime check that verifies psycopg major version is 3
- Update test assertion to match new output message
This ensures the test explicitly validates we're using psycopg3 (not
psycopg2) and tests compatibility with the latest Python version.
* refactor: convert python-psycopg3 example to use uv and latest Python
- Changed .python-version from 3.14 to "latest"
- Converted from pip to uv package manager
- Created pyproject.toml with psycopg>=3.2,<4.0 dependency
- Generated uv.lock for reproducible builds
- Removed requirements.txt
- Reverted .gitignore changes (removed tmp/)
* test: update snapshot
---------
Co-authored-by: Hanzo Dev <[email protected]>