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.1.0.tar.gz
(6.9 kB
view hashes)
Built Distribution
Close
Hashes for config_formatter-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9a569e872c236ef438ef0eafe639a19414202a2a8f02ae80d1b4d95917e77d1 |
|
MD5 | c2f8db872a4192c3234a4eb438595cf8 |
|
BLAKE2b-256 | 17df2349904bfb08aaee17a934e72364064dabe933ce797e2672a241e23896fe |