pg-psycopg-is-optional-dependency
IN premise
`psycopg` (v3) is soft-imported with fallback to `None`; `_require_psycopg()` raises `ImportError` with install instructions at `PgApi` construction time, mirroring the `mcp_client.py` lazy-guard pattern.
Summary
Psycopg version 3 is not a hard requirement of the system. It is only imported when actually needed, and if it is missing, the code waits until someone tries to create a Postgres connection before failing with a helpful error message telling them how to install it. This keeps the overall package lightweight for users who do not need Postgres support.
Details
| Source | entries/2026/05/11/reasons_lib-pg.md |