iniconfig is a minimal, read-only INI-file parser maintained under the pytest-dev umbrella. It preserves section and key order, supports multi-line values, strips `#` comments from structure (not inline values in <2.3), raises `ParseError` with accurate line numbers, and rejects duplicate section names. Current stable version is 2.3.0, released 2024. Release cadence is irregular but healthy, driven by pytest ecosystem needs.
pip install iniconfigVerified import paths — ran on the pinned version, not inferred.
Parse an INI config from a string, access values, use .get() for safe access with a default and optional converter.
Use iniconfig==1.1.1 for Python < 3.10 environments, or upgrade the interpreter.
Ensure each section name appears exactly once in the INI source before parsing.
Use IniConfig.parse() (added in 2.3.0) which does strip inline comments, or strip manually: value.split('#')[0].strip().Use ini.get(section, key, default) instead of direct bracket access for any optional key.
Use stdlib configparser or a different library (e.g. configupdater) if you need to write or round-trip INI files.
Replace `py.iniconfig` with `import iniconfig` and `iniconfig.IniConfig(...)`.
Always supply a non-None path: `IniConfig('-', data=my_string)`.No dependency data recorded yet.