config-formatter


Nameconfig-formatter JSON
Version 1.2.0 PyPI version JSON
download
home_pagehttps://github.com/Delgan/config-formatter
SummaryAn automatic formatter for .ini and .cfg configuration files
upload_time2023-11-18 18:02:02
maintainer
docs_urlNone
authorDelgan
requires_python>=3.6
licenseMIT
keywords config formatter ini cfg configuration configparser
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # config-formatter

[![Pypi version](https://img.shields.io/pypi/v/config-formatter.svg)](https://pypi.python.org/pypi/config-formatter) [![Python version](https://img.shields.io/badge/python-3.6%2B-blue.svg)](https://pypi.python.org/pypi/config-formatter) [![Build status](https://img.shields.io/github/actions/workflow/status/Delgan/config-formatter/tests.yml?branch=main)](https://github.com/Delgan/config-formatter/actions/workflows/tests.yml?query=branch:main) [![License](https://img.shields.io/github/license/delgan/config-formatter.svg)](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.
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Delgan/config-formatter",
    "name": "config-formatter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "config,formatter,ini,cfg,configuration,configparser",
    "author": "Delgan",
    "author_email": "delgan.py@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/2a/40/88acdae15b4a404e9788f27604d6289b6c4024527538566242ded89b5855/config-formatter-1.2.0.tar.gz",
    "platform": null,
    "description": "# config-formatter\n\n[![Pypi version](https://img.shields.io/pypi/v/config-formatter.svg)](https://pypi.python.org/pypi/config-formatter) [![Python version](https://img.shields.io/badge/python-3.6%2B-blue.svg)](https://pypi.python.org/pypi/config-formatter) [![Build status](https://img.shields.io/github/actions/workflow/status/Delgan/config-formatter/tests.yml?branch=main)](https://github.com/Delgan/config-formatter/actions/workflows/tests.yml?query=branch:main) [![License](https://img.shields.io/github/license/delgan/config-formatter.svg)](https://github.com/Delgan/config-formatter/blob/main/LICENSE)\n\nAn automatic formatter for .ini and .cfg configuration files.\n\n\n## Installation\n\n```shell\npip install config-formatter\n```\n\n## Usage\n\n```python\nfrom config_formatter import ConfigFormatter\n\nwith open(\"config.ini\", \"r\") as file:\n    formatter = ConfigFormatter()\n    formatted = formatter.prettify(file.read())\n    print(formatted)\n```\n\n## Example\n\nBefore:\n\n```ini\n[main]        # Comments are preserved.\n\n    # Error-prone indentation is removed.\n    [section1]\n    key1: value1\n    key2=value2  # Value assignment is normalized.\n\n\n[section2]\nlists =\n are\n indented\n# including\n comments\n\nmultiline =    text that spans\n on several lines\n      is properly aligned.\n```\n\nAfter:\n\n```ini\n[main]  # Comments are preserved.\n\n# Error-prone indentation is removed.\n[section1]\nkey1 = value1\nkey2 = value2  # Value assignment is normalized.\n\n[section2]\nlists =\n    are\n    indented\n    # including\n    comments\n\nmultiline = text that spans\n            on several lines\n            is properly aligned.\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An automatic formatter for .ini and .cfg configuration files",
    "version": "1.2.0",
    "project_urls": {
        "Changelog": "https://github.com/Delgan/config-formatter/blob/main/CHANGELOG.md",
        "Homepage": "https://github.com/Delgan/config-formatter"
    },
    "split_keywords": [
        "config",
        "formatter",
        "ini",
        "cfg",
        "configuration",
        "configparser"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "231edbb182fc6c77034882814839fdd1c8690118baf1b93abbc39ddaa563e5ed",
                "md5": "f55abcc81be4c550b5ec952b22654613",
                "sha256": "1c47509295cead4f5b965e0462b946079ef0527d9bcdf3a9ce17d6d2e9e4907d"
            },
            "downloads": -1,
            "filename": "config_formatter-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f55abcc81be4c550b5ec952b22654613",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4560,
            "upload_time": "2023-11-18T18:02:00",
            "upload_time_iso_8601": "2023-11-18T18:02:00.251348Z",
            "url": "https://files.pythonhosted.org/packages/23/1e/dbb182fc6c77034882814839fdd1c8690118baf1b93abbc39ddaa563e5ed/config_formatter-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2a4088acdae15b4a404e9788f27604d6289b6c4024527538566242ded89b5855",
                "md5": "f30362bf3b3809184fb9ab96cb5f8923",
                "sha256": "b866434300b1141ca820a6e25a4ae6c089b997720bea7ac13d8422bf7125fb99"
            },
            "downloads": -1,
            "filename": "config-formatter-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f30362bf3b3809184fb9ab96cb5f8923",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 8157,
            "upload_time": "2023-11-18T18:02:02",
            "upload_time_iso_8601": "2023-11-18T18:02:02.195953Z",
            "url": "https://files.pythonhosted.org/packages/2a/40/88acdae15b4a404e9788f27604d6289b6c4024527538566242ded89b5855/config-formatter-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-18 18:02:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Delgan",
    "github_project": "config-formatter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "config-formatter"
}
        
Elapsed time: 0.40889s