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.1.1.tar.gz (9.3 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.1.1-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

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

Hashes for snapcfg-0.1.1.tar.gz
Algorithm Hash digest
SHA256 99dad2d404ac12c8954b76f9cc001c2dbbd1accd1bfc4998b0198061ecb0a4b0
MD5 70af6583548ce34448591775559d9671
BLAKE2b-256 ac4c8f67a2320aa5cb63e96d3d6b8e7161a7d8bf72bf7bdf5cd1a17772493696

See more details on using hashes here.

Provenance

The following attestation bundles were made for snapcfg-0.1.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.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

Hashes for snapcfg-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b58635b29898385a591813eeef55091741edc47ea761b3e9f0bc75b8a9733ef0
MD5 60598e7a23599c6481e06fae7d1dc874
BLAKE2b-256 9b89a7bc58d59e0e1cee195dfb017c5fdc548724e45338181d2e693f1f550bee

See more details on using hashes here.

Provenance

The following attestation bundles were made for snapcfg-0.1.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