Skip to main content

Postgres server with pgvector extension

Project description

pgserver

Lets you create and use a postrgres server with your python app as easily as you would sqlite.

Based on https://github.com/michelp/postgresql-wheel, but distribute multi-platform wheels (including macos, apple silicon) as well as a convenience class for managing server sharing across processes and server cleanup when sharers are done so you dont have multiple ghost postgres processes left.

Can also be used for self-contained testing against postgres.

A fully self-contained, pip installable, Python wheel for Linux and MacOS (incl. apple silicon) containing a complete, self-contained Postgres server one can embed in a python application.

  • Pip installable.
  • Does not require root or sudo.
  • Databases can be initialized in any directory
  • Wrappers to all binaries initdb and pg_ctl for low level control.
  • Tested on ubuntu and mac (apple silicon + x86)
  • Convenience get_server making it easy to think of your postgres instance as a shared data_dir. manages server process start and stop, accounting for access from multiple independent processes (via refcounting).
  • Other: includes pgvector extension. Includes header files in case you wish to locally build some other extension against it.
# Example 1: 
# postgres backed application
import pgserver

pgdata = f'{MY_APP_DIR}/pgdata'
db = pgserver.get_server(pgdata)
# server ready for connection.
db_uri = db.get_uri()
# use uri with sqlalchemy / 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.
sys.exit()



# 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.

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.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.9 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

pgserver-0.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.9 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pgserver-0.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.9 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pgserver-0.0.1-cp310-cp310-macosx_11_0_arm64.whl (13.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pgserver-0.0.1-cp310-cp310-macosx_10_9_x86_64.whl (14.0 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pgserver-0.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.9 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pgserver-0.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.9 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

File details

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

File metadata

File hashes

Hashes for pgserver-0.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 475328f4091f6c7e810094be1e81c5fd67dc707d08572bf9b58d53eedfb7fe82
MD5 1a8ed74d8045e05aebf6bbb5f69a9d71
BLAKE2b-256 c79de3c3500045f27ed7994e0e38f1260ea2cb5b75cf2a1668d6a8e4c416b7e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 15b11fbe05fd6b25d581eb6aedb067499527944c28010461050f284b85b76282
MD5 32f1c014f0eb7791cfad73b124baecd0
BLAKE2b-256 33054b0045df2bbeb8f08b2c12356c75dce7bc8077f221f041478d7d1a4441e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 540c33407cfa0659b1489d7a6f792abf392ef45d7897aa009f49bf838995dbc3
MD5 aaa15e57134dde45d85b0a60b27c3465
BLAKE2b-256 1308912ded3e91cf8c2af6ebb65ef79c35c4579f786c408c439c824db66f7401

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.0.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c88a5c01730fd63fd1319079f9d9fabaa160816558983210ba1f11d618001f6d
MD5 27a0f7dcac3cfe11e8fcc5b1cea44412
BLAKE2b-256 3c6fdc9aca650f6037b0fb9a6475e77401e79a6bde671bbe51e4875b678a7c5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.0.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b37c73963d75237edaf2558416f7f0e5b0c121ba18b04f96676082522e11dfa9
MD5 d9c9e89bc43dadc33971965f09c269c5
BLAKE2b-256 ff263a75671751556e082767e6c455e4cd224d7d7843b9ca4e15800bf7aff31d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pgserver-0.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b5952082b839acc8ad7bafd5a992336e480eb7d52e1af71f053d092c872a54d0
MD5 c4e6f894793eab5304cbab374c086154
BLAKE2b-256 02028d511e604073789c7cd7a3222f51e10c967943cf70cf673fe6a7bf8292b2

See more details on using hashes here.

File details

Details for the file pgserver-0.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pgserver-0.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8ff638b37459962b700a8aba683e5e0c19f83bb8311d56e31cf548b85e1f17ae
MD5 832d7f9bbabbd280ae2f5dcacf5bfa6a
BLAKE2b-256 11756e6417ecb40839ce7abc75a2222e231ab9056f0bf3e66279a26f2a33539c

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