config-formatter-1.1.0
توضیحات
An automatic formatter for .ini and .cfg configuration files
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | config-formatter-1.1.0 |
| نام | config-formatter |
| نسخه کتابخانه | 1.1.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Delgan |
| ایمیل نویسنده | delgan.py@gmail.com |
| آدرس صفحه اصلی | https://github.com/Delgan/config-formatter |
| آدرس اینترنتی | https://pypi.org/project/config-formatter/ |
| مجوز | MIT |
# config-formatter
[](https://pypi.python.org/pypi/config-formatter) [](https://pypi.python.org/pypi/config-formatter) [](https://github.com/Delgan/config-formatter/actions/workflows/tests.yml?query=branch:main) [](https://github.com/Delgan/config-formatter/blob/main/LICENSE)
An automatic formatter for .ini and .cfg configuration files.
## Installation
```shell
pip install config-formatter
```
## Usage
```python
from config_formatter import ConfigFormatter
with open("config.ini", "r") as file:
formatter = ConfigFormatter()
formatted = formatter.prettify(file.read())
print(formatted)
```
## Example
Before:
```ini
[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:
```ini
[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.
```
نیازمندی
| مقدار | نام |
|---|---|
| >=3.0 | configupdater |
| >=2.17.0 | pre-commit |
| >=6.0.0 | pytest |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl config-formatter-1.1.0:
pip install config-formatter-1.1.0.whl
نصب پکیج tar.gz config-formatter-1.1.0:
pip install config-formatter-1.1.0.tar.gz