Every Python project eventually grows a configuration layer, and every one of them
re-implements the same tedium: read the JSON, validate the types, fill in
defaults, instantiate the nested objects, and write a small mountain of get_*
and set_* boilerplate. PyKit is my answer to that — a utility library that
turns a JSON config into strongly-typed Python classes from a single declarative
schema.
The pitch in one line: configuration parsing becomes a one-time schema declaration instead of a maintenance burden. Where a hand-rolled config might run to ~120 lines, the equivalent PyKit schema is closer to 30.
A few things I reach for constantly:
- Schema versioning with real backward compatibility. Deploy a modern config everywhere; each version of the app automatically reads only the keys it understands and ignores the rest — no crashes on unknown fields.
- JSON5 input — comments, trailing commas, unquoted keys.
- A layered include system (
__include__,__include_one__,__include_some__) plus akey!override operator for replace-instead-of-merge. - Auto-generated typed accessors, with stub generation so your IDE autocompletes the entire config.
It isn't only configuration, either. PyKit ships thread-aware logging, thread-safe data structures, and a handful of file utilities — hashing, copying, zipping, directory management — the bits that tend to accompany any real application.
If you want the longer argument for why this beats the usual config handling, I wrote it up:
- Repository: github.com/dvadura/PyKit
- Why You Want PyKit