Skip to content

deps: replace psycopg2-binary with psycopg2#252

Closed
PeakPy wants to merge 1 commit intobenavlabs:mainfrom
PeakPy:feature/remove-psycopg2-binary
Closed

deps: replace psycopg2-binary with psycopg2#252
PeakPy wants to merge 1 commit intobenavlabs:mainfrom
PeakPy:feature/remove-psycopg2-binary

Conversation

@PeakPy
Copy link

@PeakPy PeakPy commented Feb 12, 2026

This PR addresses the PostgreSQL dependency part of issue #248 by replacing psycopg2-binary with the recommended psycopg2 package.

Changes:

  • Remove psycopg2-binary from project dependencies in pyproject.toml.
  • Add psycopg2>=2.9.9 as the production-safe PostgreSQL driver.
  • Update uv.lock accordingly.

Rationale:

  • psycopg2-binary is not recommended for production use.
  • The project already uses asyncpg for async access; psycopg2 is only needed for sync tooling (e.g. tests, create_engine).

Tests:

  • uv run pytest
  • uv run ruff check src
  • uv run mypy src

@LucasQR
Copy link
Collaborator

LucasQR commented Feb 17, 2026

psycopg2-binary is a dev-only dependency — it's listed under [project.optional-dependencies] dev in pyproject.toml, not in the main dependencies. It is not
installed in production.

It's needed because the test suite (tests/conftest.py) uses a synchronous SQLAlchemy engine (create_engine with the postgresql:// prefix), which requires a sync
PostgreSQL driver. asyncpg only works with async engines (postgresql+asyncpg://) and cannot serve this role.

The production application uses exclusively asyncpg for all database access. The -binary variant is appropriate here since it's only used in dev/CI environments
where ease of installation matters more than building from source.

@LucasQR LucasQR closed this Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments