{"id":8798,"library":"zconfig","title":"ZConfig: Structured Configuration Library","description":"ZConfig is a Python library designed for structured, schema-driven configuration, particularly useful for complex applications and logging. It employs an XML-based schema language to define the allowable structure and content of configuration documents, including custom data conversion routines written in Python. This approach offers greater flexibility and validation capabilities compared to Python's standard `ConfigParser` module. ZConfig is currently at version 4.3 and is actively maintained by the Zope Foundation.","status":"active","version":"4.3","language":"en","source_language":"en","source_url":"https://github.com/zopefoundation/ZConfig/","tags":["configuration","xml","schema-driven","logging"],"install":[{"cmd":"pip install zconfig","lang":"bash","label":"Install ZConfig"}],"dependencies":[],"imports":[{"symbol":"configureLoggers","correct":"from ZConfig import configureLoggers"},{"symbol":"loadSchema","correct":"from ZConfig import loadSchema"},{"symbol":"loadConfig","correct":"from ZConfig import loadConfig"}],"quickstart":{"code":"from ZConfig import configureLoggers\nimport logging\n\n# Define a simple ZConfig XML for logging\nlog_config = '''\n<logger>\n  level INFO\n  <logfile>\n    PATH STDOUT\n    format %(levelname)s %(name)s %(message)s\n  </logfile>\n</logger>\n'''\n\n# Configure the Python logging framework using ZConfig\nconfigureLoggers(log_config)\n\n# Get a logger and test it\nlogger = logging.getLogger()\nlogger.info('An info message')\nlogger.debug('A debug message') # This will not show as level is INFO","lang":"python","description":"This quickstart demonstrates how to configure Python's logging framework using ZConfig's `configureLoggers` function. It takes an XML string defining the logging setup, including log level and output destination (STDOUT in this case)."},"warnings":[{"fix":"Ensure your Python environment meets the `requires_python` specification of the ZConfig version you intend to install. Upgrade Python or pin an older ZConfig version if necessary.","message":"ZConfig versions frequently drop support for older Python versions. For example, version 4.0 dropped Python 2.7, 3.5, 3.6; version 4.2 dropped 3.7, 3.8; and version 4.3 dropped 3.9. Always check `requires_python` on PyPI for compatibility.","severity":"breaking","affected_versions":"4.0, 4.2, 4.3 and later"},{"fix":"For ZConfig versions 3.5 and newer, ensure all schema components are properly packaged as Python modules (e.g., with `__init__.py` and `component.xml` in the expected location) and are importable by Python.","message":"Schema component loading underwent a significant change in version 3.5. Older versions searched directories, while 3.5+ strictly requires schema components to be located within Python packages and discoverable via standard import mechanisms (`component.xml` at package root).","severity":"breaking","affected_versions":"<3.5 vs. >=3.5"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Verify that the Python package containing the schema component is correctly installed and accessible on `PYTHONPATH`. Ensure `component.xml` is present at the root of the specified Python package.","cause":"ZConfig could not find the specified schema component. This typically happens if the `component.xml` file is not in the correct Python package location or the package itself is not discoverable.","error":"ZConfig.ZConfigError: Could not locate component 'some.package.component_name'"},{"fix":"Pass a valid XML string containing the logging configuration to the `configureLoggers` function. For example: `configureLoggers('<logger>...</logger>')`.","cause":"The `configureLoggers` function was called without providing the XML configuration string as its argument.","error":"TypeError: configureLoggers() missing 1 required positional argument: 'config'"},{"fix":"Carefully review the XML configuration or schema file for well-formedness. Check for unclosed tags, incorrect attributes, or other XML parsing issues. Refer to ZConfig documentation for correct schema syntax.","cause":"The provided XML schema or configuration file has a syntax error or does not conform to the expected ZConfig XML structure.","error":"ZConfig.ZConfigError: Invalid configuration format: syntax error at line X, column Y"},{"fix":"Upgrade your Python environment to version 3.10 or higher. Alternatively, install an older version of `zconfig` that is compatible with your current Python version, e.g., `pip install 'zconfig<4.0'`.","cause":"You are attempting to install `zconfig` version 4.3 (or a similar recent version) using a Python interpreter that does not meet its minimum version requirement.","error":"ERROR: Package 'zconfig' requires Python '>=3.10' but the running Python is '3.9.x'"}]}