Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snapcfg-0.0.1.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

snapcfg-0.0.1-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file snapcfg-0.0.1.tar.gz.

File metadata

  • Download URL: snapcfg-0.0.1.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for snapcfg-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f43705a56d409ca6391e8bda559d808c55aa7ad18d842026a934a81fd7cbd687
MD5 daffd60b5e0142f790e76a62cf636498
BLAKE2b-256 dc0f6922b3c58fba2f2e7f105b0bcc49661d8e63c9f8bcf7486d6f2fed403de5

See more details on using hashes here.

Provenance

The following attestation bundles were made for snapcfg-0.0.1.tar.gz:

Publisher: python-publish.yml on ArchooD2/snapcfg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file snapcfg-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: snapcfg-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for snapcfg-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aeb761fafcd6cf4141048273be23b1aca610aa985fd418f65dc7406aaeaabd0b
MD5 d4d84e148ccdf8d4e9dd4515c644e97b
BLAKE2b-256 db16d7c0ee9378fd0a7e5b13a7e0f0fce0aaec2a96953fb2ab0e784bf4c470bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for snapcfg-0.0.1-py3-none-any.whl:

Publisher: python-publish.yml on ArchooD2/snapcfg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page