pgmem for Python
A real PostgreSQL 18 that runs entirely in memory, packaged as a single binary and driven from Python. Prepare the schema once, then give every test its own fork of that state in about 20 ms.
import pgmem, psycopg
with pgmem.start(database="app") as pg:
with psycopg.connect(pg.template.dsn) as conn:
conn.execute(open("schema.sql").read())
snap = pg.template.snapshot()
with snap.fork() as fork: # private copy of the prepared database
psycopg.connect(fork.dsn) ...
pytest
The wheel registers a plugin. Override pgmem_snapshot to run migrations,
then use pgmem_dsn (or pgmem_fork) in tests:
# conftest.py
@pytest.fixture(scope="session")
def pgmem_snapshot(pgmem_server):
run_migrations(pgmem_server.dsn)
return pgmem_server.snapshot()
# test_orders.py
def test_orders(pgmem_dsn):
with psycopg.connect(pgmem_dsn) as conn: ...
pgmem_class_dsn shares one fork across a test class for read-only tests.
pgmem_options returns the keyword arguments passed to pgmem.start.
Any driver works (psycopg, asyncpg, pg8000, SQLAlchemy): the wrapper only hands out DSNs. The server is one PostgreSQL session per fork; pooled connections are serialized at transaction boundaries.
Binary
Platform wheels bundle the pgmem binary. PGMEM_BINARY overrides the
lookup for platforms without a wheel or for local builds
(go build ./cmd/pgmem).
Metadata
Release files for pgmem 1.18.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| pgmem-1.18.2-py3-none-win_arm64.whl | Python 3 | none | Windows ARM64 | Details for pgmem-1.18.2-py3-none-win_arm64.whl |
| pgmem-1.18.2-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for pgmem-1.18.2-py3-none-win_amd64.whl |
| pgmem-1.18.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_1_x86_64.whl | Python 3 | none | Linux musl 1.1+ x86-64, Linux glibc 2.17+ x86-64 | Details for pgmem-1.18.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_1_x86_64.whl |
| pgmem-1.18.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl | Python 3 | none | Linux musl 1.1+ ARM64, Linux glibc 2.17+ ARM64 | Details for pgmem-1.18.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl |
| pgmem-1.18.2-py3-none-macosx_13_0_arm64.whl | Python 3 | none | macOS 13.0+ ARM64 | Details for pgmem-1.18.2-py3-none-macosx_13_0_arm64.whl |
Total release size: 83.6 MB
Release files / pgmem-1.18.2-py3-none-win_arm64.whl
| Download URL | pgmem-1.18.2-py3-none-win_arm64.whl |
|---|---|
| Size | 16.2 MB |
| Tags | Python 3 Windows ARM64 |
|
SHA-256 checksum How to use checksums |
79f59788b8da701c563c769f5487eea5a9fd518c71ce82c6b9577370d740e7c6
|
|
BLAKE2b-256 checksum How to use checksums |
47901709821532132d4540ef2851f4b62f10213b3d5f4a2d60b05dd11e36d795
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency logRelease files / pgmem-1.18.2-py3-none-win_amd64.whl
| Download URL | pgmem-1.18.2-py3-none-win_amd64.whl |
|---|---|
| Size | 17.5 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e51ae6a92f1d62979379502d4bf1e7746ebcb4eb238016a7df9071428e88b62a
|
|
BLAKE2b-256 checksum How to use checksums |
d4562f854711bbdc9753502e2f9aca7e1bd462f067de4b2024a3d6bd7a5a8621
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency logRelease files / pgmem-1.18.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_1_x86_64.whl
| Download URL | pgmem-1.18.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_1_x86_64.whl |
|---|---|
| Size | 17.4 MB |
| Tags | Linux glibc 2.17+ x86-64 Linux musl 1.1+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
b6ebcc75e8bf3e06720b1f3e22f17ff20bae7d693d4bc21101d6b0d2807db80a
|
|
BLAKE2b-256 checksum How to use checksums |
5980cf22130088f412d3c1c6c0c8292d350c36cc99f4867aa9507262df70ae24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency logRelease files / pgmem-1.18.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl
| Download URL | pgmem-1.18.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl |
|---|---|
| Size | 16.1 MB |
| Tags | Linux glibc 2.17+ ARM64 Linux musl 1.1+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
0c116efe9dc37046ad88e5169c8fba84a6a14bf2ab003ca539b52ecd0e15209b
|
|
BLAKE2b-256 checksum How to use checksums |
ef87abb5d02807ac98024dda14959432d0c0bc86a522e1ed8e874288d640695b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency logRelease files / pgmem-1.18.2-py3-none-macosx_13_0_arm64.whl
| Download URL | pgmem-1.18.2-py3-none-macosx_13_0_arm64.whl |
|---|---|
| Size | 16.5 MB |
| Tags | Python 3 macOS 13.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
71de9fcd574ffa1339fbd31de023fe2bcb5cc770398fc3718fec68cb1050e9e6
|
|
BLAKE2b-256 checksum How to use checksums |
b48b4eb0747be66f7c133c438c51a2ccb5f246734f3b6bbc379f3bd8d7e3694c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency logSecurity for pgmem 1.18.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 5 files in this release have been uploaded with provenance metadata.
Attestation for pgmem-1.18.2-py3-none-win_arm64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.