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 ships 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.1.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.1.0
File Size Uploaded
shcl-1.1.0.tar.gz 40.4 kB Details

Built distribution (wheel)

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

Total release size: 80.7 kB

Release files / shcl-1.1.0.tar.gz

Download URL shcl-1.1.0.tar.gz
Size 40.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9717fd1b7f266e8dae95ba231a3ad453a35aadaf18bafc3a4690b865d4487a7e
BLAKE2b-256 checksum
How to use checksums
203f93f39c73c8c15369c50c8937f75723b40023dd868cf202ca5334dd1a344a
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.1.0-py3-none-any.whl

Download URL shcl-1.1.0-py3-none-any.whl
Size 40.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03c1299a6e90343c3abf0d23752194114750c8c8eea757bfc52ec16793cbb09b
BLAKE2b-256 checksum
How to use checksums
50222cb4f54c6c261cdc8b190311031c926f361e80c96050faf3b34b6ec95f89
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

1.2.0

2 release files

This release

1.1.0 This release

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