Skip to main content

Self-contained postgres server for your python applications

Project description

Python Version Postrgres Version Linux Supported macOS Supported Windows Supported

CI 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 so as to 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.

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 some docker containers and google collab, 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)
  • 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.

Based on https://github.com/michelp/postgresql-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 startup and cleanup
  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.1-cp312-cp312-win_amd64.whl (12.8 MB view details)

Uploaded CPython 3.12 Windows x86-64

pgserver-0.1.1-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.1-cp312-cp312-macosx_14_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.12 macOS 14.0+ ARM64

pgserver-0.1.1-cp312-cp312-macosx_13_0_x86_64.whl (10.2 MB view details)

Uploaded CPython 3.12 macOS 13.0+ x86-64

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

Uploaded CPython 3.11 Windows x86-64

pgserver-0.1.1-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.1-cp311-cp311-macosx_14_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.11 macOS 14.0+ ARM64

pgserver-0.1.1-cp311-cp311-macosx_13_0_x86_64.whl (10.2 MB view details)

Uploaded CPython 3.11 macOS 13.0+ x86-64

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

Uploaded CPython 3.10 Windows x86-64

pgserver-0.1.1-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.1-cp310-cp310-macosx_14_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.10 macOS 14.0+ ARM64

pgserver-0.1.1-cp310-cp310-macosx_13_0_x86_64.whl (10.2 MB view details)

Uploaded CPython 3.10 macOS 13.0+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

pgserver-0.1.1-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.1-cp39-cp39-macosx_14_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.9 macOS 14.0+ ARM64

pgserver-0.1.1-cp39-cp39-macosx_13_0_x86_64.whl (10.2 MB view details)

Uploaded CPython 3.9 macOS 13.0+ x86-64

File details

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

File metadata

  • Download URL: pgserver-0.1.1-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.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ef31aa944ce4a6790f9a02320ee07505e82a7b3a66fb281d0355f4e62ea6aff1
MD5 a27f699b903f687409fe546f820664e9
BLAKE2b-256 62538c51f07340f6061a9db91542f91e56d644fe40514e575a4606e4928d7027

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f3ca5f3f1a1348a964f15f66b29d62bdd2c8e4cea9270af886cc77b89fe2f012
MD5 3e82449bd9b6dac58e4efbb912eb93da
BLAKE2b-256 d47fc2a2831b5b86b9222910fe90dba1efb9d93d6c10e0ffaefdc5b428affd78

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.1.1-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 9d52b4550a4f380f7af750f1b42df3b523f046f7b868048323c8836c951b0d3c
MD5 bccd8468ec1295b155ab7358fc19039a
BLAKE2b-256 505d4f5fd66913a95472b574310d678ff5ace0bd0bc8ea1ce93a15591aadb2f0

See more details on using hashes here.

File details

Details for the file pgserver-0.1.1-cp312-cp312-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.1-cp312-cp312-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 6dc91ed8f7023056b4e0c6fde4c659e8d7f5dcd6bf40e045407bf32b4ba8c00f
MD5 73b1278d5694a758998b5efa61a84922
BLAKE2b-256 fdd2168fe0c49430f25dec5c9ed9540e862fc03d4fcb6c5b90ea10d321216c35

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pgserver-0.1.1-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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 12725e013ca29d9c3b72661a7a44ed512b13b81ac11019ccce2200d3e4868881
MD5 8f7aa334a71ab6488c0666ec87b69900
BLAKE2b-256 d73bd4e0cb1cd76c1f04b008f6ab9fd2fc8f64edeccf7f3419c7b05b672b79f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 294bf63c48e665a983ed38b9ea3bb5a73a8e6aa0bf69239d5bddf5bf81db3df2
MD5 103c73539e7768575c56f889c289dfb8
BLAKE2b-256 f6795171a3374fa527c79721c0fddfd640a6caf2910ce62860cb297041ec692b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.1.1-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 76a5daf975b970c6485ea5b7d7faf4555e9cc369588d6cb8f053469c00746220
MD5 150228a9164cc4ddd3f44e7d8eec5f27
BLAKE2b-256 0043ec8cdd12ae5f6f1455843ebbe3498de11532a4faefd5f333e6eb61928fd2

See more details on using hashes here.

File details

Details for the file pgserver-0.1.1-cp311-cp311-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.1-cp311-cp311-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 07203d6ede843a1d8785a3d4958a2dfe3d6bcead54a9f0fe69bf66a4f6038402
MD5 177775e5ff657b4335cc33010fe31152
BLAKE2b-256 a29b7e6c2c652a0484be27b806479b4ebf46e0bf8d489c7d1cc5d15ba1e1d52f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pgserver-0.1.1-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.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4955659d69d302920d7b1d42b33bed689597de6689328d113ad4303bcbddf534
MD5 a25b715feb179c6e5e903e7f543cb053
BLAKE2b-256 621df5ac354aa0976175a7adb3e745ae64988a09d34dd5be828b7d73372b71b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 da14242eb490a29fa8c8b429e330562e81131e1b59cdfe5416da7ff0e92c2c85
MD5 5eb4940c92c6b855957f43b791c0b711
BLAKE2b-256 911cb9afb49b6215eab3d39f9eaf49b0cefdf3183b22dc845908baf91dfd3fe6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.1.1-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 75c9081e62d13757465aa66dd8795d681c1bb96fdb9c565dd7ef8cc303018d01
MD5 1f360efe0c8fed90efcc06ca82df5b04
BLAKE2b-256 c2e9e1cfef5d1b91e0d602f667c1ec15c9ba0dbe6fdb4e6f9e7324b661d07636

See more details on using hashes here.

File details

Details for the file pgserver-0.1.1-cp310-cp310-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.1-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 7eddce2e3eb1b9eb2642139cd1bbbdaa551673ae15e3674755a735c17c73f2ac
MD5 1aeaa544d487669728d63eb5691f2e5f
BLAKE2b-256 ef26902cd8be277eb02dea0fe22dd47cd56ec6e0facae92b8403186c4d902f70

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pgserver-0.1.1-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.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 36741cac916e386d97c86017136be42553d139908a33de6882c74a1d9dc4370e
MD5 75a6df2f1c147656269724cfe4c42bda
BLAKE2b-256 5973df2762ce4935d102797a06a6858f31c400755c367eba78d96c9eb9d7be50

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b9e303e0781da01f881aceb8539655a882707809a7643ff5e4c76c58dcc33be1
MD5 0c101ff504dfa23e15c3d4a2589ae45b
BLAKE2b-256 c87e8b5fdc0eb5238587e60cfb0d67de931808fce0b38826414b847a078ba619

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.1.1-cp39-cp39-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 13a1277e2ecc574ff73fe3d1fa463337020a94bde03a8a982b0d25fd45e64fb6
MD5 15074d53a84cb423c83dc5e53f49e7d7
BLAKE2b-256 c61419dad14a1a462f7d85f6d08a469bc4e5569da470de50217d451bcc204521

See more details on using hashes here.

File details

Details for the file pgserver-0.1.1-cp39-cp39-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.1-cp39-cp39-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 6a962121fccead2489a78329bda03f6f003854a7cbaf02bf5851f92b55cb2b84
MD5 4b83e2927a417edd0ef8090d7b448361
BLAKE2b-256 1bb9067786428b9059f676e627f128b166fc91add9ff0c338cce677b3ea9d625

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