Self-contained postgres server for your python applications
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
andpg_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
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.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pgserver-0.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 14.9 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 652b922daf1e9fbf74d2d69341cbe345ecd4a0402e100f222ff1d56c3a033f97 |
|
MD5 | 95b1f78be0475acfc9c91b7b7ec1abd3 |
|
BLAKE2b-256 | 12bbd7229742f815acd18d790da7575b97aa3079def7421ecbb0de3633938592 |
File details
Details for the file pgserver-0.0.2-cp312-cp312-macosx_11_0_arm64.whl
.
File metadata
- Download URL: pgserver-0.0.2-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 13.2 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0296222bdc296579a2844bc101e90d805794ba44797b727983c7a26e737d5260 |
|
MD5 | fad048a30cf38f3eb94d19c1fb5e1f35 |
|
BLAKE2b-256 | 783498ef39d2c30bbc00d6a53935d153ad21ec196017005f9d3877ac457c3367 |
File details
Details for the file pgserver-0.0.2-cp312-cp312-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pgserver-0.0.2-cp312-cp312-macosx_10_9_x86_64.whl
- Upload date:
- Size: 14.0 MB
- Tags: CPython 3.12, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0458786770208d949c81003f5bbd5b3956c98bef6ea55b1e429d76b3f178c188 |
|
MD5 | 196522efca96ec94747ec1422580a368 |
|
BLAKE2b-256 | 05ad52c76e68325bf275b1137a416bb2118423917c1152a7863589d29807bf18 |
File details
Details for the file pgserver-0.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pgserver-0.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 14.9 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32cb84d2b3f5795a307b763f7c756ce25fa0a8b5c27e05b043d55e0add93ce7a |
|
MD5 | de2b6a8668fdd0b18b7d9952f6814ac3 |
|
BLAKE2b-256 | b72d9a9e2963ef0b6640a2814cd189621bea0f07e7550559e09c74a2e32e1396 |
File details
Details for the file pgserver-0.0.2-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: pgserver-0.0.2-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 13.2 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae0167bff413402b684edb7ad971d4c9eb71f11913f686021f32173707b4eba0 |
|
MD5 | 835f8c341b65e2b99e20271e2c1e6a88 |
|
BLAKE2b-256 | fc9d865f9c3cd5323ff1bebdb33a3e3117c4d29a59dc9badf7d98529a225f834 |
File details
Details for the file pgserver-0.0.2-cp311-cp311-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pgserver-0.0.2-cp311-cp311-macosx_10_9_x86_64.whl
- Upload date:
- Size: 14.0 MB
- Tags: CPython 3.11, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0879fc1d65279b23ccf1a5116668c574c3e2314f4817681c1e1c556c172ecc3 |
|
MD5 | 1486ee7feced3d56e499c4af13388535 |
|
BLAKE2b-256 | c0785b124ea5f1c9204a83c427e2b56c0d606257d191f239bbba5fd67d4a1fd9 |
File details
Details for the file pgserver-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pgserver-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 14.9 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 414f7b1a8d95a0d2e04df2ca22e4aa78b078cf64f209d8d9f8627000860255fa |
|
MD5 | 548888724b35fd5df78ca060b3057949 |
|
BLAKE2b-256 | 1716de30b989e1a95af00bee2058ff1c7233d90d0cb023c4075ca1d0a54d11bb |
File details
Details for the file pgserver-0.0.2-cp310-cp310-macosx_11_0_arm64.whl
.
File metadata
- Download URL: pgserver-0.0.2-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 13.2 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | adc3adef40428ef317c385cdda00677fd4d302f1a5d0c9a5684d6702348c3322 |
|
MD5 | 6bc796938eba9f19867b82b8de606080 |
|
BLAKE2b-256 | 3c69294ee3cafb8f81cefa6a7af388347f4e6eda0ef352477f33879ad9c16423 |
File details
Details for the file pgserver-0.0.2-cp310-cp310-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pgserver-0.0.2-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 14.0 MB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb8e7b66f46c2ee72c0c5d51d292a630e88322441f6112e6b113697e9c78263e |
|
MD5 | 982580c54a90d4099412b80319506e4d |
|
BLAKE2b-256 | af50b23ae79f2fd283393acea2d21963907da187916af51482154059091aedd5 |
File details
Details for the file pgserver-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pgserver-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 14.9 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f8ab40096be26e3824c06460038a7cd69c9884337dac720bd98fcf040445a29 |
|
MD5 | 89ab26e989ba718f7de6240915dcf547 |
|
BLAKE2b-256 | f36528bb0122973e2551f313c5101ffdb9abc4b1cb219f4c704d19e3a207aa6c |
File details
Details for the file pgserver-0.0.2-cp39-cp39-macosx_11_0_arm64.whl
.
File metadata
- Download URL: pgserver-0.0.2-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 13.2 MB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0aab80ebeee04541c7c45d12cfe76c67dc77cd3b384ea7e7cefcd703a71eb14 |
|
MD5 | ab7f020c8b305865d7d360d8c0d47012 |
|
BLAKE2b-256 | 2594ff7dec9740cc379c952af576345ed7f51c24dcc5e79260ec264c32d2282d |
File details
Details for the file pgserver-0.0.2-cp39-cp39-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pgserver-0.0.2-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 14.0 MB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4de9c2d8b8a8a0d427406faea1301b150fc18b66ee64d17cd3c1f3624abb7d3 |
|
MD5 | 32ebe917d69f7b5977731c1ab645415b |
|
BLAKE2b-256 | f375d8ab7b8a7c4807210c8212b1d0eebd9ced79a8976e9d1f6146bbf581b90f |
File details
Details for the file pgserver-0.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pgserver-0.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 14.9 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06d2996f0f73cb6aca5167f897c8a0dc5b8d487f17cb2589c385faa76c7e00fb |
|
MD5 | b90837fcbb1ff87c713a8514e42eb20b |
|
BLAKE2b-256 | 9e4926a4b545dfa9a28fe19772cd9e72eeb9c0ab90c9172d18f013e305c166fe |
File details
Details for the file pgserver-0.0.2-cp38-cp38-macosx_11_0_arm64.whl
.
File metadata
- Download URL: pgserver-0.0.2-cp38-cp38-macosx_11_0_arm64.whl
- Upload date:
- Size: 13.2 MB
- Tags: CPython 3.8, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b5a7029dc15d208166f3b1acd506e5e6431dfa513032f06a208f99cd5d909fa |
|
MD5 | 60f8f6fd3222c88759336153de1670be |
|
BLAKE2b-256 | 74fc1a6ee1fe7f6019b047212c66e976b7a1b2c8dfae3fd05b1935cc9d38b644 |
File details
Details for the file pgserver-0.0.2-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pgserver-0.0.2-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 14.0 MB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b385b714da023542b222963b16267f21a6c2e1f999526edf2d33ecf2686752e |
|
MD5 | 2369f79e8ac89f2205c8c1d6b2b043fb |
|
BLAKE2b-256 | dc9d9cf22dde6db2d4dc47291bcab3f67e1c8e3803c58d7e436dc21835e2cc5a |