Skip to main content

sbol-db

A pure-Python client for the sbol-db HTTP API, plus a PartShop-compatible facade for code migrating from SynBioHub's pysbol2 PartShop.

The client depends only on httpx. SBOL documents cross the wire as RDF strings; structured records come back as typed dataclasses. There is no SBOL object model and no dependency on pysbol2/pysbol3 or sbol-rs; SBOL2 to SBOL3 conversion happens on the server via the version parameter.

Install

pip install sbol-db
# optional: rdflib, for navigating pulled RDF as a graph
pip install "sbol-db[rdf]"

The import name is sbol_db:

from sbol_db import SbolDbClient, PartShop

Broad client

from sbol_db import SbolDbClient

db = SbolDbClient("http://localhost:8888")

# import a document, search, pull, delete
db.create_graph(open("part.ttl").read(), format="turtle",
                document_iri="https://ex.org/part")
for obj in db.search("pLac", object_type="Component"):
    print(obj.display_id, obj.iri)

rdf = db.export_rdf("https://ex.org/pLac", version="sbol2")   # server converts
rows = db.sparql("SELECT ?s WHERE { ?s ?p ?o } LIMIT 10").bindings()
db.delete_graph_by_document_iri("https://ex.org/part")

PartShop facade

from sbol_db import PartShop

shop = PartShop("http://localhost:8888")
shop.login("dba", "dba")                       # HTTP Basic; getKey() is empty
rdf = shop.pull("https://ex.org/pLac")         # RDF text
shop.submit(rdf, collection="https://ex.org/myCollection", overwrite=1)
print(shop.searchCount("pLac"))

Attachments (attachFile, downloadAttachment) raise NotImplementedError: they are out of scope for sbol-db.

Development

The environment is managed by uv; the dev tools live in a dev dependency group that uv run installs automatically.

make test    # unit tests only (uv run pytest -m "not e2e")
make e2e     # build the sbol-db server, then run the full suite against it
make lint    # isort + black + flake8 + mypy

make e2e builds a fresh sbol-db binary and points the test fixtures at it, so the end-to-end tests never run against a stale build. They boot a real server on a throwaway SQLite database (no external services). To also run them against Postgres:

docker compose up -d postgres          # from the repo root
make e2e SBOL_DB_TEST_BACKENDS=sqlite,postgres

Without a discoverable binary the e2e tests skip, so uv run pytest still runs the unit suite anywhere.

Publishing

The package is built and published with uv. Bump version in pyproject.toml and in src/sbol_db/__init__.py, then:

make build           # sdist + wheel into dist/
make check           # twine check dist/*
make publish         # upload to PyPI (needs a token, see below)

make publish reads a PyPI API token from the environment:

export UV_PUBLISH_TOKEN=pypi-...
make publish

To dry-run against TestPyPI first:

uv publish --publish-url https://test.pypi.org/legacy/ dist/*

Metadata

Release files for sbol-db 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sbol-db 0.1.0
File Size Uploaded Provenance Actions
sbol_db-0.1.0.tar.gz 62.2 kB Without provenance Details for sbol_db-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sbol-db 0.1.0
File Interpreter ABI Platform Actions
sbol_db-0.1.0-py3-none-any.whl Python 3 none any Details for sbol_db-0.1.0-py3-none-any.whl

Total release size: 80.3 kB

Release files / sbol_db-0.1.0.tar.gz

Download URL sbol_db-0.1.0.tar.gz
Size 62.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9b6d684d7b6878b153c7915c923d7b6d90a0d06309c80d965b9391a28a4b06c2
BLAKE2b-256 checksum
How to use checksums
a48b4d5ddd0a3d869df8e848c0044d3f33d9dfc21a64ca3a7164b4d000db5016
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.7

Release files / sbol_db-0.1.0-py3-none-any.whl

Download URL sbol_db-0.1.0-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7945e2590bfde4942565201cc69b16d28bafbadf2a22b887474ea9f798d8a074
BLAKE2b-256 checksum
How to use checksums
d635099fc12d02092fb4e8afb5b17bc14dbe09518b6e82b77a5041a88a039db6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.7

Security for sbol-db 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page