Validate configs against a flexible app-defined schema.
Project description
snapcfg
snapcfg is a minimal configuration validation tool for Python projects. It allows you to load JSON or YAML configuration files and validate them against a simple, JSON-like schema with type checks and constraints.
Features
- ✅ Supports JSON and YAML config files
- 🧾 Simple schema format using Python dicts
- 🛠 CLI and Python API for validation
- 🧪 Validates types (
int,str,bool), ranges, required fields, and defaults
Installation
pip install snapcfg
Or from source:
git clone https://github.com/yourname/snapcfg.git
cd snapcfg
pip install .
Usage
CLI
snapcfg validate --config path/to/config.yaml --schema path/to/schema.yaml
Python API
from snapcfg.loader import load_file
from snapcfg.schema_parser import normalize_schema
from snapcfg.validator import validate_config
config = load_file("config.yaml")
schema = normalize_schema(load_file("schema.yaml"))
validated = validate_config(config, schema)
Example
config.yaml
port: 8080
debug: true
schema.yaml
port:
type: int
min: 1
max: 65535
required: true
debug:
type: bool
default: false
License
This project is licensed under the terms of the MPL-2.0 license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file snapcfg-0.1.1.tar.gz.
File metadata
- Download URL: snapcfg-0.1.1.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99dad2d404ac12c8954b76f9cc001c2dbbd1accd1bfc4998b0198061ecb0a4b0
|
|
| MD5 |
70af6583548ce34448591775559d9671
|
|
| BLAKE2b-256 |
ac4c8f67a2320aa5cb63e96d3d6b8e7161a7d8bf72bf7bdf5cd1a17772493696
|
Provenance
The following attestation bundles were made for snapcfg-0.1.1.tar.gz:
Publisher:
python-publish.yml on ArchooD2/snapcfg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
snapcfg-0.1.1.tar.gz -
Subject digest:
99dad2d404ac12c8954b76f9cc001c2dbbd1accd1bfc4998b0198061ecb0a4b0 - Sigstore transparency entry: 202277316
- Sigstore integration time:
-
Permalink:
ArchooD2/snapcfg@060715600e0021a05660f0b940060d4da2038590 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/ArchooD2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@060715600e0021a05660f0b940060d4da2038590 -
Trigger Event:
release
-
Statement type:
File details
Details for the file snapcfg-0.1.1-py3-none-any.whl.
File metadata
- Download URL: snapcfg-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b58635b29898385a591813eeef55091741edc47ea761b3e9f0bc75b8a9733ef0
|
|
| MD5 |
60598e7a23599c6481e06fae7d1dc874
|
|
| BLAKE2b-256 |
9b89a7bc58d59e0e1cee195dfb017c5fdc548724e45338181d2e693f1f550bee
|
Provenance
The following attestation bundles were made for snapcfg-0.1.1-py3-none-any.whl:
Publisher:
python-publish.yml on ArchooD2/snapcfg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
snapcfg-0.1.1-py3-none-any.whl -
Subject digest:
b58635b29898385a591813eeef55091741edc47ea761b3e9f0bc75b8a9733ef0 - Sigstore transparency entry: 202277322
- Sigstore integration time:
-
Permalink:
ArchooD2/snapcfg@060715600e0021a05660f0b940060d4da2038590 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/ArchooD2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@060715600e0021a05660f0b940060d4da2038590 -
Trigger Event:
release
-
Statement type: