Skip to main content

nano-crucible : National Archive for NSRC Observations

PyPI version PyPI downloads GitHub release Python Version License GitHub stars Discord Docs

A Python client library and CLI tool for Crucible - the Molecular Foundry's data lakehouse for scientific research. Crucible stores experimental and synthetic data from DOE Nanoscale Science Research Centers (NSRCs), along with comprehensive metadata about samples, projects, instruments, and users.

🔬 What is Crucible?

Crucible is the centralized data infrastructure for the Molecular Foundry and other DOE Nanoscale Science Research Centers, providing:

  • Unified data storage for experimental and synthetic data
  • Rich metadata capture to associate with datasets
  • Sample provenance tracking with parent-child relationships

✨ Features

Python API

  • Dataset Management: Create, query, update, and download datasets
  • Sample Tracking: Manage samples with hierarchical relationships and provenance
  • Metadata: Store and retrieve scientific metadata and experimental parameters
  • Linking: Connect datasets, samples, and create relationships programmatically

🖥️ Command-Line Interface

  • crucible config: One-time setup and configuration management
  • crucible dataset: Create, list, update, and manage datasets
  • crucible sample: Create, list, and manage samples with relationships
  • crucible file: List, inspect, and download files attached to datasets
  • crucible instrument: Create, list, and update instruments
  • crucible project: Manage projects and users (admin)
  • crucible open: Open resources in the Crucible Web Explorer with one command

🆕 What's New in 2.1.1

  • API v2 by default: CrucibleClient now targets https://crucible.lbl.gov/api/v2. v1 still works but emits a DeprecationWarning — run crucible config set api_url https://crucible.lbl.gov/api/v2 to upgrade.
  • crucible file subcommand: list, inspect, and download files attached to datasets, with lookup by dataset_mfid or SHA-256 hash.
  • Chunked GCS uploads: large files upload in 32 MiB chunks with per-chunk CRC32C and incremental SHA-256, verified at /complete.
  • Public samples: Sample.public is now a first-class field and crucible sample create --public is supported.
  • Email-based user lookup: crucible project add-user / remove-user accept emails directly — no client-side ORCID resolution needed.
  • Richer display: linked resources surfaced above metadata, alphabetized scientific metadata, MFID labels, and centered QR codes.

📦 Installation

From PyPI (Recommended)

pip install nano-crucible

From GitHub (Latest Development)

pip install git+https://github.com/MolecularFoundryCrucible/nano-crucible

With Optional Dependencies

# Install with parser support (includes ASE for LAMMPS and MatEnsemble parsers)
pip install nano-crucible[parsers]

# Install everything
pip install nano-crucible[all]

# For development
pip install nano-crucible[dev]

For Development

git clone https://github.com/MolecularFoundryCrucible/nano-crucible.git
cd nano-crucible
pip install -e ".[dev]"

🚀 Quick Start

Configuration

First, configure your API credentials:

crucible config init

Get your API key at: https://crucible.lbl.gov/api/v2/user_apikey

Alternative (without terminal access): Initialize the client directly with your credentials:

from crucible import CrucibleClient
client = CrucibleClient(
    api_url="https://crucible.lbl.gov/api/v2",
    api_key="your-api-key-here"
)

Python API

from crucible import CrucibleClient
from crucible.models import Dataset

# Initialize client
client = CrucibleClient()

# Create a dataset
dataset = Dataset(
    dataset_name="My Experiment",
    measurement="XRD",
    project_id="my-project",
    public=False
)

result = client.datasets.create(
    dataset=dataset,
    scientific_metadata={"temperature_C": 300},
    keywords=["experiment", "test"]
)

print(f"Dataset created: {result['dsid']}")

Command-Line Interface

# Configure API credentials
crucible config init

# Create a dataset with files
crucible dataset create -i data.csv -n "My Dataset" -m "XRD" -pid my-project

# List datasets in a project
crucible dataset list -pid my-project

# Get dataset details
crucible dataset get DATASET_ID

# Create a sample
crucible sample create -n "Sample A" -pid my-project

# Link sample to dataset
crucible sample add-dataset SAMPLE_ID -d DATASET_ID

# Open a resource in your browser
crucible open DATASET_ID

🤝 Contributing

We welcome contributions! Areas where you can help:

  • New parsers for additional data formats
  • Bug reports and feature requests
  • Documentation improvements
  • Example notebooks and tutorials

📄 License

This project is licensed under the BSD-3-Clause License - see the LICENSE file for details.

🔗 Links

💬 Support

For issues, questions, or feature requests:


nano-crucible is developed and maintained by the Data Group at the Molecular Foundry at Lawrence Berkeley National Laboratory.

Download files

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

Source Distribution

nano_crucible-3.1.0.tar.gz (159.5 kB view details)

Uploaded Source

Built Distribution

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

nano_crucible-3.1.0-py3-none-any.whl (198.5 kB view details)

Uploaded Python 3

File details

Details for the file nano_crucible-3.1.0.tar.gz.

File metadata

  • Download URL: nano_crucible-3.1.0.tar.gz
  • Upload date:
  • Size: 159.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for nano_crucible-3.1.0.tar.gz
Algorithm Hash digest
SHA256 7534d0c275f23344d8fc578c9f2a64cd8c889e6c684b720fbc7f4aac8920ae2a
MD5 b3d80512d1d4644d02da8335f1883474
BLAKE2b-256 28789c1e2692c23641e10eb6b6d5ce2fc1c0b6ec04191ebb07eab326ba42d8cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for nano_crucible-3.1.0.tar.gz:

Publisher: publish-to-pypi.yml on MolecularFoundryCrucible/nano-crucible

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nano_crucible-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: nano_crucible-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 198.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for nano_crucible-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a23d6a87d3e57f19238d0de6d2363e2f2a028a37211c2823bbb5e25b0413a37
MD5 ec472eab38311e2e2c5cc56951b49562
BLAKE2b-256 a78c7d15276c861a4771f52114c1054a92843b6e24fc83f9f211b78c29f1bed6

See more details on using hashes here.

Provenance

The following attestation bundles were made for nano_crucible-3.1.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on MolecularFoundryCrucible/nano-crucible

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

3.1.0 This release

2 files

3.0.1

2 files

3.0.0

2 files

2.1.2

2 files

2.1.1

2 files

2.1.0

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page