{"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,"last_verified":"2026-05-12T13:45:03.749Z","next_check":"2026-06-26T00:00:00.000Z","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,"install_tag":"verified","quickstart_score":0,"quickstart_tag":"stale","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.3,"disk_size":"17.8M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0,"mem_mb":0.3,"disk_size":"18M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.02,"mem_mb":0.3,"disk_size":"19.7M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.3,"disk_size":"20M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.3,"disk_size":"11.5M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.3,"disk_size":"12M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.5,"disk_size":"11.2M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.3,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.2,"disk_size":"17.3M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0,"mem_mb":0.2,"disk_size":"18M"}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}}