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 |
|---|---|---|---|---|---|
configparser |
❌ | 🟢 | ✅ | ✅ | ✅ |
ConfigObj |
✅ | 🔴 | 🐛 | ❌ | ❌ |
python-ini |
❌ | ❓ | ❓ | ✅ | ❓ |
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.4.tar.gz
(9.5 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
File details
Details for the file simplini-0.0.4.tar.gz.
File metadata
- Download URL: simplini-0.0.4.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cf159ee7408f8ed6705f0655d120a9cb3e3863f9b690376e659fd0b64f9ad2d
|
|
| MD5 |
0073b1a01cbb27298238fb33e41febe5
|
|
| BLAKE2b-256 |
24fc2e7ca206c77b6a67bf60a564d474ef528721632e9e366788f46a96e77c36
|
File details
Details for the file simplini-0.0.4-py3-none-any.whl.
File metadata
- Download URL: simplini-0.0.4-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e22cd0a3ac8bb6e0c6a040af553f96f8af4f2a05ba09a07a08579a27d4f2c25
|
|
| MD5 |
a805464ada9ec06a35e2e28e1462d0d0
|
|
| BLAKE2b-256 |
2be6340b3fae686b86229b905c359b13ef71adca1b1ebb52cb89e4fcf25338a6
|