WeMush Open Labeling Standard (WOLS) Python library
Project description
WOLS - WeMush Open Labeling Standard
The official Python implementation of the WeMush Open Labeling Standard (WOLS) v1.1.0 for specimen tracking in mushroom cultivation.
Features
- Core Module: Create, parse, validate, and serialize specimen labels
- QR Codes: Generate and scan QR codes (PNG, SVG, base64)
- Encryption: AES-256-GCM encryption for sensitive data
- CLI: Command-line interface for all operations
- Type Safe: Full type annotations with PEP 561 support
Installation
Basic Installation (Core Only)
# Using UV (recommended)
uv add wols
# Using pip
pip install wols
With Optional Features
# QR code support
uv add "wols[qr]"
# CLI support
uv add "wols[cli]"
# Encryption support
uv add "wols[crypto]"
# Everything
uv add "wols[all]"
Requirements
- Python 3.12 or later
- No required dependencies for core module
Quick Examples
Create a Specimen (Library)
from wols import create_specimen, SpecimenType, GrowthStage, to_json
# Create a specimen
specimen = create_specimen(
type=SpecimenType.SUBSTRATE,
species="Pleurotus ostreatus",
strain="Blue Oyster",
stage=GrowthStage.COLONIZATION,
batch="BATCH-2026-001",
)
# Print the ID
print(f"Created: {specimen.id}")
# Output: Created: wemush:clx1abc123def456
# Serialize to JSON-LD
json_str = to_json(specimen, indent=2)
print(json_str)
Create a Specimen (CLI)
wols create \
--species "Pleurotus ostreatus" \
--type SUBSTRATE \
--strain "Blue Oyster" \
--stage COLONIZATION \
--output specimen.json
Generate QR Code (Library)
from wols import create_specimen, SpecimenType
from wols.qr import generate_qr_png
specimen = create_specimen(
type=SpecimenType.SUBSTRATE,
species="Pleurotus ostreatus",
)
# Generate QR code
qr_bytes = generate_qr_png(specimen)
# Save to file
with open("label.png", "wb") as f:
f.write(qr_bytes)
Validate Specimen (Library)
from wols import validate_specimen, parse_specimen
json_str = '{"@context": "...", "@type": "Specimen", ...}'
specimen = parse_specimen(json_str)
result = validate_specimen(specimen)
if result.valid:
print("Valid specimen!")
else:
for error in result.errors:
print(f"{error.path}: {error.message}")
Validate Specimen (CLI)
wols validate specimen.json
Verification
After installation, verify the library works:
# Check version
python -c "import wols; print(wols.__version__)"
# Check CLI (if installed)
wols --version
# Run a quick test
python -c "
from wols import create_specimen, SpecimenType, to_json
s = create_specimen(type=SpecimenType.CULTURE, species='Test')
print('Success:', s.id)
"
Documentation
Development
# Clone the repository
git clone https://github.com/wemush/specimen-labels-py.git
cd specimen-labels-py
# Install with development dependencies
uv sync --all-extras
# Run tests
uv run pytest
# Run linting
uv run ruff check src tests
uv run ruff format --check src tests
# Run type checking
uv run mypy src
License
Apache 2.0 License - see LICENSE for details.
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
wols-0.1.0.tar.gz
(1.0 MB
view details)
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
wols-0.1.0-py3-none-any.whl
(1.0 MB
view details)
File details
Details for the file wols-0.1.0.tar.gz.
File metadata
- Download URL: wols-0.1.0.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","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 |
6fdc192b357e451839c3198381b3033d66e2001e2c7ba8379dc8bcd79c6d37ec
|
|
| MD5 |
afd38a632a40f25377ac846a0a17ceb5
|
|
| BLAKE2b-256 |
d0de9d8c7311ca33934b031d2594133f5ca90afc32b524f6d7a98f8d3d3f5a02
|
File details
Details for the file wols-0.1.0-py3-none-any.whl.
File metadata
- Download URL: wols-0.1.0-py3-none-any.whl
- Upload date:
- Size: 1.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","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 |
936d3d6b1a28883b378173c3e974cf82b74bec7a891bfcb541469aa2d78e8c84
|
|
| MD5 |
faa0e10354154bc3bf593eb42c604642
|
|
| BLAKE2b-256 |
f57e09ba37e3ad6d3f9f91fd43c621cc9eb1938b8d678c8bdaec3fe145668268
|