Python Client for Crucible - National Archive for NSRC Observations
Project description
nano-crucible : National Archive for NSRC Observations
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 managementcrucible dataset: Create, list, update, and manage datasetscrucible sample: Create, list, and manage samples with relationshipscrucible project: Manage projects and users (admin)crucible open: Open resources in the Crucible Web Explorer with one command
📦 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/v1/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/v1",
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']}")
📓 For complete examples, see the tutorial notebooks:
- Main Tutorial - Creating datasets, samples, linking, and downloading
- Project Management - Managing projects and users (admin)
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
📖 For complete CLI documentation, see cli/README.md
📖 Documentation
- Tutorial Notebooks: See examples/ - Comprehensive Jupyter notebooks with runnable examples
- Main Tutorial - Datasets, samples, linking, downloading
- Project Management - Projects and users (admin)
- CLI Documentation: See cli/README.md - Complete command-line reference
- Parser Documentation: See parsers/README.md - Custom data format parsers
🤝 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
- Crucible API: https://crucible.lbl.gov/api/v1
- Crucible Web Interface: https://crucible-graph-explorer-776258882599.us-central1.run.app
💬 Support
For issues, questions, or feature requests:
- Discord Server: Join our Discord
- GitHub Issues: https://github.com/MolecularFoundryCrucible/nano-crucible/issues
- Email: mkwall@lbl.gov, roncoroni@lbl.gov, esbarnard@lbl.gov
nano-crucible is developed and maintained by the Data Group at the Molecular Foundry at Lawrence Berkeley National Laboratory.
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
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 nano_crucible-2.1.1.tar.gz.
File metadata
- Download URL: nano_crucible-2.1.1.tar.gz
- Upload date:
- Size: 135.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
110965d19a106acf44f7c9311cdf294c3271a3b3a29acb827ac06d86e6ca5000
|
|
| MD5 |
c01007a9c316e9c7ac9a8b9b5a7a4bc2
|
|
| BLAKE2b-256 |
b3697bc5ab5757702489157b026235a736dadbef53a03061aac8ce3f7c268c35
|
Provenance
The following attestation bundles were made for nano_crucible-2.1.1.tar.gz:
Publisher:
publish-to-pypi.yml on MolecularFoundryCrucible/nano-crucible
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nano_crucible-2.1.1.tar.gz -
Subject digest:
110965d19a106acf44f7c9311cdf294c3271a3b3a29acb827ac06d86e6ca5000 - Sigstore transparency entry: 1570486260
- Sigstore integration time:
-
Permalink:
MolecularFoundryCrucible/nano-crucible@d1a5dc804cecc751c163304f3390a20c2a04073d -
Branch / Tag:
refs/tags/v2.1.1 - Owner: https://github.com/MolecularFoundryCrucible
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@d1a5dc804cecc751c163304f3390a20c2a04073d -
Trigger Event:
release
-
Statement type:
File details
Details for the file nano_crucible-2.1.1-py3-none-any.whl.
File metadata
- Download URL: nano_crucible-2.1.1-py3-none-any.whl
- Upload date:
- Size: 164.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc885500c8a8067a91850935cf7502bf05852b037016398e3ccbd0585e336c39
|
|
| MD5 |
f4cfa14335fc8477b3d2b9da896536f8
|
|
| BLAKE2b-256 |
7b7508bdab1693efb81ae5826ead58b6f1770a0c3cef434054058f220d3d6269
|
Provenance
The following attestation bundles were made for nano_crucible-2.1.1-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on MolecularFoundryCrucible/nano-crucible
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nano_crucible-2.1.1-py3-none-any.whl -
Subject digest:
cc885500c8a8067a91850935cf7502bf05852b037016398e3ccbd0585e336c39 - Sigstore transparency entry: 1570486417
- Sigstore integration time:
-
Permalink:
MolecularFoundryCrucible/nano-crucible@d1a5dc804cecc751c163304f3390a20c2a04073d -
Branch / Tag:
refs/tags/v2.1.1 - Owner: https://github.com/MolecularFoundryCrucible
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@d1a5dc804cecc751c163304f3390a20c2a04073d -
Trigger Event:
release
-
Statement type: