Skip to main content

CRML language/spec models, schema validator, and YAML IO

Project description

crml-lang

Language/spec package for CRML.

  • Pydantic models for CRML documents
  • Bundled JSON Schema + structured validator
  • YAML load/dump helpers (CRScenario, CRPortfolio)

Quickstart

Validate a scenario document:

from crml_lang import validate

report = validate("examples/scenarios/data-breach-simple.yaml", source_kind="path")
print(report.ok)

Load and work with typed models:

from crml_lang import CRScenario

scenario = CRScenario.load_from_yaml("examples/scenarios/data-breach-simple.yaml")
print(scenario.meta.name)

Bundle a portfolio (inline referenced scenarios/packs into a self-contained artifact):

from crml_lang import bundle_portfolio

report = bundle_portfolio("examples/portfolios/portfolio.yaml", source_kind="path")
print(report.ok)

bundle = report.bundle
assert bundle is not None

Bundle from in-memory models (no filesystem access required):

from crml_lang import CRPortfolio, CRScenario, bundle_portfolio

portfolio = CRPortfolio.load_from_yaml("examples/portfolios/portfolio.yaml")
scenario = CRScenario.load_from_yaml("examples/scenarios/data-breach-simple.yaml")

report = bundle_portfolio(
	portfolio,
	source_kind="model",
	scenarios={"s1": scenario},
)
print(report.ok)

Plan a portfolio (deterministic engine pipeline step):

from crml_engine.pipeline import plan_portfolio

plan = plan_portfolio("examples/portfolios/portfolio.yaml", source_kind="path")
print(plan.ok)

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

crml_lang-1.2.1.tar.gz (86.4 kB view details)

Uploaded Source

Built Distribution

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

crml_lang-1.2.1-py3-none-any.whl (117.6 kB view details)

Uploaded Python 3

File details

Details for the file crml_lang-1.2.1.tar.gz.

File metadata

  • Download URL: crml_lang-1.2.1.tar.gz
  • Upload date:
  • Size: 86.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for crml_lang-1.2.1.tar.gz
Algorithm Hash digest
SHA256 467de731ee5e7f35ed62e4bab1d1c179f841611b0cc26c1245b3faea5c6a0515
MD5 83b4a9a7485e2bd28112a1f25a55992c
BLAKE2b-256 5b6a161659d0822f7b784b65b9c29d07b052461a721b585119bcf0c5ebc5335b

See more details on using hashes here.

File details

Details for the file crml_lang-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: crml_lang-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 117.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for crml_lang-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 212700a4d5ddbe14e5d25ca2f3c700f0e2dd90f14bd8d9dc689e12fc947744ac
MD5 adbf4bf92544318847b5024214472c3d
BLAKE2b-256 16509c4e35c80d92f8c084cd54a1dc6a18a4d054cec87b125aad8053da0996f2

See more details on using hashes here.

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