Self-contained postgres server for your python applications
Project description
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 orsudo
. - 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 understandinitdb
,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:
- binary wheels for multiple platforms (ubuntu x86, MacOS apple silicon, MacOS x86, Windows)
- postgres server management: cross platform startup and cleanup
- includes
pgvector
extension but excludespostGIS
(need to build cross platform, pull requests taken)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file pgserver-0.0.9-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: pgserver-0.0.9-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 16.3 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d2f93ce3f9d8c3b07e6744b4e310ff0ad91b61c2f15b81355156abdcfb6bc21 |
|
MD5 | 6dcea4e36f8c2749b963cebad69fc3b5 |
|
BLAKE2b-256 | 30053e44d49ccd6613ff1eae459cd64c4826c3ba89b1258bcc307fba9e7c5386 |
File details
Details for the file pgserver-0.0.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pgserver-0.0.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 15.0 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22fd3b19b7e190dd7ad14398c249cec6aefd2cc892d0bfeed7aa2500c085fc99 |
|
MD5 | dcef9dba7350f14fdb95c2281c09de55 |
|
BLAKE2b-256 | 6d4a08ff2186fce076826ad5cee09c97c546dc6cc3b240f9db044da8307bdcd6 |
File details
Details for the file pgserver-0.0.9-cp311-cp311-macosx_13_0_arm64.whl
.
File metadata
- Download URL: pgserver-0.0.9-cp311-cp311-macosx_13_0_arm64.whl
- Upload date:
- Size: 13.1 MB
- Tags: CPython 3.11, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 109f70373ad9c5725f8d76723e4aa1b4c13b477455ec96758cd8986470a48d03 |
|
MD5 | d7b0c95fee4c3f4eda5e3e07b333fe20 |
|
BLAKE2b-256 | 6cffa84c703aaa2fda0530c71780c75a438c8e7faf5ba3a0aa2157ba1f705d08 |
File details
Details for the file pgserver-0.0.9-cp311-cp311-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: pgserver-0.0.9-cp311-cp311-macosx_12_0_x86_64.whl
- Upload date:
- Size: 14.0 MB
- Tags: CPython 3.11, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28f7a8b0876ad01f6de81c49a2513d440e874d326d80c170ded1b658bdcc1a4b |
|
MD5 | 52031acfeb0a2e0b0f44262cb5798b2b |
|
BLAKE2b-256 | c0f1a7db5c2d258e2fdaffd6f8b0527566eb3794d8b0f49253b74a0b92ea35e8 |
File details
Details for the file pgserver-0.0.9-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: pgserver-0.0.9-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 16.3 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f293bc3f92bb87fa6c6dcfab9b7dbd0d9c7ed1c470888788e01ae400d7b4744 |
|
MD5 | 576473be27b82f897975d69e66a56228 |
|
BLAKE2b-256 | 44cce3dfc8e81c49f846c9a14bbff605adec5fd184dfb398af42a81e928fb207 |
File details
Details for the file pgserver-0.0.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pgserver-0.0.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 15.0 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 239e7d981ce469bcc35acfbb306ff5a4cfb9ca61670a56fb4317ec41b66c119f |
|
MD5 | 498f528f13aac1ba7f670391856cbcad |
|
BLAKE2b-256 | 955cd43e613db78d6d24c876f39f77cb6e7d4963e281dd2a9da501bfa9c78a24 |
File details
Details for the file pgserver-0.0.9-cp310-cp310-macosx_13_0_arm64.whl
.
File metadata
- Download URL: pgserver-0.0.9-cp310-cp310-macosx_13_0_arm64.whl
- Upload date:
- Size: 13.1 MB
- Tags: CPython 3.10, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d8b7d1eac1eaea0ea7a03a5b52f354b90e72340a28417bfc69cf633d12704c0 |
|
MD5 | dcc17ae66820b4141b70eaaf8b3be633 |
|
BLAKE2b-256 | 1cc1d7c674d222cc4e0330690f0dafb4bee0c515e7d440c5280611ed17dba607 |
File details
Details for the file pgserver-0.0.9-cp310-cp310-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: pgserver-0.0.9-cp310-cp310-macosx_12_0_x86_64.whl
- Upload date:
- Size: 14.0 MB
- Tags: CPython 3.10, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50ba70814884a2518d2d17ec1eeb7016b6d62301b728f46f66417c5a8ed03e6a |
|
MD5 | d3ca8dcbc25c2e969fbb29f504b3e31b |
|
BLAKE2b-256 | 91e8986ddc1d6c0da6c23bacb83f1e99023f3d4adf955a52478819792fea869f |
File details
Details for the file pgserver-0.0.9-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: pgserver-0.0.9-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 16.3 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b26e1ea61860926d8aa0b1dd03f8f7d03a6327fd9958e6263996ec9e04a28f43 |
|
MD5 | 0720d5c829c0fae2e7a4cfb9444e5cb4 |
|
BLAKE2b-256 | 5ccca90d491dca23f077edaafbcc2fb8217d0f17a2e8204c7eefb15e7e9a5c09 |
File details
Details for the file pgserver-0.0.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pgserver-0.0.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 15.0 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | af2c24e2507d4fa2bbaa4a629f21722823200bbc465284368029e347e7a729e1 |
|
MD5 | c90fc9b84c4c839e0fcf1ae10af8869f |
|
BLAKE2b-256 | c00e6d1ada5517ec208dcdb441da11acc7dc72cb32f15ec58adbb5a85c60fbdb |
File details
Details for the file pgserver-0.0.9-cp39-cp39-macosx_13_0_arm64.whl
.
File metadata
- Download URL: pgserver-0.0.9-cp39-cp39-macosx_13_0_arm64.whl
- Upload date:
- Size: 13.1 MB
- Tags: CPython 3.9, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1e432cd09939f4fbb88393cf5cb1484072ae7b872b868291d48271637116ca2 |
|
MD5 | 336e77a072042ca380f66b34455da063 |
|
BLAKE2b-256 | 3e8fb6017e16dfc3c1f18b709f15f98c69283cabb7dc2823686586a820527bb6 |
File details
Details for the file pgserver-0.0.9-cp39-cp39-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: pgserver-0.0.9-cp39-cp39-macosx_12_0_x86_64.whl
- Upload date:
- Size: 14.0 MB
- Tags: CPython 3.9, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8300c3234ae3489e3e84ce70fc35acf00c652a0661f4af293964873ac2bc624d |
|
MD5 | aed8fcfa91ba963cba973eb3dc3b585b |
|
BLAKE2b-256 | d4985a7cb9da62492c4926eaad246ab00ed94e01befbf5c47fd62c8e882182cf |