skillfed

pg0-embedded

Python API for pg0 - embedded PostgreSQL

pg0-embedded v0.15.1 83.3K downloads/30d#14,087 on PyPI106
Permissive license MIT Active released

What it is and what it does

pg0-embedded is a Python wrapper that bundles PostgreSQL as an embedded database, eliminating the need for separate installation, Docker, or configuration management. It starts a PostgreSQL instance directly from Python code and provides a simple API to execute SQL queries, manage the instance lifecycle, and retrieve connection details. The package includes pgvector extension support out of the box, making it suitable for applications that need vector similarity search alongside traditional SQL operations.

The package is designed for rapid prototyping, testing, and development workflows where spinning up a full PostgreSQL server is overhead. It works as a context manager for automatic startup and shutdown, or as standalone instance management with explicit start/stop calls. Connection URIs are generated automatically, and the instance runs on localhost with configurable port, username, password, and database name.

Use it for:

  • Rapid prototyping and development when you need SQL and vector search without infrastructure setup
  • Automated testing that requires a real PostgreSQL database without Docker or external services
  • Building AI/ML applications with pgvector for semantic search and embeddings in a single Python process
  • Distributing Python applications that need embedded database functionality without end-user PostgreSQL installation
  • Local development environments where Docker overhead or complexity is undesirable

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Embeds a PostgreSQL database directly in Python with zero configuration, no Docker required, and built-in pgvector support for vector operations.

Yes, if you need PostgreSQL with pgvector in a development or testing context and want to avoid Docker or external database setup. The active maintenance, zero security vulnerabilities, permissive MIT license, and broad platform support make it low-risk. Medium install friction (platform-specific wheels) is a minor trade-off for the convenience of zero-config embedded operation. Not suitable if you need persistent data across application restarts or production-grade database isolation—verify persistence behavior before relying on it for stateful applications.

Install

pg0-embedded on PyPI

pip

pip install pg0-embedded

uv

uv add pg0-embedded

poetry

poetry add pg0-embedded

Installing pg0-embedded

Before you install

Medium install friction due to platform-specific wheels (macOS arm64/x86_64, Linux x86_64/aarch64, Windows x64); active maintenance with recent release (14 days old) and 106 repository stars suggest ongoing support.

License in practice

MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal obligations.

Quickstart

pip install pg0-embedded

from pg0 import Pg0

with Pg0() as pg:
    print(pg.uri)
    pg.execute("CREATE EXTENSION IF NOT EXISTS vector")
    pg.execute("SELECT version()")

Requires Python 3.8 or later; pre-built wheels available for macOS (arm64, x86_64), Linux (x86_64, aarch64), and Windows (x64) only—other platforms require Rust toolchain to build from source.

Verify before relying

  • Whether the embedded PostgreSQL instance persists data across application restarts by default or requires explicit configuration
  • Performance characteristics and resource overhead compared to external PostgreSQL instances
  • Compatibility with existing PostgreSQL tools, drivers, and ORMs beyond the basic URI connection

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.8)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 14 days since the last release
Last repo commit
First released
Downloads 83,255/month — #14,087 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pg0_embedded-0.15.1-py3-none-macosx_14_0_arm64.whl; pg0_embedded-0.15.1-py3-none-macosx_15_0_x86_64.whl; pg0_embedded-0.15.1-py3-none-manylinux_2_35_aarch64.whl; pg0_embedded-0.15.1-py3-none-manylinux_2_35_x86_64.whl; pg0_embedded-0.15.1-py3-none-win_amd64.whl

Keywords: database, embedded, pgvector, postgresql

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

embedded postgresql pythonzero-config postgrespgvector pythonin-process databasepostgresql without dockervector database pythonportable postgres
embedded-databasevector-searchtesting

More Database packages