// the find
wey-gu/py-pglite
PGlite wrapper in Python for testing. Test your app with Postgres just as lite as SQLite.
py-pglite wraps PGlite (Postgres compiled to WASM) to give Python test suites a real Postgres instance with no Docker or server setup. It hooks into pytest as a plugin and provides fixtures for SQLAlchemy, Django, psycopg, and asyncpg. Useful for anyone who wants genuine Postgres semantics in CI without the container overhead.
PGlite is actually real Postgres (not SQLite pretending), so JSONB, arrays, window functions, and extensions like pgvector work correctly — the thing it promises, it delivers. The pytest plugin integration is clean: you get `pglite_session` as a fixture and nothing else needs configuring. Extension support (`pip install py-pglite[extensions]`) means you can test pgvector-dependent code without standing up a full Postgres instance, which is genuinely useful for RAG application testing. The test suite itself is substantial — 40+ test files covering async, Django, connection resilience, and TCP mode — not just happy-path coverage.
PGlite's single-connection constraint is a real limitation that will bite anyone with connection pools or parallel test workers — the docs mention it but don't make it prominent enough. TCP mode's `server_settings={}` requirement for asyncpg is a silent footgun that hangs tests if you miss it. The Django integration has two separate patterns (lightweight socket vs full backend) with meaningfully different capabilities, and the docs undersell how much this matters — you can easily pick the wrong one and spend time debugging missing JSON support. Startup time is still 2-3 seconds per process, so test suites that spin up a fresh instance per test class rather than reusing one will feel slow at scale.