Skip to main content

Self-contained postgres server for your python applications

Project description

Python Version Postrgres Version Linux Supported macOS Supported Windows Supported

PyPI - Downloads

pgserver: pip-installable postgres + pgvector for your python app

pip install pgserver

pgserver lets you build Postgres-backed python apps that remain wholly pip-installable; saving you and your users from needing to understand how to install and setup a postgres server. To achieve this, you need two things which pgserver provides

  • wheels with postgres binaries included
  • convenient initialization and server process management, with defaults that do not interfere with existing postgres installations, and with handling or prevention of many corner cases (being root, port conflicts, etc)

Additionally, this package includes the pgvector extension.

Try it out: Open In Colab

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

pgdata = f'{MY_APP_DIR}/pgdata'
db = pgserver.get_server(pgdata)
# server ready for connection.

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

# 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()
    with pgserver.get_server(tmp_pg_data, cleanup_mode='delete') as pg:
        yield pg

Postgres binaries in the package can be found in the directory pointed to by the pgserver.pg_bin global variable.

Originally based on https://github.com/michelp/postgresql-wheel,which offers an ubuntu wheel. But with the following differences:

  1. binary wheels for multiple platforms (ubuntu x86, MacOS apple silicon, MacOS x86, Windows)
  2. postgres server management: cross-platform builds, with cross-platfurm startup and cleanup including many edge cases.
  3. includes pgvector extension but excludes postGIS (need to build cross platform, pull requests taken)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pgserver-0.1.2-cp312-cp312-win_amd64.whl (12.8 MB view details)

Uploaded CPython 3.12 Windows x86-64

pgserver-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.3 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

pgserver-0.1.2-cp312-cp312-macosx_14_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.12 macOS 14.0+ ARM64

pgserver-0.1.2-cp312-cp312-macosx_12_0_x86_64.whl (10.3 MB view details)

Uploaded CPython 3.12 macOS 12.0+ x86-64

