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, 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

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.4-cp312-cp312-win_amd64.whl (12.8 MB view details)

Uploaded CPython 3.12 Windows x86-64

pgserver-0.1.4-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.4-cp312-cp312-macosx_11_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pgserver-0.1.4-cp312-cp312-macosx_10_9_x86_64.whl (10.4 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

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

Uploaded CPython 3.11 Windows x86-64

pgserver-0.1.4-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.4-cp311-cp311-macosx_11_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pgserver-0.1.4-cp311-cp311-macosx_10_9_x86_64.whl (10.4 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

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

Uploaded CPython 3.10 Windows x86-64

pgserver-0.1.4-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.4-cp310-cp310-macosx_11_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pgserver-0.1.4-cp310-cp310-macosx_10_9_x86_64.whl (10.4 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

pgserver-0.1.4-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.4-cp39-cp39-macosx_11_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pgserver-0.1.4-cp39-cp39-macosx_10_9_x86_64.whl (10.4 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: pgserver-0.1.4-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.4

File hashes

Hashes for pgserver-0.1.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 406e9355334e40754160a33d93f18a848720a38cd0b68da50be2ea272c89ed2d
MD5 7071c9eba2bbad82b71b154727923359
BLAKE2b-256 8580f6304274c1740c283bc7317ababceb3c23c8275ce4995f7379e17b49bc6d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1a5d07c61d51f2abfef4ef61e2ef5cd014b994f7e09de8d3c140d2cf370e84a8
MD5 1472ec5fd8ba266ca31340f9666f66c9
BLAKE2b-256 cff1c9d717f66d2e4a27801577e1ae233c25aa88db875c586ac3ebe7d73b6b75

See more details on using hashes here.

File details

Details for the file pgserver-0.1.4-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 780fa89f26a960cca0215caf471e70848dd8597bd8ceaeba7faf42170278980c
MD5 3c5c846d3e1c4e56ff52e72124385104
BLAKE2b-256 235794b5f05a23d0fa683c01bfc2d785224057a9eaf0eb00cbfd6da19547012f

See more details on using hashes here.

File details

Details for the file pgserver-0.1.4-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.4-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 dc34f88561b18bc08edd98a84528f99a3720fe713a4e39a4a6210a4d009fe465
MD5 2100a852dafd06ce2002d0f3421ea46d
BLAKE2b-256 92e39f8eea535ab4f2906a9924eccc5fb3a7bcff3e02222fbe338d9c24639750

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pgserver-0.1.4-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.4

File hashes

Hashes for pgserver-0.1.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 fb755fe493c479fcad1a1e9923fcc1f09d15cd2fb168e563c003b29f14a80545
MD5 cc2a26d062ad62e9ad16578fa57f22c7
BLAKE2b-256 ffdf284875cff70317a628c87c1555a1c9342316baaadce23741be38a85b39eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d595789b47624a3d963aa9aa6359da9be31beb7e61f1a45541953242068b8813
MD5 c2debf81f350b8c7c0f1bf9a082f4d96
BLAKE2b-256 913f3d628b09d379c368a589ca2f417e318bed7615e5df175c17d570e623b2f3

See more details on using hashes here.

File details

Details for the file pgserver-0.1.4-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0cc5a64f40749c0e9752cd63784e63dfcf1f3e5ecd2279b6b59f7c64fb520fb4
MD5 48492afe71870b5769ea2d32d09d0b8e
BLAKE2b-256 501d527e42e5cf66cfa224fbec2d031aba9fc17514bab5de3f14b1d7e9c5c3e8

See more details on using hashes here.

File details

Details for the file pgserver-0.1.4-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.4-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 854fa9394d495b3a332c954b63d4356b56d29220530e6d2aae146821bf87e05a
MD5 c58d65fdf0e6c5ecfd4afea96fad24b4
BLAKE2b-256 35f1475d079b823c26deaf8a2cc3d7358a8f5cfa481bd5a8f878666b08450ed9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pgserver-0.1.4-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.4

File hashes

Hashes for pgserver-0.1.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7be9cd117184aea1eaf9118b4c052c318dc13bb93d3cd9336329ad5b8d1729b1
MD5 21df5ab52247e4d45ece3e550c1eb229
BLAKE2b-256 95540bc5eb3e62f3ccb394dc92825f7162fe555d4b8f9a8198c424f1afbf7422

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cb0e711e257dbfa2681d78c0bd789dd81753bc28c207889dcefa8f80706f3fed
MD5 75b670af3120ad85870c82cca2da5ba5
BLAKE2b-256 44d9fc1a093be71cb141b2f01bfa921f3853e45e1c4567b240108cd9d90a3f28

See more details on using hashes here.

File details

Details for the file pgserver-0.1.4-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2aa7897ab2894a460cfc430959f9640e27659fc8b8802f82b3f58632ae181218
MD5 5bd6f11f553da3810e5772623f14b347
BLAKE2b-256 d42a180c5d445a0d05596120b51be47d98420b8f1529bb4141421c4b6fe43b64

See more details on using hashes here.

File details

Details for the file pgserver-0.1.4-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.4-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 79041d91d4d28e3a6a75dd472ee395e2da036ffd7f77cd826052697532291646
MD5 dcd633f5ac2353f7ca5163fd56dde62d
BLAKE2b-256 89ae476532eda309ecee1c6ebe7f99665b35f7082c841f9d9d144d42294d40a0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pgserver-0.1.4-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.4

File hashes

Hashes for pgserver-0.1.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 a515926064743131f76c9cd2268b5d69f160371b89e7d9cc377102aa4087ae2d
MD5 7ebc90ec02dd3fc0f7aeb821fce88336
BLAKE2b-256 26190b977b75c69f27d41703bc64a38dac290285a06cec6e73d347d271cc6246

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d9b7cf6f1611506654a7e948d99f8fb20895321474187401587d3fee1067e298
MD5 7caaec977bac4de9466277099522c991
BLAKE2b-256 3b13becb1d566bf3edfc5c96c2bc7de9cf65205b229ad6453ec1c8f4b1f901f8

See more details on using hashes here.

File details

Details for the file pgserver-0.1.4-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.4-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2b902adff9dbfa65eac0405b914bd16a9d0b04e7710a02e4a172997b436135f4
MD5 b10a6921940d37b0a1c3fd2e014af33d
BLAKE2b-256 6ee32fd2429e84ecf974d7fb678abb3c2b3faddabc39ebb0d178a1dafcad76ef

See more details on using hashes here.

File details

Details for the file pgserver-0.1.4-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.4-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 206e58be4f01db433df882c6d781ea1058d604f9c23acfc6ce3401ba717bc6ad
MD5 549e816aafa918c383cf600fcd6eb667
BLAKE2b-256 1fb7dc48e23459e75fcc0795c62a13fdcf33c41adc3640d8d5cc8422a8dd8f0e

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 Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page