Skip to main content

Python Version Postgres Version

Linux Support macOS Apple Silicon Support >=11 macOS Intel Support => 10.0 Windows Support >= 2022

License PyPI Package PyPI - Downloads

pgserver: pip-installable, embedded postgres server + pgvector extension for your python app

pgserver lets you build Postgres-backed python apps with the same convenience afforded by an embedded database (ie, alternatives such as sqlite). If you build your app with pgserver, your app remains wholly pip-installable, saving your users from needing to understand how to setup a postgres server (they simply pip install your app, and postgres is brought in through dependencies), and letting you get started developing quickly: just pip install pgserver and pgserver.get_server(...), as shown in this notebook: Open In Colab

To achieve this, you need two things which pgserver provides

  • python binary wheels for multiple-plaforms with postgres binaries
  • convenience python methods that handle db initialization and server process management, that deals with things that would normally prevent you from running your python app seamlessly on environments like docker containers, a machine you have no root access in, machines with other running postgres servers, google colab, etc. One main goal of the project is robustness around this.

Additionally, this package includes the pgvector postgres extension, useful for storing associated vector data and for vector similarity queries.

Basic summary:

  • Pip installable binaries: built and tested on Manylinux, MacOS and Windows.
  • No sudo or admin rights needed: Does not require root privileges or sudo.
  • but... can handle root: in some environments your python app runs as root, eg docker, google colab, pgserver handles this case.
  • Simpler initialization: pgserver.get_server(MY_DATA_DIR) method to initialize data and server if needed, so you don't need to understand initdb, pg_ctl, port conflicts.
  • Convenient cleanup: server process cleanup is done for you: when the process using pgserver ends, the server is shutdown, including when multiple independent processes call pgserver.get_server(MY_DATA_DIR) on the same dir (wait for last one). You can blow away your PGDATA dir and start again.
  • For lower-level control, wrappers to all binaries, such as initdb, pg_ctl, psql, pg_config. Includes header files in case you wish to build some other extension and use it against these binaries.
# Example 1: postgres backed application
import pgserver

db = pgserver.get_server(MYPGDATA)
# server ready for connection.

print(db.psql('create extension vector'))
db_uri = db.get_uri()
# use uri with sqlalchemy / psycopg, etc, see colab.

# if no other process is using this server, it will be shutdown at exit,
# if other process use same pgadata, server process will be shutdown when all stop.
# Example 2: Testing
import tempfile
import pytest
@pytest.fixture
def tmp_postgres():
    tmp_pg_data = tempfile.mkdtemp()
    pg = pgserver.get_server(tmp_pg_data, cleanup_mode='stop')
    yield pg
    pg.cleanup()

Postgres binaries in the package can be found in the directory pointed to by the pgserver.POSTGRES_BIN_PATH to be used directly.

This project was originally based on , which provides a linux wheel. But adds the following differences:

  1. binary wheels for multiple platforms (ubuntu x86, MacOS apple silicon, MacOS x86, Windows)
  2. postgres python management: cross-platfurm startup and cleanup including many edge cases, runs on colab etc.
  3. includes pgvector extension but currently excludes postGIS

Metadata

Release files for pgserver-extend 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for pgserver-extend 0.0.1
File
pgserver_extend-0.0.1-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
pgserver_extend-0.0.1-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
pgserver_extend-0.0.1-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
pgserver_extend-0.0.1-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
pgserver_extend-0.0.1-cp39-cp39-macosx_11_0_arm64.whl CPython 3.9 CPython 3.9 macOS 11.0+ ARM64 Details

Total release size: 50.3 MB

Release files / pgserver_extend-0.0.1-cp313-cp313-macosx_11_0_arm64.whl

Download URL pgserver_extend-0.0.1-cp313-cp313-macosx_11_0_arm64.whl
Size 10.1 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f25c894c42510002610435859d18f3e91e59b245da0dd060c2db7bac395ec921
BLAKE2b-256 checksum
How to use checksums
bc03e3960bbd51b20b040fbc7e408e57963372cb8ae277261f313c5e88b59802
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 10, 2025.

Transparency log

Release files / pgserver_extend-0.0.1-cp312-cp312-macosx_11_0_arm64.whl

Download URL pgserver_extend-0.0.1-cp312-cp312-macosx_11_0_arm64.whl
Size 10.1 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
09c0a78faf10e553cd9304c488a2bd5a22ceab946397a34ddf2fa48dadc95cf1
BLAKE2b-256 checksum
How to use checksums
2b22e8107e86f62ddb2eaa386c06735fca9cf73ac38b840106b52b0b17ab6d1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 10, 2025.

Transparency log

Release files / pgserver_extend-0.0.1-cp311-cp311-macosx_11_0_arm64.whl

Download URL pgserver_extend-0.0.1-cp311-cp311-macosx_11_0_arm64.whl
Size 10.1 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
30e9eab946328ac2c8f4f577e5f31d9c5f73c46e446a611f0ac700dbcf3fa0d8
BLAKE2b-256 checksum
How to use checksums
fd45a18476733778ec834b5e88ee1378258bab61451c560a97e65b703ebda172
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 10, 2025.

Transparency log

Release files / pgserver_extend-0.0.1-cp310-cp310-macosx_11_0_arm64.whl

Download URL pgserver_extend-0.0.1-cp310-cp310-macosx_11_0_arm64.whl
Size 10.1 MB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ce8c9c63c04573eda4953b7a45e4896a3bccba5ae4d148967477833babb405ce
BLAKE2b-256 checksum
How to use checksums
09856ab5d7803b59d53ef594fd60fc573505320288739aea22ee3c0cac2a3352
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 10, 2025.

Transparency log

Release files / pgserver_extend-0.0.1-cp39-cp39-macosx_11_0_arm64.whl

Download URL pgserver_extend-0.0.1-cp39-cp39-macosx_11_0_arm64.whl
Size 10.1 MB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bd0041dadf604379be3c248cc6e9c62cf9fb266707dd50460cc4a13821705c7a
BLAKE2b-256 checksum
How to use checksums
8ed3fb8ed593ae35de26f43c73b17291e9e3f2400f3152ca035d194cafe3e91a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 10, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.1 This release

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page