Shared result + provenance contract for the sleap-roots <-> Bloom pipeline.
Project description
sleap-roots-contracts
Shared result + provenance contract for the sleap-roots ↔ Bloom pipeline.
This is a small, dependency-light, Bloom-agnostic library that defines the shape of a
per-scan pipeline result and its provenance (Pydantic v2 models), emits a versioned JSON
Schema artifact, and ships a trait-definitions registry. The Python producers
(sleap-roots-predict, sleap-roots-traits) import it; Bloom consumes the emitted schema.
It also defines the analysis-input contract — the canonical shape of the wide trait
table that crosses the sleap-roots-analyze ↔ Bloom boundary.
validate_analysis_input(df, *, strict=False) structurally validates that table against
fixed canonical role names (genotype + optional sample_id / replicate /
image_path) plus an open set of opaque numeric trait columns, returning a structured
ValidationResult. It operates on a pandas DataFrame, so pandas is an optional install
extra — pip install sleap-roots-contracts[pandas] — while the runtime core stays
pydantic + pyyaml. Canonical example tables ship in the package
(sleap_roots_contracts.examples.load_analysis_input_example(...)) so consumers can load a
validating frame straight from the released wheel.
It is sub-project #1 of the sleap-roots ↔ Bloom integration program. Design and plan:
docs/01-contract-library-design.md and docs/02-contract-library-plan.md.
Develop
uv sync
uv run pytest -v
uv run black --check src tests && uv run ruff check src tests
Key ideas
- Pydantic is canonical;
schema/*.jsonis generated and drift-guarded in CI. - Trait values are long-format rows (no jsonb); provenance is a jsonb blob on the source.
- Hashes (
param_hash,idempotency_key) are producer-side only; Bloom treats them as opaque strings. - Distributed via PyPI (no Docker image — this is a library).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sleap_roots_contracts-0.1.0a2.tar.gz.
File metadata
- Download URL: sleap_roots_contracts-0.1.0a2.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
857544b8f9ff18bd8345debd13a5da1bb37077159a75e457ebd8da3b015a2e6b
|
|
| MD5 |
ad963c70b57edf9afbb49583d250d980
|
|
| BLAKE2b-256 |
1e4bb220ab4138eff21cc3ea4161bdff9cfb929daf9ce98352a81f57df533a8a
|
File details
Details for the file sleap_roots_contracts-0.1.0a2-py3-none-any.whl.
File metadata
- Download URL: sleap_roots_contracts-0.1.0a2-py3-none-any.whl
- Upload date:
- Size: 21.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b889d510f1c087675e8beba3072e3f7ae57c4d2a7c2c145e09c1fa2d4a90abd0
|
|
| MD5 |
ff28cbdc18bd2f123f97f44bb87e3805
|
|
| BLAKE2b-256 |
ef98fb34573ae0d7d98abb210b5c4218136dcfb91066a5a324479601f29baefb
|