config-formatter
An automatic formatter for .ini and .cfg configuration files.
Installation
pip install config-formatter
Usage
from config_formatter import ConfigFormatter
with open("config.ini", "r") as file:
formatter = ConfigFormatter()
formatted = formatter.prettify(file.read())
print(formatted)
Example
Before:
[main] # Comments are preserved.
# Error-prone indentation is removed.
[section1]
key1: value1
key2=value2 # Value assignment is normalized.
[section2]
lists =
are
indented
# including
comments
multiline = text that spans
on several lines
is properly aligned.
After:
[main] # Comments are preserved.
# Error-prone indentation is removed.
[section1]
key1 = value1
key2 = value2 # Value assignment is normalized.
[section2]
lists =
are
indented
# including
comments
multiline = text that spans
on several lines
is properly aligned.
Metadata
Release files for config-formatter 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| config-formatter-1.2.0.tar.gz | 8.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| config_formatter-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.7 kB
Release files / config-formatter-1.2.0.tar.gz
| Download URL | config-formatter-1.2.0.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b866434300b1141ca820a6e25a4ae6c089b997720bea7ac13d8422bf7125fb99
|
|
BLAKE2b-256 checksum How to use checksums |
2a4088acdae15b4a404e9788f27604d6289b6c4024527538566242ded89b5855
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / config_formatter-1.2.0-py3-none-any.whl
| Download URL | config_formatter-1.2.0-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c47509295cead4f5b965e0462b946079ef0527d9bcdf3a9ce17d6d2e9e4907d
|
|
BLAKE2b-256 checksum How to use checksums |
231edbb182fc6c77034882814839fdd1c8690118baf1b93abbc39ddaa563e5ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|