Skip to main content

cscm

cscm is a compiler/toolchain for a small configuration-schema definition language. A .cscm file is the single source of truth for a config schema; cscm generates model classes in a target language (currently Python) that load, save, and validate real config files (JSON/YAML) against that schema.

server:
    host: String = "127.0.0.1"
    port: Int(min=1, max=65535) = 8080
    tls:
        enabled: Bool = false

Install

cargo install cscm
pip install cscm

Or download a prebuilt binary from the GitHub Releases page (Linux/macOS/Windows, x86_64 + aarch64).

Usage

cscm schema.cscm --lang python -o config.py
  • --lang and -o are each independently optional: --lang is inferred from -o's extension (.py → python) if omitted; if both are omitted it's an error. If -o is omitted, generated code is written to stdout instead of a file.

The generated Python module is a plain dataclass-based API:

from config import Config

cfg = Config.load("config.yaml")   # detects JSON vs YAML from the extension; validates on load
cfg.server.port                    # typed, validated access
cfg.save("config.yaml")

Generated code depends on a small shared runtime package at load/save time:

pip install cscm-runtime

Language

  • Indentation-based nesting (spaces only, no tabs).
  • # line comments.
  • Types: Bool, Int, Float, String, List<T>, Map<T> (T a scalar type; Map keys are always String). Nested indented blocks are the only way to express structure.
  • Constraints as call-like arguments on the type: Int(min=1, max=65535), String(max=64), String(pattern="[a-z]+").
  • Type? makes a field's value nullable; = default makes the field optional to omit from the config file. The two are independent — see CLAUDE.md for the full grammar and all four combinations.

See sample/web.cscm for a larger example covering every type/constraint combination.

Development

cargo build
cargo test
cargo run -- sample/web.cscm -o /tmp/config.py

See CLAUDE.md for full architecture notes, the generator's semantic-check rules, and current distribution/publishing status.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Release files for cscm 0.3.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 cscm 0.3.0
File Size Uploaded
cscm-0.3.0.tar.gz 51.5 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for cscm 0.3.0
File
cscm-0.3.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
cscm-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
cscm-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
cscm-0.3.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
cscm-0.3.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details

Total release size: 4.5 MB

Release files / cscm-0.3.0.tar.gz

Download URL cscm-0.3.0.tar.gz
Size 51.5 kB
Tags Source
SHA-256 checksum
How to use checksums
16d7b59095c68c14ed8f19578ffd621b28b7046e9e6be706101dc272f48bcb93
BLAKE2b-256 checksum
How to use checksums
3ca333747e667884431a060069247773adba164da26d41c81c435de86f213a8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.11 {"installer":{"name":"uv","version":"0.12.11","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 / cscm-0.3.0-py3-none-win_amd64.whl

Download URL cscm-0.3.0-py3-none-win_amd64.whl
Size 761.3 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
696ea9ab81379205a2cfaae97e8eff33441a616646db913d1c69f7a413e6911d
BLAKE2b-256 checksum
How to use checksums
39b4e30f29bf59ad97a754d23ae71e4bf2d71915a4248af8697f40cca252af3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.11 {"installer":{"name":"uv","version":"0.12.11","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 / cscm-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL cscm-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 974.0 kB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
66359706fdd2de6954ecb79f889b20e54f652b9c70cc4c47f90169224947d6b3
BLAKE2b-256 checksum
How to use checksums
ee555e5f77685f9597c80e402805bf33a85efe1209b46a90f11bfa0a985723b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.11 {"installer":{"name":"uv","version":"0.12.11","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 / cscm-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL cscm-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 948.8 kB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
f87cb47ffd821a84bed432e3c6acddf57f63cc38048dbaceb6e5d221729607e5
BLAKE2b-256 checksum
How to use checksums
410d27b28361a0d293ca1641b858d7fc5983182983ac835acb61a01575f09b77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.11 {"installer":{"name":"uv","version":"0.12.11","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 / cscm-0.3.0-py3-none-macosx_11_0_arm64.whl

Download URL cscm-0.3.0-py3-none-macosx_11_0_arm64.whl
Size 853.2 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f51c64580f625b76509c696647712132b3135364ed3d2f81ed58eef7cf1fe234
BLAKE2b-256 checksum
How to use checksums
dcf5b7b1c7f47c41360d1b9aec0f45b5d19ee141fd61da62d3f3ca57a4459ea0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.11 {"installer":{"name":"uv","version":"0.12.11","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 / cscm-0.3.0-py3-none-macosx_10_12_x86_64.whl

Download URL cscm-0.3.0-py3-none-macosx_10_12_x86_64.whl
Size 897.2 kB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
78ff189d323241e02f1a2414a3159077e77aba1c874d451623492044b217f46f
BLAKE2b-256 checksum
How to use checksums
3646249332346febb5cad0022ac7f29235195082e12fd4673cdf9927c4405b1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.11 {"installer":{"name":"uv","version":"0.12.11","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

0.3.0 This release

6 release files

0.2.0

6 release files

0.1.1

6 release files

0.1.0

1 release file

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