Skip to main content

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, Status

with open("server.shcl", encoding="utf-8") as f:
	doc = Document.parse(f.read())

# 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.
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")

Document.parse never raises. When you want a hard error instead, use Document.parse_with(text, Strictness.Strict), which raises 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 1.x is the same behavior in every language. shcl~=1.0 picks up minor and patch releases on its own and never crosses a major version.

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/jim-collier/shcl.

Docs

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

License

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

Release files for shcl 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 shcl 1.2.0
File Size Uploaded
shcl-1.2.0.tar.gz 41.1 kB Details

Built distribution (wheel)

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

Total release size: 82.2 kB

Release files / shcl-1.2.0.tar.gz

Download URL shcl-1.2.0.tar.gz
Size 41.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8cfe4b3d48945a521ec1a7be724bc7ccdb3921de7ecbca07db7c8716ae357dfc
BLAKE2b-256 checksum
How to use checksums
60952b986a29edb199a9f5a938b3b80a37929bec76adb260657c1a1ae027c5e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

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

Download URL shcl-1.2.0-py3-none-any.whl
Size 41.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
997ec2eee07206a55909b417d3e2144a5757c457725588bebc5b07919c5ec792
BLAKE2b-256 checksum
How to use checksums
d80dead7e45e44cb6c597a70fef9314cb28498418b6cdb90a1ea309386d7fec8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release history Release notifications | RSS feed

2.0.0

2 release files

This release

1.2.0 This release

2 release files

1.1.0

2 release files

1.0.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