Skip to main content

Cannabis Data Exchange Standard (CDES) Python SDK

Project description

CDES Python SDK

Official Python SDK for the Cannabis Data Exchange Standard (CDES).

Installation

pip install cdes

Quick Start

Validate Cannabis Data

from cdes import validate_strain, validate_terpene_profile

# Validate a strain record
result = validate_strain({
    "id": "blue-dream",
    "name": "Blue Dream",
    "type": "hybrid"
})

if result.valid:
    print(" Strain data is valid!")
else:
    for error in result.errors:
        print(f" {error.path}: {error.message}")

Access Reference Data

from cdes import get_terpene_library, get_terpene_by_id

# Get the complete terpene library
library = get_terpene_library()
print(f"Library version: {library.version}")
print(f"Total terpenes: {len(library.terpenes)}")

# Look up a specific terpene
myrcene = get_terpene_by_id("terp-myrcene")
print(f"{myrcene.name}: CAS {myrcene.casNumber}")
print(f"Aromas: {', '.join(myrcene.aroma)}")

Features

  • Schema Validation - Validate strains, COAs, terpene profiles, and cannabinoid profiles
  • Reference Data - Access the official CDES terpene library with CAS numbers and effects
  • Type Safety - Full type hints and dataclass models
  • Zero Dependencies - Pure Python, no external packages required

API Reference

Validators

Function Description
validate_strain(data) Validate a strain record
validate_coa(data) Validate a Certificate of Analysis
validate_terpene_profile(data) Validate a terpene profile
validate_cannabinoid_profile(data) Validate a cannabinoid profile

Reference Data

Function Description
get_terpene_library() Get the complete terpene library
get_terpene_by_id(id) Look up a terpene by CDES ID

Models

Class Description
ValidationResult Result of a validation operation
ValidationError A single validation error
Terpene A cannabis terpene
TerpeneLibrary The complete terpene reference

Development

# Clone the repository
git clone https://github.com/Acidni-LLC/cdes-sdk-python.git
cd cdes-sdk-python

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black cdes tests

Related Projects

License

MIT License - see LICENSE for details.

Maintained By

Acidni LLC - Cannabis Data Analytics & AI Solutions

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

cdes-1.4.0.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

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

cdes-1.4.0-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file cdes-1.4.0.tar.gz.

File metadata

  • Download URL: cdes-1.4.0.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cdes-1.4.0.tar.gz
Algorithm Hash digest
SHA256 3b618327d0150dd96b90d281ad8499a2759444765ed17750ff6fda00429d327b
MD5 ec6efc35b390321772c894bb4fa9ecca
BLAKE2b-256 70153a56a94e6668c6dd3e8ca8361d0a5a0da8b020aa6ad4d46ddc160d306b10

See more details on using hashes here.

Provenance

The following attestation bundles were made for cdes-1.4.0.tar.gz:

Publisher: publish.yml on Acidni-LLC/cdes-sdk-python

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

File details

Details for the file cdes-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: cdes-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 22.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cdes-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 330dcc70eec75a32f9b46454d9a2c8942b03e5c2ceacc8632e1369f2c6c837b4
MD5 a98d192fa5737ca67c9fb8d3aeef7b8e
BLAKE2b-256 d43fc9afaa5f11f5a357ac9a236114c7b70258ad7a29924b7a5846f048a2d0a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for cdes-1.4.0-py3-none-any.whl:

Publisher: publish.yml on Acidni-LLC/cdes-sdk-python

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

Supported by

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