Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

shcl

Simple Hierarchical Config Language. Forgiving to write, predictable to read.

Values are stored as plain text and coerced only when your code asks for a type, so a config file can never silently decide that NO means false. A bad line is skipped or repaired with a diagnostic instead of taking down the whole file.

Pure standard library, no dependencies, one module. Held byte-for-byte against the Rust reference by a shared conformance corpus.

Install

pip install shcl

Use

from shcl import Document, FileStatus, SetStatus, Status

# Reads and parses in one call, and never raises: the document is usable
# either way, and the status separates missing from unreadable from
# parsed-with-errors.
doc, file_status = Document.load_file("server.shcl")
if file_status is FileStatus.NotFound:
	print("no config yet - using defaults")

# One call, a typed value, a visible fallback at the call site.
limit = doc.get_int("site(example.com).max-upload-mb", default=10)

# Or ask why a read failed: Good, Empty, NotFound, BadType, Multiple, BadPath.
r = doc.read_int("site(example.com).max-upload-mb")
if r.status is not Status.Good:
	print(r.status, r.raw)

# Wildcards read across instances, with a status per slot.
roots = doc.read_string_array("site(*).root")

# Writes through a temp file and a rename, so an interrupted save cannot
# truncate the config - and raises SaveRefused if this write would delete lines
# or values from the file (save_file_lossy is the override).
# A setter returns SetStatus.Ok, or why it wrote nothing at all. Only Ok is
# true, so `if not doc.set_int(...)` reads as refused.
st = doc.set_int("site(example.com).max-upload-mb", limit * 2)
if st is not SetStatus.Ok:
	print("not written:", st)
doc.save_file("server.shcl")

Document.parse never raises, and neither does load_file. When you want a hard error instead, use Document.parse_with(text, Strictness.Strict) or load_file_with(path, Strictness.Strict), which raise LoadError. A get_* call with no default= raises StatusError rather than inventing a value.

Also here: merge for layered config (defaults, site, user), validate against a schema that is itself a SHCL file, a full writer, and a canonical formatter that preserves comments.

Python 3.9 or newer.

Compatibility

Bindings are versioned in lockstep, so 3.x is the same behavior in every language. shcl~=3.0 picks up minor and patch releases on its own and never crosses a major version. It skips a beta, though, so name this one exactly: shcl==3.0.0b1, or pip install --pre shcl.

The CLI

This package is the library only. The shcl command comes as a prebuilt binary and as .deb/.rpm/Windows packages - see https://github.com/yottacore/shcl.

Docs

Language spec, formal grammar, and the other bindings: https://github.com/yottacore/shcl

License

MIT. SHCL™ is a trademark of Jim Collier - see the trademark policy.

Metadata

Release files for shcl 3.0.0b1

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

Source distribution (sdist)

Source distribution for shcl 3.0.0b1
File Size Uploaded Provenance Actions
shcl-3.0.0b1.tar.gz 160.6 kB Without provenance Details for shcl-3.0.0b1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for shcl 3.0.0b1
File Interpreter ABI Platform Actions
shcl-3.0.0b1-py3-none-any.whl Python 3 none any Details for shcl-3.0.0b1-py3-none-any.whl

Total release size: 320.7 kB

Release files / shcl-3.0.0b1.tar.gz

Download URL shcl-3.0.0b1.tar.gz
Size 160.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c4d5368a24f30c6bdff56164610cdfa0890f1f938979df506b89044f03d46c30
BLAKE2b-256 checksum
How to use checksums
3c7c7c2129b4d9814d7a742fc6b289d28e9a461f276160aebcd4f7ce46a93a57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / shcl-3.0.0b1-py3-none-any.whl

Download URL shcl-3.0.0b1-py3-none-any.whl
Size 160.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
56955bb24eeb004b7318986522ca5b13b4fe32d86ad4445b914e163c80b799bd
BLAKE2b-256 checksum
How to use checksums
bbb1227e5d29a6b33f7f7cc4c5dcf0f0594144d0bca2b80448f5ba48f7849826
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for shcl 3.0.0b1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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