Skip to main content

iniconfig: brain-dead simple parsing of ini files

iniconfig is a small and simple INI-file parser module having a unique set of features:

  • tested against Python2.4 across to Python3.2, Jython, PyPy

  • maintains order of sections and entries

  • supports multi-line values with or without line-continuations

  • supports “#” comments everywhere

  • raises errors with proper line-numbers

  • no bells and whistles like automatic substitutions

  • iniconfig raises an Error if two sections have the same name.

If you encounter issues or have feature wishes please report them to:

http://github.com/RonnyPfannschmidt/iniconfig/issues

Basic Example

If you have an ini file like this:

# content of example.ini
[section1] # comment
name1=value1  # comment
name1b=value1,value2  # comment

[section2]
name2=
    line1
    line2

then you can do:

>>> import iniconfig
>>> ini = iniconfig.IniConfig("example.ini")
>>> ini['section1']['name1'] # raises KeyError if not exists
'value1'
>>> ini.get('section1', 'name1b', [], lambda x: x.split(","))
['value1', 'value2']
>>> ini.get('section1', 'notexist', [], lambda x: x.split(","))
[]
>>> [x.name for x in list(ini)]
['section1', 'section2']
>>> list(list(ini)[0].items())
[('name1', 'value1'), ('name1b', 'value1,value2')]
>>> 'section1' in ini
True
>>> 'inexistendsection' in ini
False

Metadata

Release files for iniconfig 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iniconfig 1.1.1
File Size Uploaded Provenance Actions
iniconfig-1.1.1.tar.gz 8.1 kB Without provenance Details for iniconfig-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for iniconfig 1.1.1
File Interpreter ABI Platform Actions
iniconfig-1.1.1-py2.py3-none-any.whl Python 3, Python 2 none any Details for iniconfig-1.1.1-py2.py3-none-any.whl

Total release size: 13.1 kB

Release files / iniconfig-1.1.1.tar.gz

Download URL iniconfig-1.1.1.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32
BLAKE2b-256 checksum
How to use checksums
23a297899f6bd0e873fed3a7e67ae8d3a08b21799430fb4da15cfedf10d6e2c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/2.7.15

Release files / iniconfig-1.1.1-py2.py3-none-any.whl

Download URL iniconfig-1.1.1-py2.py3-none-any.whl
Size 5.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3
BLAKE2b-256 checksum
How to use checksums
9bddb3c12c6d707058fa947864b67f0c4e0c39ef8610988d7baea9578f3c48f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.5

Security for iniconfig 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page