Registry / database / pg0-embedded

pg0-embedded

JSON →
library0.14.2pypypi✓ verified 83d ago

Python API for pg0 - embedded PostgreSQL. Version 0.14.2, updated semi-regularly. Provides a PostgreSQL server that starts and stops with your Python process, ideal for testing and ephemeral databases.

pip install pg0-embedded
INSTALL
IMPORT
SIG · PG0-EMBEDDED
P
pg0-embedded
databasepythonv0.14.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pg0
import pg0
from pg0 import pg0
The package is a module, not a class. Use import pg0 and access functions like pg0.start()

Start an embedded PostgreSQL server, connect with psycopg2 or asyncpg, then stop.

import pg0 import os pg0_options = { 'host': os.environ.get('PGHOST', 'localhost'), 'port': int(os.environ.get('PGPORT', 5432)), 'database': os.environ.get('PGDATABASE', 'test'), 'user': os.environ.get('PGUSER', 'postgres'), 'password': os.environ.get('PGPASSWORD', 'postgres') } pg0.start() # Now you can connect and run SQL pg0.stop()
Debug
Known issues
breakingpg0.start() and pg0.stop() replaced the older context manager style. The library now starts immediately without context.
fix
Update to using pg0.start() and pg0.stop() directly. Remove old 'with pg0: ...' patterns.
affects: <0.12.0
gotchapg0.initialize() must be called before start() on Windows or in certain environments. Failure to call initialize() leads to obscure errors.
fix
Call pg0.initialize() once at the beginning of your script, especially on Windows.
affects: >=0.10.0
gotchaThe embedded PostgreSQL server uses a temporary data directory by default. Data is lost after pg0.stop() unless you set a persistent directory via pg0.set_data_directory('/path/to/data').
fix
Set a persistent data directory using pg0.set_data_directory(path) before calling pg0.start() if you need to preserve data between runs.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pg0'
Package not installed or installed under a different name (e.g., 'pg0-embedded').
fix
Install using 'pip install pg0-embedded'. The import is 'import pg0'.
RuntimeError: pg0 is not initialized. Did you forget to call pg0.initialize()?
On some platforms (especially Windows), pg0 requires explicit initialization before start.
fix
Add 'pg0.initialize()' before calling 'pg0.start()'.
Upgrade
Version history
0.14.2latest on PyPI · released May 28, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
pg0-embedded — pip install pg0-embedded · libregistry