Skip to main content

An automatic formatter for .ini and .cfg configuration files

Project description

config-formatter

Pypi version Python version Build status License

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


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.2.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

config_formatter-1.2.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file config-formatter-1.2.0.tar.gz.

File metadata

  • Download URL: config-formatter-1.2.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for config-formatter-1.2.0.tar.gz
Algorithm Hash digest
SHA256 b866434300b1141ca820a6e25a4ae6c089b997720bea7ac13d8422bf7125fb99
MD5 f30362bf3b3809184fb9ab96cb5f8923
BLAKE2b-256 2a4088acdae15b4a404e9788f27604d6289b6c4024527538566242ded89b5855

See more details on using hashes here.

File details

Details for the file config_formatter-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for config_formatter-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c47509295cead4f5b965e0462b946079ef0527d9bcdf3a9ce17d6d2e9e4907d
MD5 f55abcc81be4c550b5ec952b22654613
BLAKE2b-256 231edbb182fc6c77034882814839fdd1c8690118baf1b93abbc39ddaa563e5ed

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page