An automatic formatter for .ini and .cfg configuration files
Project description
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.
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
config-formatter-1.0.1.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for config_formatter-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66357f8d7657962c033b769eb692552637a911ae29b8045e8f744f640ffdf0f5 |
|
MD5 | 4614784066c7ac5dca00239f7337e604 |
|
BLAKE2b-256 | eaeed35f88ec6795518643b904e772de47274c2578bd91e26e41d762da16c30b |