cfgv
raw JSON → 3.5.0 verified Tue May 12 auth: no python install: verified quickstart: stale
cfgv is a Python library designed to validate configuration files and produce human-readable error messages. The current version is 3.5.0, and it follows a regular release cadence with updates and improvements.
pip install cfgv Common errors
error ModuleNotFoundError: No module named 'cfgv' ↓
cause The 'cfgv' library is not installed in your Python environment or the environment where your code is being executed.
fix
Install the 'cfgv' library using pip:
pip install cfgv error cfgv.ValidationError: Expected <type> got <other_type> ↓
cause The provided configuration value does not match the expected type defined in your 'cfgv' schema.
fix
Adjust the input data to conform to the type specified in the
cfgv schema, or modify your schema definition to correctly reflect the expected data type. For example, if 'Expected bool got str.', change the string value to a boolean. error TypeError: 'Map' object is not callable ↓
cause This error typically occurs when you attempt to call a `cfgv.Map` (or other schema object like `Required`, `Optional`) directly as a function, rather than passing it as an argument to `cfgv.validate` or using it correctly within a schema definition.
fix
Ensure you are using
cfgv.Map and other schema components correctly in your schema definition and passing the schema object to cfgv.validate(value, schema). Warnings
breaking In version 3.5.0, the validate function now raises a ValidationError instead of returning a boolean value. Ensure your code handles this exception appropriately. ↓
fix Update your code to handle ValidationError exceptions raised by the validate function.
gotcha When defining schemas, ensure that all required fields are included to prevent validation errors. Missing fields can lead to unexpected behavior. ↓
fix Always include all required fields in your schema definitions.
breaking The 'schema' argument passed to `cfgv.validate` must be a cfgv schema object (e.g., `cfgv.Map`, `cfgv.Required`), not a raw Python dictionary. Passing a dictionary leads to an `AttributeError: 'dict' object has no attribute 'check'`. ↓
fix Ensure the 'schema' argument is a cfgv schema object, typically constructed using `cfgv.Map`, `cfgv.Map(cfgv.Required(...))`, `cfgv.Sequence`, etc., before passing it to `cfgv.validate`.
breaking The `schema` argument to `cfgv.validate` must be a `cfgv` schema object (e.g., `cfgv.Map`, `cfgv.Required`, etc.), not a plain Python dictionary. Passing a dictionary will raise an `AttributeError` because dictionaries lack the `check` method required by the validation process. ↓
fix Ensure the `schema` argument passed to `cfgv.validate` is an instantiated `cfgv` schema object (e.g., `schema = cfgv.Map(...)`), not a raw Python dictionary.
Install compatibility verified last tested: 2026-05-12
python os / libc status wheel install import disk
3.10 alpine (musl) - - 0.01s 17.8M
3.10 slim (glibc) - - 0.00s 18M
3.11 alpine (musl) - - 0.02s 19.7M
3.11 slim (glibc) - - 0.01s 20M
3.12 alpine (musl) - - 0.01s 11.5M
3.12 slim (glibc) - - 0.01s 12M
3.13 alpine (musl) - - 0.01s 11.2M
3.13 slim (glibc) - - 0.01s 12M
3.9 alpine (musl) - - 0.01s 17.3M
3.9 slim (glibc) - - 0.00s 18M
Imports
- cfgv
import cfgv
Quickstart stale last tested: 2026-04-23
import cfgv
# Define your configuration schema
schema = {
'host': str,
'port': int,
'debug': bool
}
# Load your configuration
config = {
'host': 'localhost',
'port': 8080,
'debug': True
}
# Validate the configuration
cfgv.validate(config, schema)