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

Uploaded CPython 3.12 Windows x86-64

pgserver-0.1.0-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.0-cp312-cp312-macosx_13_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.12 macOS 13.0+ ARM64

pgserver-0.1.0-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.0-cp311-cp311-win_amd64.whl (12.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

pgserver-0.1.0-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.0-cp311-cp311-macosx_13_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.11 macOS 13.0+ ARM64

pgserver-0.1.0-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.0-cp310-cp310-win_amd64.whl (12.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

pgserver-0.1.0-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.0-cp310-cp310-macosx_13_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.10 macOS 13.0+ ARM64

pgserver-0.1.0-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.0-cp39-cp39-win_amd64.whl (12.8 MB view details)

Uploaded CPython 3.9 Windows x86-64

pgserver-0.1.0-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.0-cp39-cp39-macosx_13_0_arm64.whl (9.8 MB view details)

Uploaded CPython 3.9 macOS 13.0+ ARM64

pgserver-0.1.0-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.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pgserver-0.1.0-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.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0c615573c11aafe2f2a8d20919dbead81b85c1416bd20286f10e18f8f2b4f059
MD5 1559d07dc64b8551d40f45a60708255a
BLAKE2b-256 d051683e62aaec95926232e0f51bcff1dbd8820a841e7ec76e5b276d2df23c19

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5b5eaf1a8a8d93288a76206209dc4709256798ce36ba3caf9fe04d34a8d058c0
MD5 dadd866c2bf3c5e47b510aac49a91b26
BLAKE2b-256 3c14e1ad86548a40478d9073dd82812cf808eb1420326fbe8480ea1d9b9e5ced

See more details on using hashes here.

File details

Details for the file pgserver-0.1.0-cp312-cp312-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.0-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 2cb472be1e399ed68d0b902589b179a17404285cf434352dfc90587af3164942
MD5 ec9d474fbfcecd41a8a70c9378302d78
BLAKE2b-256 0dc20b3e629160413084f7ec44df39c2e480322fc95c663bd584517c191ec56b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.1.0-cp312-cp312-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 ff2488c0f2e1f7c8cda4e2198cde16fe54c05daa6977fecf2218de082bc181c5
MD5 bd43dfd62ccea0413259fac3df153890
BLAKE2b-256 7126caf2950e52d3f9938d511b1e8bb1807e7446d6e9ffd29909be661f3f8cf0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pgserver-0.1.0-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.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 80ad565532a5138220b28c37557e946a3c1391019de88b3002852195fd70342a
MD5 33121146d53d28fa17274a24444fddf8
BLAKE2b-256 977178049392a25c37d9626029d45c2bd8ce74a506a73fd7f268ea1e1988377c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7f3239339c0e895b8eff21575980dd3f38c6d456392fd5c2699eeeb1db9fc00a
MD5 78df7097b584a05347335526716d45a8
BLAKE2b-256 622be07e94472c76064afe63af077f2e2388faaad30d214621af02e0d07b8e6d

See more details on using hashes here.

File details

Details for the file pgserver-0.1.0-cp311-cp311-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.0-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 9dd412ea403cc2f7d165d0adc70cae185e16b14b57ee055038eb652c02b5389f
MD5 85cc16b16fb83f05c6172af04a341912
BLAKE2b-256 0111e9219bab55e52ec3d6eb542183199e0d57cd9ded4cc0d37fb88056d8b30e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.1.0-cp311-cp311-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 9840ad0b55eaa506c0bc76a8ee5c3221dacc5dcb5bc6db3586f06a772345390d
MD5 e1fdea0f45325756a891761fd24c1986
BLAKE2b-256 05ba703bc96514c3ecc4df5f430412671cdf68a87acfe98abee9c3509fd74096

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pgserver-0.1.0-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.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4c774c32652e1b9d7eb941a5bc4ddc49564d315e468d53da260ca56da5985ffa
MD5 d5dc91db8c207514eaf91c00889dd2fd
BLAKE2b-256 db44360f4f6a543ef1f336b80ca97e6bf8befb72803a288ec0bd5562823f867a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 da069f95575f0951652bf64a229e606dc8f82c87e5ced156e245c6052e967839
MD5 9c6a56d11e2037bcc4537ec0c42566a8
BLAKE2b-256 600fb6ca236678e4f9886524544f0cba5ab49da41564958b652487a7fe0efd82

See more details on using hashes here.

File details

Details for the file pgserver-0.1.0-cp310-cp310-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.0-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 92dc3f15fa925f226e529b4da80165713e79a99a21132a0523f9bf895deb54d8
MD5 ae017829506942d88a5dde77de1f9725
BLAKE2b-256 a3ede8b826ee4a7e624106037dd4ace86d3eae2f20d602ecbcacd271e846cee7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.1.0-cp310-cp310-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 8f2c9484b5694931948467f028811f481026cc9a4cd9b64fc5d5640ea0d91141
MD5 23d604fcfec467c1554d8fe129b8cd1f
BLAKE2b-256 c2dd5f80b88f4b0075b21d6f6d454138d6ab952a75e95f2424f5ac3d642f437c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pgserver-0.1.0-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.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b1a270731ac7f18fd577887c6ea3601a6fff08f0a1c66b2e37e033b2b2f676cd
MD5 abd593ea9835347a69296001ac9aeab2
BLAKE2b-256 465dd0cdd7d01b32be214047e96d54863bb44433a9dd5f923a79b881c597907f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fcdfee60114c07969a8e1c35c29744e25c0d7ede67554257d33a323406b66739
MD5 41f8e77dd16cfee01c7b83e9d6f78309
BLAKE2b-256 1c6c3de6a77b0f7ca188d8bd63e7d5f3f1cdb5cc198f18332e998c5c37b8c752

See more details on using hashes here.

File details

Details for the file pgserver-0.1.0-cp39-cp39-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver-0.1.0-cp39-cp39-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 75217f2fca43009fef390f71379ead9c1b5952234e6f088f9464769e3beedc4b
MD5 fe2cc1543794770c614f69c1bd1f004c
BLAKE2b-256 f6d732b38da72d22f4a7c374d26217653ead62cb4e35746c7469c090948bde99

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.1.0-cp39-cp39-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 efa45a5f3363189b4dc7979c59883872f101352bb477072f2d5a22d100a35d20
MD5 565ce53c835e4440b09aba6a0a800720
BLAKE2b-256 9efed42e61e14560211154db1ccf796c9212fa134c11cd8a27973d67bdf7c779

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