pgserver-0.1.2-cp311-cp311-win_amd64.whl (12.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

pgserver-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.3 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pgserver-0.1.2-cp311-cp311-macosx_14_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.11 macOS 14.0+ ARM64

pgserver-0.1.2-cp311-cp311-macosx_12_0_x86_64.whl (10.3 MB view details)

Uploaded CPython 3.11 macOS 12.0+ x86-64

pgserver-0.1.2-cp310-cp310-win_amd64.whl (12.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

pgserver-0.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.3 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pgserver-0.1.2-cp310-cp310-macosx_14_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.10 macOS 14.0+ ARM64

pgserver-0.1.2-cp310-cp310-macosx_12_0_x86_64.whl (10.3 MB view details)

Uploaded CPython 3.10 macOS 12.0+ x86-64

pgserver-0.1.2-cp39-cp39-win_amd64.whl (12.8 MB view details)

Uploaded CPython 3.9 Windows x86-64

pgserver-0.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.3 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pgserver-0.1.2-cp39-cp39-macosx_14_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.9 macOS 14.0+ ARM64

pgserver-0.1.2-cp39-cp39-macosx_12_0_x86_64.whl (10.3 MB view details)

Uploaded CPython 3.9 macOS 12.0+ x86-64

File details

Details for the file pgserver-0.1.2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pgserver-0.1.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 12.8 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pgserver-0.1.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a99d3be74f7e576a917f0a5159990ea5ee717d356d478bcb4b462043101d8120
MD5 125fb676c8bc26460f9c278f1ed2aadf
BLAKE2b-256 104a35f55a5f87e08f98939b292d1fe2d1f68f6d9ab519a4f5edadfbcafd714b

See more details on using hashes here.

File details

Details for the file pgserver-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 789fbdffd583b1f8c89a257280e58618d43e7ee1077127659cc33b8ddc16268b
MD5 aca6197f2f15df8fe5d0f9a8b52ec858
BLAKE2b-256 55643b1ba74a08c9ca796a58295e71cc66c2164a62508123f530f5b8a9b9d33b

See more details on using hashes here.

File details

Details for the file pgserver-0.1.2-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.2-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 b49b91353e199a9d7674823b2f0e4b44d9c7df2c79873ffc443bef076bf18034
MD5 971e98fcad91de358792d68fe3efb1bc
BLAKE2b-256 c1c612785cec2141fb2231ba9c0d1ed1535626a96b734ce81ad73d71deb48b2f

See more details on using hashes here.

File details

Details for the file pgserver-0.1.2-cp312-cp312-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.2-cp312-cp312-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 8589cf55d1748ca291a3b15a8f4316faea836014c489cc8fefa36ee7a40f7b5a
MD5 d7579ddb21f58a7af92664769ec2940b
BLAKE2b-256 e1d06590a0b0abb6945f566ad1a0143dc1e9fffd0248e170f6ab32f22261684a

See more details on using hashes here.

File details

Details for the file pgserver-0.1.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pgserver-0.1.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 12.8 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pgserver-0.1.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c553af72c4481b137c0d9ca7ab6674bba9bdf4435c772b5cc00342d421fafe10
MD5 209862d5c15fd8919fe8f67f7c7a887a
BLAKE2b-256 38dbd1a7fff5028c20a7cecca10762b57c50bcf1b579251834a792a53c43136e

See more details on using hashes here.

File details

Details for the file pgserver-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c70ef4d0b6b7696f95892add40cabe8504bfb9a88d709493930937cff1a383e5
MD5 56814143ed99ae37e0e07981f912c248
BLAKE2b-256 bea494af43c59d7716672b2a0bcf3e79f5919ded62f90dbfe2792242e4a73e30

See more details on using hashes here.

File details

Details for the file pgserver-0.1.2-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.2-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 de432ece5a4b0cc35003598738084a268533e914d5ecb449af8bb0e74575eb27
MD5 f91d62c1fb69dc6b9db677b17e183fd7
BLAKE2b-256 5bc4cc031c09401fa93d25a96de01b44c42485dad38f4ce8b7aa52f404697b87

See more details on using hashes here.

File details

Details for the file pgserver-0.1.2-cp311-cp311-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.2-cp311-cp311-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 84054c23716a121b3ad02ce029fa3fe6b8f9aec6e33163964d82327e73d13497
MD5 d5e71a2c2077a5c1aae08252cd6a837f
BLAKE2b-256 f8d10aea29913ab797a1e17b31985c36cb8be89c1822887dd43f7a305d9f5417

See more details on using hashes here.

File details

Details for the file pgserver-0.1.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pgserver-0.1.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 12.8 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pgserver-0.1.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 68fbbed09604f8bae0b7a89f7d3113637429b40b95b01de651a58bf68064bf1e
MD5 3860c4dd99927082f837f38475c96808
BLAKE2b-256 495c68fa908745c38367a6009b1c34087027ae7131a84aca98ed850dac4c71be

See more details on using hashes here.

File details

Details for the file pgserver-0.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f6938b4c8a6d17ceee6743786db8ea66aa27844512299bf86e38d25d28952762
MD5 e0005f4fa5f07765304b7e7dec1cd0ec
BLAKE2b-256 d9a95ef9f85e100148b3eafa6e0bbfdd7f82ff0d64565f32d3cfe061d11ab86d

See more details on using hashes here.

File details

Details for the file pgserver-0.1.2-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.2-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 101dbec84e334f25a699c1a98bf9473a7d643830d2b0f96483d219b7b19992d0
MD5 9e603f0a1241e038341bed45cee8774f
BLAKE2b-256 e0118b7b9fd99e3041edf1b909429e135d39516d4afe43936476bb21acdf9d39

See more details on using hashes here.

File details

Details for the file pgserver-0.1.2-cp310-cp310-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.2-cp310-cp310-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 e84ef56b5a8a33b4b6e721cda2ec41e2c9ca0b6581b736642fcbd7a8cefda594
MD5 ebc75ab72fef66b21cd3b22647a4eb8a
BLAKE2b-256 370c651edc0a27fc6df382c26f8e7701b9b294ae25f15a6f7e1249a3d3fa81d3

See more details on using hashes here.

File details

Details for the file pgserver-0.1.2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pgserver-0.1.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 12.8 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pgserver-0.1.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 07f29d803f960798b2a5a43ac412bee2b40761099253bfcc83bd4ab1a9062a0e
MD5 f6c22ee478806f061ed3815e49222f05
BLAKE2b-256 98b7ea998a458e7e71cf504c91c2c996935cbde6d38486665dec8cf12e88500d

See more details on using hashes here.

File details

Details for the file pgserver-0.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5fb638925f79f550de3184424e3cdb65a7f33677be0dfc7fc3496c89438d5372
MD5 69e378adb71cf98b3f1eeebed17eeabc
BLAKE2b-256 c9b32f80898da788c7b94754e392eab67bfc50bbc386e7955f499f82fdff5367

See more details on using hashes here.

File details

Details for the file pgserver-0.1.2-cp39-cp39-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.2-cp39-cp39-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 1ee4b2cee5be9411535a9ad32634b4e3266bbed33b2e4037b68101a57fddbd84
MD5 46a03a42871dc00d35b3aa01a7298ea3
BLAKE2b-256 8a4449d1879d6f4fc9095f427c7ec59bcba31af93fc3a74d435d07ce5fe86a79

See more details on using hashes here.

File details

Details for the file pgserver-0.1.2-cp39-cp39-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.2-cp39-cp39-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 2e628728f9acf79d5310b7ce331841d012262fe39c9b33f69c3a0b617580d8a5
MD5 7c46f0a4cbb79ae0569d5b240159df14
BLAKE2b-256 0e289bd5e60c838e9352807a3d504506dc072d1243590723d9a8079bc59ec125

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page