Skip to main content

Self-contained Postgres (with pg_trgm + pgvector) for Python applications

Project description

pgserver-search

Disclaimer — this was vibe-coded (in Simon Willison's sense: I kept prompting an LLM until it worked, without reviewing the generated code line-by-line). Intended use: throwaway Postgres instances in Jupyter notebooks and quick test scripts — a richer alternative to SQLite for when you need real Postgres features like pg_trgm trigram similarity or pgvector vector search.

Not intended for production-parity testing. Embedded Postgres differs from your hosted/RDS Postgres in build flags, OS libraries (glibc / ICU collation), default postgresql.conf, and available extensions. If you need audited infrastructure or prod-equivalent integration tests, use testcontainers or a staging Postgres instead — or at minimum, read the diff against orm011/pgserver and build from source (see below).

A self-contained Postgres server for Python applications, with the pg_trgm trigram-matching extension and pgvector bundled in.

What this is

This is a fork of orm011/pgserver that adds contrib/pg_trgm to the bundled Postgres build. All credit for the core design and implementation goes to Oscar Moll — this fork only changes the build recipe and packaging.

The upstream pgserver bundles Postgres + pgvector. This fork additionally builds and installs pg_trgm into the packaged Postgres layout, so you can CREATE EXTENSION pg_trgm without any extra steps.

Why

pg_trgm ships in Postgres' contrib/ tree but is not installed by the default make install that upstream pgserver runs. If you want trigram similarity / fuzzy string matching alongside vector search in an embedded Postgres, you previously had to build it yourself. This fork does that for you.

Install

From a GitHub Release wheel (recommended)

Pre-built wheels for Linux, macOS (x86_64 + arm64), and Windows are attached to each tagged release:

pip install https://github.com/stantonius/pgserver-search/releases/download/v0.1.4/pgserver_search-0.1.4-<tag>.whl

Pick the wheel matching your platform/Python version from the releases page.

From source (security-conscious install)

If you'd rather inspect the code and build Postgres yourself instead of trusting a binary wheel, do this:

# 1. Clone and inspect
git clone https://github.com/stantonius/pgserver-search.git
cd pgserver-search

# 2. Audit what will run during the build
less pgbuild/Makefile   # downloads postgres-18.3.tar.gz from ftp.postgresql.org
less setup.py           # hooks `make` into setuptools' build_py
less pyproject.toml

# 3. Install system build deps (Debian/Ubuntu)
sudo apt-get install -y build-essential curl tar zlib1g-dev

# macOS: Xcode command line tools are enough
# xcode-select --install

# 4. Build the Postgres binaries into src/pgserver/pginstall/
make build

# 5. Build a wheel from those binaries and install it
make install-wheel

The make install-wheel target runs make build (downloads Postgres 18.3 source, configures, compiles, installs pg_trgm + pgvector into the package layout) and then pip install dist/*.whl. Takes ~5–10 minutes the first time; everything is cached after that.

Usage

The Python import name stays pgserver (so existing code keeps working) — only the distribution name is pgserver-search.

import pgserver, tempfile

with tempfile.TemporaryDirectory() as d:
    pg = pgserver.get_server(d, cleanup_mode='delete')
    pg.psql("CREATE EXTENSION pg_trgm;")
    pg.psql("CREATE EXTENSION vector;")
    print(pg.psql("SELECT similarity('hello', 'helo');"))
    pg.cleanup()

License

Same as upstream pgserver — PostgreSQL license (MIT-family). See LICENSE.

Differences from upstream

  • pgbuild/Makefile — adds a pg_trgm target that builds and installs contrib/pg_trgm into src/pgserver/pginstall/.
  • setup.py — hooks make build into setuptools so source installs (pip install git+https://...) produce a working wheel automatically.
  • pyproject.toml — package renamed to pgserver-search; adds include-package-data and a pginstall/** glob so the built binaries are shipped inside the wheel.
  • .github/workflows/build-and-test.yml — tagged releases upload wheels as GitHub Release assets (upstream uses PyPI Trusted Publishing).

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

If you're not sure about the file name format, learn more about wheel file names.

pgserver_search-0.1.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pgserver_search-0.1.5-cp313-cp313-macosx_11_0_arm64.whl (11.0 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pgserver_search-0.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pgserver_search-0.1.5-cp312-cp312-macosx_11_0_arm64.whl (11.0 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pgserver_search-0.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pgserver_search-0.1.5-cp311-cp311-macosx_11_0_arm64.whl (11.0 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pgserver_search-0.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pgserver_search-0.1.5-cp310-cp310-macosx_11_0_arm64.whl (11.0 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pgserver_search-0.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

pgserver_search-0.1.5-cp39-cp39-macosx_11_0_arm64.whl (11.0 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file pgserver_search-0.1.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pgserver_search-0.1.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e94ac1be032e53cfb3c88900c00fad46d37c20ade3babccd97f04455b60dd401
MD5 6b7f2dd102e1324a837903cad090a915
BLAKE2b-256 a0458c6e774f3e2a18024a6d7c9358d5e1e8123195e3d3ff3ba239dd03b7684a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgserver_search-0.1.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build-and-test.yml on stantonius/pgserver-search

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pgserver_search-0.1.5-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver_search-0.1.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d42bd8f0905f2f8beece6f7195200bc8447a1fbdb6883c174388df6d7e2b43c8
MD5 f583ba25d264d62ee9251629b65aaa3b
BLAKE2b-256 eeac6ff25287b60fa125e5e877aa200b6a134f149f88ecb8ce94ee8ff38e9dac

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgserver_search-0.1.5-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: build-and-test.yml on stantonius/pgserver-search

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pgserver_search-0.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pgserver_search-0.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 17904882c0c7302b4a08c0a5b69ee7d18c3815f1a213fd3e7dd574597b3b7427
MD5 86ae18c1c75b6b4a0a76d105f33ad725
BLAKE2b-256 d14765a27476583ce99b861f9dfeae368959ff64b63713f88c34833ec9c6e852

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgserver_search-0.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build-and-test.yml on stantonius/pgserver-search

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pgserver_search-0.1.5-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver_search-0.1.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7370d8c7bf178d39bd7425af3eaabaf5b52e5b5774c0c1a52e50816f2bea6d16
MD5 68acfe77902bd727e7d40520c20c96c1
BLAKE2b-256 4538779e61aa044ebee89849cad89c952fe5c1501f320c185d3f22960ba5d979

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgserver_search-0.1.5-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: build-and-test.yml on stantonius/pgserver-search

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pgserver_search-0.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pgserver_search-0.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 767b3cd688843fedafa0def3907eae29b13c762f1d5722074866d97a00802fc3
MD5 c36329331abbf9135287ba663a3ef2b2
BLAKE2b-256 e0265c9fd748fab6a53e85e56a5aebb3e0986624932b3b19df0735227262c94a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgserver_search-0.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build-and-test.yml on stantonius/pgserver-search

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pgserver_search-0.1.5-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver_search-0.1.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5cd0f1ee86b7d7ce902f1ea234f0098f7a6d1f20421e85295f1f14ba048d5145
MD5 2e2f319ef84784a6ad8cd0751d3b57f0
BLAKE2b-256 6c7b404dff4c1030d16e85d96d0b250e1cb9fce8cee2e82432b0c0a4ef293932

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgserver_search-0.1.5-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: build-and-test.yml on stantonius/pgserver-search

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pgserver_search-0.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pgserver_search-0.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cec2e36725d36dc460c310def9177cb1ae8be237c9c2421fc6b1bb26aa9d7654
MD5 feb3e1be7394173ba51c7693901f1913
BLAKE2b-256 3c907609baca2d73270f4a36b0600b6087f5836ea15496f3c63d3f704e5d866d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgserver_search-0.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build-and-test.yml on stantonius/pgserver-search

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pgserver_search-0.1.5-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver_search-0.1.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 22f54a19fdf163cd3558b12b070865ee410334ff30aa8107cbf7a63c88176660
MD5 98621f52f9f8f4e52a1d6126912b31a3
BLAKE2b-256 746e568126af0bb2ccfa95c35cd2c78bf73b3291a8f84a9256124f313235bd52

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgserver_search-0.1.5-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: build-and-test.yml on stantonius/pgserver-search

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pgserver_search-0.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pgserver_search-0.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c1083dea497b7c46629acaa23f7ad0bcc2fca98dd442683a376cd2580adcedfc
MD5 abb9e64aff19edcfc6274347b72e26a2
BLAKE2b-256 55e235104182de721cc3a49ba7c8a7a45b3196b8790b439e2e2e7cbb9e113602

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgserver_search-0.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build-and-test.yml on stantonius/pgserver-search

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pgserver_search-0.1.5-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver_search-0.1.5-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c59694253907a034798fd0da4b565aeceea75d46107f235b2e7e6f1ada7bd452
MD5 eb4a2f5c88eb5fbf62e87725c46bd243
BLAKE2b-256 ddc9c7e9563ca984349f4482694f87a0bd87ff45e256353f0d289f86c3c655a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgserver_search-0.1.5-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: build-and-test.yml on stantonius/pgserver-search

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page