PyHOCON is a Python parser for the HOCON (Human Optimized Config Object Notation) configuration format. It allows for reading, parsing, and manipulating HOCON configuration files and strings, including support for substitutions, includes, and various data types. The library is actively maintained with irregular but consistent minor releases, currently at version 0.3.63.
pip install pyhoconVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to parse HOCON configuration from both a string and a file using `ConfigFactory`. It also shows how to use environment variable substitutions and how to convert a parsed configuration back into a HOCON string using `HOCONConverter`.
Ensure your `pyparsing` dependency is compatible with `>=2,<4`. If conflicts arise, consider upgrading or downgrading `pyparsing` to fit `pyhocon`'s requirements, or using a virtual environment to manage dependencies.
If encountering unexpected substitution behavior, upgrade to the latest version of `pyhocon`. Thoroughly test your configurations, particularly those with complex substitutions or environment variable reliance, after upgrading.
Review any HOCON configurations using relative `include` directives after upgrading. Ensure that `pyhocon` can still locate the included files correctly. You might need to adjust relative paths or ensure the working directory is set appropriately for file resolution.
Install the package using pip: `pip install pyhocon` or `python -m pip install pyhocon`
Carefully review your HOCON configuration for syntax correctness, ensuring all brackets, braces, and quotes are properly matched and that string values are enclosed in double quotes as per HOCON specification.
Verify that the key path exists in your HOCON configuration. Use `config.get('your_config_key', default_value)` to provide a fallback, or check for key existence with `if 'your_config_key' in config:` before accessing.Ensure you have compatible versions of `pyhocon` and `pyparsing` installed. Upgrading `pyhocon` to the latest version, which often includes updates for `pyparsing` compatibility, or explicitly installing a known compatible `pyparsing` version (e.g., `pip install pyparsing<3`) can resolve this.
No dependency data recorded yet.