A simple INI file parser/writer
Project description
A simple INI file parser and writer for Python that works.
Installation
pip install simplini
Why?
The reasons this library was created:
- Standard library configparser does not support round trip editing (comments will not be written back), see https://docs.python.org/3/library/configparser.html
- Alternatives like https://github.com/DiffSK/configobj have a lot of bugs and are not actively maintained
Comparison
| Library | Round-trip editing | Maintenance | Correctness | Configurability | Multi-line values | Error reporting |
|---|---|---|---|---|---|---|
configparser |
❌ | 🟢 | ✅ | ✅ | ✅ | 🙂 |
ConfigObj |
✅ | 🔴 | 🐛 | ❌ | ❌ | 🤔 |
python-ini |
❌ | ❓ | ❓ | ✅ | ❓ | 🙁 |
ini-parser |
✅ | ❓ | 🐛 | ❌ | ❌ | 🙁 |
simplini |
✅ | 🟢 | ✅ | ✅ | ✅ | 🥰 |
Features
- Simple API
- Round-trip editing preserving comments
- Non-ambiguous strings encoding
- Configurable parsing and rendering behavior
- No surprises like sudden interpolation or lower-casing option names
Usage
Basic usage example:
from simplini import IniConfig
# Create a new INI config
config = IniConfig()
# Add values to the default section
config.unnamed_section.set("app_name", "My App")
config.unnamed_section.set("version", "1.0.0")
# Add a comment to the default section
config.unnamed_section.comment = ["Configuration for My App", "Created on 2025-09-28"]
# Save to file
config.save("config.ini")
# Load from file
loaded_config = IniConfig.load("config.ini")
app_name = loaded_config.unnamed_section["app_name"].value # "My App"
Example config file output:
# Configuration for My App
# Created on 2025-09-28
app_name = "My App"
version = "1.0.0"
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
simplini-0.0.11.tar.gz
(11.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
simplini-0.0.11-py3-none-any.whl
(10.5 kB
view details)
File details
Details for the file simplini-0.0.11.tar.gz.
File metadata
- Download URL: simplini-0.0.11.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4295ae8cd312372b8d37a7490be84786ade18bc635a7d4c214fca1396eb8444
|
|
| MD5 |
333e2ed1e13963f419d241a84a3e4de7
|
|
| BLAKE2b-256 |
9240501c357e55ec7d78b4dbcef10dab930f51bb4195cc9302790d8bdef8c3ad
|
File details
Details for the file simplini-0.0.11-py3-none-any.whl.
File metadata
- Download URL: simplini-0.0.11-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3ab9eab289b830c90cbc8e4e4d1cb44a4d6a76cc9f9c6129b68c489c9301c7f
|
|
| MD5 |
859e9c785c0410bc2b6a49f0435b040b
|
|
| BLAKE2b-256 |
dcb536e916c70a584f705566a7d8c66ad9242d2c1f2cb8140f660a24ab4327c0
|