crucible-ingestion
Python classes and framework for parsing metadata out of scientific data files and into the Crucible Data Platform.
Parsing and sending are separate. parse() reads a file and returns an
IngestionPacket describing everything that would be sent; push_packet() takes that
packet and writes it to Crucible. Nothing is uploaded during parsing, and the file bytes
themselves are never sent -- only the parsed metadata.
Install
uv sync
Authentication
Run crucible config init once to store your API url and key. Everything in this package
builds its client through get_client(), which picks up that config.
Running
A real run needs a --dsid. Create the dataset in Crucible first. You may want to include
fields that you do not expect to be parsable, such as instrument name or project ID:
client.datasets.create(Dataset())
Then pass the id it returns:
uv run crucible-ingest --file {local_file_path} --dsid {dsid} [--ingestor {ingestion-class}] [--output-dir {output_dir}] [--push]
--dsidis the dataset the parsed information belongs to.--ingestornames an ingestion class explicitly. Without it, a supported ingestor is auto-detected byfind_supported_ingestor.--output-dirdefaults to./dry_run_output/{dsid}.--pushsends the parsed packet to Crucible. Without it nothing is written to Crucible and the run is a dry run.
Running --push with neither a --dsid nor --test is an error.
The parsed packet is written to {output_dir}/packet.json and any thumbnails are decoded
to {output_dir}/thumbnails/ so they can be inspected.
parse() reads from Crucible when a dataset record with the given dsid already exists, so
that values a user set at dataset creation are not overwritten by parsed ones. If no such
record exists, parsing starts from scratch.
Testing
Testing does not need a dsid. Without one an mfid is generated locally, and --test
creates a persistent dataset under that id in the shared crucible-test project (not automatically cleaned up) for --push to
write to, logging the id it picked:
uv run crucible-ingest --file {local_file_path} --push --test
Drop --push to parse only. The packet is written to {output_dir}/packet.json under the
generated id and nothing touches Crucible:
uv run crucible-ingest --file {local_file_path}
Passing a --dsid is optional and useful when you want the run to go against a dataset
that already exists -- to check that parse() reads the user provided fields back
correctly, for instance. With a --dsid, --test creates nothing and the push goes to
that dataset.
Using it from Python
This requires an dataset id. Use the mfid package.
from crucible_ingestion import parse, push_packet
from mfid import mfid
packet = parse(path_to_file, dsid=mfid()[0])
if packet is not None:
# inspect packet.dataset_fields, packet.scientific_metadata,
# packet.keywords, packet.samples, packet.children, packet.thumbnails
push_packet(packet)
parse returns None when no ingestor supports the file.
Adding a new ingestor
Ingestor classes live in crucible_ingestion/ingestors/ and subclass
CrucibleDatasetIngestor (ingestors/crucible_ingestor.py), which defines the parsing
hooks setup_data() calls: get_scientific_metadata, get_dataset_metadata,
get_acl_information, parse_batch, parse_samples, parse_children, and
get_thumbnails.
A new class needs is_file_supported() and must be added to ingestor_list in
crucible_ingestion/ingestors/registry.py. Order matters -- find_supported_ingestor
returns the first class in the list that claims the file, so specific ingestors belong
above general ones.
Parsing must not post to Crucible. All writes to Crucible should be part of the push_packet function.
Anything that needs to be created or linked can be added to the packet during parsing, for example:
self.samples, self.children, self.keywords, or self.thumbnails.
Once you are content with your new parser, add an example file to tests/data and generate
its schema from the tests folder:
uv run python tests/make_schemas.py --file tests/data/{new_file}
This runs parse() and records the packet's key paths, types, and values as a JSON Schema
in tests/schemas/, paired with the data file's hash in tests/schema_registry.json. The
test suite checks later parses against it, so a field that stops being parsed shows up as a
failure. Files already in the registry are skipped, so running it with no arguments picks
up only what is new. Review the generated schema before committing -- it records what the
code does today, bugs included.
Test data
The files the tests parse live in GCS, not in this repo. Pull them before running the tests:
gcloud storage rsync -r gs://crucible-ingestion-test-data tests/data
Push new or updated files back up:
gcloud storage rsync -r tests/data gs://crucible-ingestion-test-data
Both directions only transfer what is missing or changed, and neither deletes anything at the destination. Removing a file from the bucket has to be done explicitly.
Running in the cloud
The RabbitMQ consumer that runs this package in GCP lives in a separate repo,
ingestion-cloud-consumer.
Metadata
Release files for crucible-ingestion 0.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| crucible_ingestion-0.3.4.tar.gz | 369.1 kB | With provenance | Details for crucible_ingestion-0.3.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| crucible_ingestion-0.3.4-py3-none-any.whl | Python 3 | none | any | Details for crucible_ingestion-0.3.4-py3-none-any.whl |
Total release size: 466.0 kB
Release files / crucible_ingestion-0.3.4.tar.gz
| Download URL | crucible_ingestion-0.3.4.tar.gz |
|---|---|
| Size | 369.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0116187aeadef78afd4cca7100a7e2df670557e8bdd16df33db2606c63684c08
|
|
BLAKE2b-256 checksum How to use checksums |
c0eb9294a89c6e2abb6d0bb7aa8c8070c1862171942bc03ad4ff82f82c671ce3
|
| 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 25, 2026.
Transparency logRelease files / crucible_ingestion-0.3.4-py3-none-any.whl
| Download URL | crucible_ingestion-0.3.4-py3-none-any.whl |
|---|---|
| Size | 97.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce76e54750ae3710404a5aca761cc6ffb8a9b041178e67abf4034518652aadd6
|
|
BLAKE2b-256 checksum How to use checksums |
de6c00cf0ca848aee24079c665cba9a15ed1e0d3c7b0d26624e938c175715451
|
| 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 25, 2026.
Transparency logSecurity for crucible-ingestion 0.3.4
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.
Attestation for crucible_ingestion-0.3.4.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 25, 2026.
Transparency logA 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.