{"id":430,"library":"cfgv","title":"cfgv","description":"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.","status":"active","version":"3.5.0","language":"python","source_language":"en","source_url":"https://github.com/asottile/cfgv","tags":["configuration","validation","error handling"],"install":[{"cmd":"pip install cfgv","lang":"bash","label":"Install cfgv"}],"dependencies":[{"reason":"Required for YAML file parsing","package":"pyyaml"}],"imports":[{"note":"Ensure correct import path to avoid ImportError","symbol":"cfgv","correct":"import cfgv"}],"quickstart":{"code":"import cfgv\n\n# Define your configuration schema\nschema = {\n    'host': str,\n    'port': int,\n    'debug': bool\n}\n\n# Load your configuration\nconfig = {\n    'host': 'localhost',\n    'port': 8080,\n    'debug': True\n}\n\n# Validate the configuration\ncfgv.validate(config, schema)","lang":"python","description":"A simple example demonstrating how to define a schema, load a configuration, and validate it using cfgv."},"warnings":[{"fix":"Update your code to handle ValidationError exceptions raised by the validate function.","message":"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.","severity":"breaking","affected_versions":"3.5.0"},{"fix":"Always include all required fields in your schema definitions.","message":"When defining schemas, ensure that all required fields are included to prevent validation errors. Missing fields can lead to unexpected behavior.","severity":"gotcha","affected_versions":"all"},{"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`.","message":"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'`.","severity":"breaking","affected_versions":"all"},{"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.","message":"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.","severity":"breaking","affected_versions":"all"}],"env_vars":null,"search_vec":"'3.5.0':23 'cadenc':30 'cfgv':1,2 'configur':10,35 'current':20 'design':7 'error':17,37 'file':11 'follow':26 'handl':38 'human':15 'human-read':14 'improv':34 'librari':6 'messag':18 'produc':13 'python':5 'readabl':16 'regular':28 'releas':29 'updat':32 'valid':9,36 'version':21","created_at":"2026-03-28T12:02:15.134409+00:00","updated_at":"2026-04-16T01:49:43.520589+00:00","problems":[{"fix":"Install the 'cfgv' library using pip: `pip install cfgv`","cause":"The 'cfgv' library is not installed in your Python environment or the environment where your code is being executed.","error":"ModuleNotFoundError: No module named 'cfgv'"},{"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.","cause":"The provided configuration value does not match the expected type defined in your 'cfgv' schema.","error":"cfgv.ValidationError: Expected <type> got <other_type>"},{"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)`.","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.","error":"TypeError: 'Map' object is not callable"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"quickstart_score":0,"quickstart_tag":"stale","pypi_latest":"3.5.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/asottile/cfgv","docs":null,"changelog":null,"pypi":"https://pypi.org/project/cfgv/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-27","next_check":"2026-07-28","install_tag":"verified"}}