Skip to main content

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 also defines the model-selection contractModelCard, the Python-side shape shared by sleap-roots-training (which writes a production model's selection metadata as wandb artifact metadata at promotion) and sleap-roots-predict (which reads cards to choose a model per root type and calls to_model_ref(runtime_sleap_nn_version)). Unlike the other two, it is a producer↔producer contract that never crosses the Bloom boundary, so it is not emitted to the JSON Schema.

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/*.json is 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sleap_roots_contracts-0.1.0a3.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

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

sleap_roots_contracts-0.1.0a3-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

Details for the file sleap_roots_contracts-0.1.0a3.tar.gz.

File metadata

  • Download URL: sleap_roots_contracts-0.1.0a3.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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

Hashes for sleap_roots_contracts-0.1.0a3.tar.gz
Algorithm Hash digest
SHA256 2c7b5e229994c62e2ef800289d01c4137cba857c42ce22ae0e83f858a4aeaa95
MD5 84a24384d424e7da18f786fddd44e885
BLAKE2b-256 355cacd1f870f68f29a05d9d9af4bfb9030521e3d43a88c3ebc40a57b4e5dad1

See more details on using hashes here.

File details

Details for the file sleap_roots_contracts-0.1.0a3-py3-none-any.whl.

File metadata

  • Download URL: sleap_roots_contracts-0.1.0a3-py3-none-any.whl
  • Upload date:
  • Size: 24.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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

Hashes for sleap_roots_contracts-0.1.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 7175e1ba5365c6085f9970f03cd3caf746788abd12ef4baec6c703a148cb5c47
MD5 f777a583cc20617143b3bf74276c0b4e
BLAKE2b-256 2a681305aa91d80b8ba37d5af79c989cef542188d8212516e77c4ed30af0114b

See more details on using hashes here.

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