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 cfgvVerified import paths — ran on the pinned version, not inferred.
A simple example demonstrating how to define a schema, load a configuration, and validate it using cfgv.
Update your code to handle ValidationError exceptions raised by the validate function.
Always include all required fields in your schema definitions.
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`.
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 the 'cfgv' library using pip: `pip install cfgv`
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.
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)`.