Skip to main content

Self-contained Postgres (with pg_trgm, pgvector, and btree_gist) 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 search features like pg_trgm trigram similarity, pgvector vector search, and btree_gist-backed tstzrange filters for search results.

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 pg_trgm, pgvector, and btree_gist bundled in for trigram, vector, and time-window-filtered search workflows.

What this is

This is a fork of orm011/pgserver that adds selected Postgres contrib/search extensions 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 and btree_gist into the packaged Postgres layout, so you can combine vector/trigram search with Postgres tstzrange filters, for example "search only records visible during this time window", without extra local Postgres setup.

Why

pg_trgm and btree_gist ship in Postgres' contrib/ tree but are not installed by the default make install that upstream pgserver runs. If you want fuzzy text search or time-window filtering over search results alongside vector search in an embedded Postgres, you previously had to build those pieces yourself. This fork does that for you.

Install

From PyPI (recommended)

Pre-built wheels are published to PyPI for the platforms built by this repo's release workflow:

pip install pgserver-search

The same wheels are also attached to tagged GitHub releases.

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, and btree_gist 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;")
    pg.psql("CREATE EXTENSION btree_gist;")
    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 pg_trgm and btree_gist targets that build and install Postgres contrib extensions 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.6-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.6-cp313-cp313-macosx_11_0_arm64.whl (11.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pgserver_search-0.1.6-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.6-cp312-cp312-macosx_11_0_arm64.whl (11.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pgserver_search-0.1.6-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.6-cp311-cp311-macosx_11_0_arm64.whl (11.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pgserver_search-0.1.6-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.6-cp310-cp310-macosx_11_0_arm64.whl (11.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pgserver_search-0.1.6-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.6-cp39-cp39-macosx_11_0_arm64.whl (11.1 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for pgserver_search-0.1.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3c87aaed4cbf35768ac9d92d78f829dc80da8247ff0aa3f2825e0853fe12c393
MD5 880764beaa6595ff8ebcc7ee50f3ecf1
BLAKE2b-256 6e78d9f6992e32acf779d6834937205a0653f9dd51758458a526c47209996d83

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgserver_search-0.1.6-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.6-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver_search-0.1.6-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 84722413e28188473dbe3f68e5e6bdd649a35515a2d257bfc241a470144217c1
MD5 30fd3bb02a052b5516d84d1ad3de5b9e
BLAKE2b-256 ebeb9e092851f0c9fcdba31eca2983f39f8da07e96e111ef5f76994654f4a331

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgserver_search-0.1.6-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.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pgserver_search-0.1.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2f4ca396e4828be9835074811aace6e98b7f005828999cf83cc22ee9921a210f
MD5 4d71c7de154df3bcccf09042c8503099
BLAKE2b-256 c225e479c136ff69c46ca46fe46ebf57b945b65a17a6ee02d58bad5896216104

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgserver_search-0.1.6-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.6-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver_search-0.1.6-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 27cfd50fd93ab3796ef7d4657929356edceee8417173ef220f984e1844075ef5
MD5 171c1f9c85e355226783e8708e4ff4cf
BLAKE2b-256 b24e4ee639cb55b2bf5c4e871aca7720daac3705058c18978b2c587e638d7f0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgserver_search-0.1.6-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.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pgserver_search-0.1.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 659096218af5033b8c02f7408d0d0b4fb25bc9702a7aa41c9056dc036ebc5f51
MD5 9a634413df22a02d8773c9eff0d49afc
BLAKE2b-256 ae05dde63195feb878051c5d548f70d01670923af80e21c65ea321ee83d52dd0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgserver_search-0.1.6-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.6-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver_search-0.1.6-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 74c56ef3ab5d6553d820e12557580f2977537e028311e8e0ff072a6f3d3ec630
MD5 9c5684d523b5a4c014f36cbda03a5695
BLAKE2b-256 05eeece794f91f38d59bcd95656d432211e3f8770a67d27d0fcf05d64438af93

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgserver_search-0.1.6-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.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pgserver_search-0.1.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a6cd3364147af5eacc123d0fd72682150d5d323a5a6d63e8914a735876949730
MD5 1f8b8a88c18aa5620703faf9937baff6
BLAKE2b-256 f44aeaa2718984364eb0b5983b2cab9bb2758061ee9faad15b21d0956ccac123

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgserver_search-0.1.6-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.6-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver_search-0.1.6-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 86c51d978748b843fa0cef718021c1a3f34b485c90ca614b9ae5c9c61c959a0d
MD5 7098af45d30a83a8fe1e4c3e0ad17800
BLAKE2b-256 c8406ab9704c1bfa0528aad89c081a646eb41a4ce8afeaf166d4651faacde03d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgserver_search-0.1.6-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.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pgserver_search-0.1.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 379df59792b2d4184dcd861964a8a900f69e9be687bc85f8523bdbf3a2ab125c
MD5 1a7179db6256ae7a17b66e2a0492779b
BLAKE2b-256 7307bb02946f3d5a95f34ec099cb946710df0af29d06a9447bb12a18140621ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgserver_search-0.1.6-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.6-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pgserver_search-0.1.6-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 92bf338bac8cd19dfe937d772a925e6925208e8f61ae5f0e8340731f727ded2c
MD5 71555ddfb61fa2747b292857e6b22a41
BLAKE2b-256 11be2986debbf7a1a258ddc7b7b9446936785f40919ec12cf6ed686a98af77b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgserver_search-0.1.6-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