Skip to main content

bbconf

Run pytests pypi-badge pypi-version Code style: black Github badge coverage

BEDBASE project configuration package (agent)

What is this?

bbconf is a configuration and data management library for the BEDbase platform. It serves as the central backbone for all BEDbase tools and pipelines by:

  • Reading and validating YAML configuration files
  • Setting up and managing connections to PostgreSQL, Qdrant, S3, and PEPHub
  • Loading ML models (Region2Vec, text embedders, sparse encoders, UMAP) used for BED file search
  • Providing high-level Python interfaces for querying and managing BED files and BED sets
  • Exposing a unified BedBaseAgent object that all downstream tools use to interact with the platform

Documentation: https://docs.bedbase.org/bedboss

Source Code: https://github.com/databio/bbconf


Installation

To install bbclient use this command:

pip install bbconf

or install the latest version from the GitHub repository:

pip install git+https://github.com/databio/bbconf.git

pip install bbconf does not include the search models. Add the local extra to load them in-process (pip install "bbconf[local]"), or use embedding servers (below).

Quick start

from bbconf import BedBaseAgent

agent = BedBaseAgent(config="config.yaml")

# Access submodules
agent.bed  # BED file operations
agent.bedset  # BED set operations
agent.objects  # Generic object/file operations

# Get platform statistics
stats = agent.get_stats()
print(stats.bedfiles_number, stats.bedsets_number)

Embedding servers

By default bbconf loads the text, sparse, and region2vec models named in path into memory. To get embeddings from HTTP servers instead, add an embedding_server block. Each URL that is set moves that one model to a server; the others stay local. A blank value or an unset $VAR counts as unset.

embedding_server:
  text_url: http://localhost:8080     # dense text model (path.text2vec)
  sparse_url: http://localhost:8081   # sparse model (path.sparse_model)
  region_url: http://localhost:8082   # region model (path.region2vec)
  api_key: $EMBEDDING_API_KEY         # sent as a Bearer token

The text servers speak the Hugging Face Text Embeddings Inference (TEI) API (POST /embed, POST /embed_sparse, GET /info). The region server speaks this API:

  • GET /info returns JSON with api_version ("1"), model_id, and embedding_dim.
  • POST /embed_bed?pooling=mean takes a raw BED file as the body (plain, or gzipped with Content-Type: application/gzip) and returns {"embeddings": [[...]]}: one vector, the float32 mean of the region vectors, the same as np.mean(Region2VecExModel.encode(regions), axis=0).
  • Errors return a non-2xx status with {"error": "...", "error_type": "..."}.

At startup bbconf calls each server's /info and stops if the server's model is not the one named in path, or if its vector size differs from the Qdrant collection's. If a server can't be reached, bbconf logs a warning and starts anyway.

Database migrations

bbconf uses Alembic to version the database schema. The migration scripts live in bbconf/alembic, and alembic.ini (repo root) is used for local CLI work. The first (baseline) revision is 8b0b706d0827; it reproduces exactly the schema that Base.metadata.create_all() builds, including the pg_trgm extension and the trigram / partial / expression indexes.

To update schema for desirable database, use different database url in alembic.ini, otherwise run test database

Creating a new revision

After changing the models in bbconf/db_utils.py:

alembic revision --autogenerate -m "Describe your change"

Review the generated file. Alembic cannot autogenerate a few constructs used by bbconf — the pg_trgm extension and expression-based indexes may need a manual op.execute(...) — so always check the diff before committing.

Applying migrations

alembic upgrade head      # upgrade to the latest revision
alembic downgrade -1      # roll back one revision
alembic current           # show the DB's current revision

Running migrations automatically

To upgrade the database to head automatically when bbconf starts, set run_migrations: true under the database section of the config file:

database:
  host: localhost
  port: 5432
  user: postgres
  password: docker
  database: bedbase
  run_migrations: true

Note: enable this only after the database has been stamped/upgraded to a known revision. Turning it on against an un-stamped existing database will fail on startup, because the baseline revision creates tables that already exist.

Metadata

Release files for bbconf 0.17.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 bbconf 0.17.0
File Size Uploaded Provenance Actions
bbconf-0.17.0.tar.gz 449.4 kB With provenance Details for bbconf-0.17.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bbconf 0.17.0
File Interpreter ABI Platform Actions
bbconf-0.17.0-py3-none-any.whl Python 3 none any Details for bbconf-0.17.0-py3-none-any.whl

Total release size: 529.3 kB

Release files / bbconf-0.17.0.tar.gz

Download URL bbconf-0.17.0.tar.gz
Size 449.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7d0e1d79eb1bc9646929751dd8f91444b637637a2d2bfaecfce790ee10e2a2e7
BLAKE2b-256 checksum
How to use checksums
7555cf49ffdfe2c34ab75f7fc066241dab413da138190712b2b5fcfc52b885d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 20, 2026.

Transparency log

Release files / bbconf-0.17.0-py3-none-any.whl

Download URL bbconf-0.17.0-py3-none-any.whl
Size 79.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e4a94a1dd3e5b22bfc8298a6a36b2a81ae7b29647d87c97e16793830cea71c9
BLAKE2b-256 checksum
How to use checksums
e224e575607d35df2f5a00cd35af6881b8bf625fb16fac725e90eeb3a59e2d12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 20, 2026.

Transparency log

Security for bbconf 0.17.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for bbconf-0.17.0.tar.gz

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 Nov 20, 2026.

Transparency log

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.17.0 This release

2 release files Full 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