Skip to main content

WOLS - WeMush Open Labeling Standard

Python 3.12+ License: Apache 2.0

The official Python implementation of the WeMush Open Labeling Standard (WOLS) v1.1.0 for specimen tracking in mushroom cultivation.

WOLS CLI Demo

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

Container Image

The WOLS CLI is also available as a container image:

# Pull the latest image
docker pull ghcr.io/wemush/specimen-labels-py:latest

# Run the CLI
docker run --rm ghcr.io/wemush/specimen-labels-py --version

# Create a specimen
docker run --rm ghcr.io/wemush/specimen-labels-py create \
  --species "Pleurotus ostreatus" \
  --type SUBSTRATE \
  --json

# Validate a specimen (mount local file)
docker run --rm -v $(pwd):/data ghcr.io/wemush/specimen-labels-py \
  validate /data/specimen.json

# Generate QR code
docker run --rm -v $(pwd):/data ghcr.io/wemush/specimen-labels-py \
  qr /data/specimen.json --output /data/label.png

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

Regenerating the Demo GIF

The demo GIF is generated using VHS:

# Install VHS (macOS)
brew install vhs

# Regenerate the demo
cd demo
vhs demo.tape

License

Apache 2.0 License - see LICENSE for details.

Metadata

Release files for wols 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wols 1.2.0
File Size Uploaded
wols-1.2.0.tar.gz 1.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for wols 1.2.0
File Interpreter ABI Platform
wols-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 2.1 MB

Release files / wols-1.2.0.tar.gz

Download URL wols-1.2.0.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
867c9a9e5a5a1e554f1306b3529461b94cf13eaa4a0bb48e3b6c00a7f301810d
BLAKE2b-256 checksum
How to use checksums
1b65795de26408b43da3b186301d518b6d2860fa51b5fa3f308d197d2bb62817
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","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}

Release files / wols-1.2.0-py3-none-any.whl

Download URL wols-1.2.0-py3-none-any.whl
Size 1.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
a3be34a38341aa43b8333c038a3a68d59e5f2219fe952165eb83b673839bce0c
BLAKE2b-256 checksum
How to use checksums
21a679813a7ee268b24d30c2bfedf85046057a2a0631424aec98f6cc03296ac0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","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}

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page