pypformat


Namepypformat JSON
Version 1.2.3 PyPI version JSON
download
home_pageNone
SummaryPython pretty formatting package
upload_time2025-07-26 11:24:38
maintainerNone
docs_urlNone
authorSpectraL519
requires_python>=3.9
licenseNone
keywords string format formatting pretty print
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyPformat

[![tests](https://github.com/SpectraL519/pypformat/actions/workflows/tests.yaml/badge.svg)](https://github.com/SpectraL519/pypformat/actions/workflows/tests)
[![examples](https://github.com/SpectraL519/pypformat/actions/workflows/examples.yaml/badge.svg)](https://github.com/SpectraL519/pypformat/actions/workflows/examples)
[![ruff - linter & formatter](https://github.com/SpectraL519/pypformat/actions/workflows/ruff.yaml/badge.svg)](https://github.com/SpectraL519/pypformat/actions/workflows/ruff)
[![coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/SpectraL519/60ba7283e412ea91cd2db2b3b649003d/raw/pypf_covbadge.json)]()

<br />

## Overview

`PyPformat` is a simple and highly customizable python pretty-formatting package designed as an alternative to the built-in [pprint library](https://docs.python.org/3/library/pprint.html) - `PyPformat` uses a different, more natural formatting style and provides extensive personalization capabilities, including text colorizing or customized indentation marking, on top of the basic options like compact printing.

<br />

The example below demostrates the difference in the **default** outputs produced by the `pprint` and `PyPformat` libraries.

```txt
>>> from pprint import pprint
>>> import pformat as pf
>>>
>>> from collections import ChainMap, Counter, OrderedDict, UserDict, defaultdict
>>>
>>> mapping = {
...     "key1": 1,
...     "key2": OrderedDict({"key3": 3, "key4": 4}),
...     "key5": defaultdict(
...         str,
...         {
...             "key6": 6,
...             "a_very_long_dictionary_key7": ChainMap(
...                 {"key10": [10, 11, 12, 13], "key8": 8, "key9": 9}
...             ),
...             "key11": Counter("Hello"),
...         },
...     ),
...     "key12": UserDict({0: "a", 1: "b", 2: "c"}),
... }
>>>
>>> pprint(mapping)
{'key1': 1,
 'key12': {0: 'a', 1: 'b', 2: 'c'},
 'key2': OrderedDict({'key3': 3, 'key4': 4}),
 'key5': defaultdict(<class 'str'>,
                     {'a_very_long_dictionary_key7': ChainMap({'key10': [10,
                                                                         11,
                                                                         12,
                                                                         13],
                                                               'key8': 8,
                                                               'key9': 9}),
                      'key11': Counter({'l': 2, 'H': 1, 'e': 1, 'o': 1}),
                      'key6': 6})}
>>>
>>> formatter = pf.PrettyFormatter()
>>> print(formatter(mapping))
{
    'key1': 1,
    'key2': OrderedDict({
        'key3': 3,
        'key4': 4,
    }),
    'key5': defaultdict(<class 'str'>, {
        'key6': 6,
        'a_very_long_dictionary_key7': ChainMap({
            'key10': [
                10,
                11,
                12,
                13,
            ],
            'key8': 8,
            'key9': 9,
        }),
        'key11': Counter({
            'H': 1,
            'e': 1,
            'l': 2,
            'o': 1,
        }),
    }),
    'key12': {
        0: 'a',
        1: 'b',
        2: 'c',
    },
}
```

> [!IMPORTANT]
>
> - The minimum (tested) python version required to use the `PyPformat` package is **3.9**.
> - The complete functionality of the `PyPformat` package (including all format configuration options) is described in [PyPformat - Usage](https://github.com/SpectraL519/pypformat/blob/v1.2.3/docs/usage.md) and [PyPformat - Utility](https://github.com/SpectraL519/pypformat/blob/v1.2.3/docs/utility.md) documents.
> - While the `PyPformat` package is already quite versatile and customizable, its development is ongoing. A detailed list of the planned features/improvements can be found in the [PyPformat - TODO](https://github.com/SpectraL519/pypformat/blob/v1.2.3/docs/todo.md) document (please note that this list is not fixed and may be expanded).

<br />
<br />

## Installation

The `PyPformat` package can be installed via pip:

```shell
pip install pypformat
```

<br />
<br />

## For Developers

The [PyPformat - Dev notes](https://github.com/SpectraL519/pypformat/blob/v1.2.3/docs/dev_notes.md) document contains the information about project development, testing and formatting.

<br />
<br />

## Licence

The `PyPformat` project is licenced under the [MIT Licence](https://opensource.org/license/mit/), which can be inspected in the [LICENCE](https://github.com/SpectraL519/pypformat/blob/v1.2.3/LICENSE) file in the project's root directory.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pypformat",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "string, format, formatting, pretty, print",
    "author": "SpectraL519",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/2c/4b/ae777602f77d993b9dbe02d59141a8c801273b7ae1bb28e4cca10b38e69c/pypformat-1.2.3.tar.gz",
    "platform": null,
    "description": "# PyPformat\n\n[![tests](https://github.com/SpectraL519/pypformat/actions/workflows/tests.yaml/badge.svg)](https://github.com/SpectraL519/pypformat/actions/workflows/tests)\n[![examples](https://github.com/SpectraL519/pypformat/actions/workflows/examples.yaml/badge.svg)](https://github.com/SpectraL519/pypformat/actions/workflows/examples)\n[![ruff - linter & formatter](https://github.com/SpectraL519/pypformat/actions/workflows/ruff.yaml/badge.svg)](https://github.com/SpectraL519/pypformat/actions/workflows/ruff)\n[![coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/SpectraL519/60ba7283e412ea91cd2db2b3b649003d/raw/pypf_covbadge.json)]()\n\n<br />\n\n## Overview\n\n`PyPformat` is a simple and highly customizable python pretty-formatting package designed as an alternative to the built-in [pprint library](https://docs.python.org/3/library/pprint.html) - `PyPformat` uses a different, more natural formatting style and provides extensive personalization capabilities, including text colorizing or customized indentation marking, on top of the basic options like compact printing.\n\n<br />\n\nThe example below demostrates the difference in the **default** outputs produced by the `pprint` and `PyPformat` libraries.\n\n```txt\n>>> from pprint import pprint\n>>> import pformat as pf\n>>>\n>>> from collections import ChainMap, Counter, OrderedDict, UserDict, defaultdict\n>>>\n>>> mapping = {\n...     \"key1\": 1,\n...     \"key2\": OrderedDict({\"key3\": 3, \"key4\": 4}),\n...     \"key5\": defaultdict(\n...         str,\n...         {\n...             \"key6\": 6,\n...             \"a_very_long_dictionary_key7\": ChainMap(\n...                 {\"key10\": [10, 11, 12, 13], \"key8\": 8, \"key9\": 9}\n...             ),\n...             \"key11\": Counter(\"Hello\"),\n...         },\n...     ),\n...     \"key12\": UserDict({0: \"a\", 1: \"b\", 2: \"c\"}),\n... }\n>>>\n>>> pprint(mapping)\n{'key1': 1,\n 'key12': {0: 'a', 1: 'b', 2: 'c'},\n 'key2': OrderedDict({'key3': 3, 'key4': 4}),\n 'key5': defaultdict(<class 'str'>,\n                     {'a_very_long_dictionary_key7': ChainMap({'key10': [10,\n                                                                         11,\n                                                                         12,\n                                                                         13],\n                                                               'key8': 8,\n                                                               'key9': 9}),\n                      'key11': Counter({'l': 2, 'H': 1, 'e': 1, 'o': 1}),\n                      'key6': 6})}\n>>>\n>>> formatter = pf.PrettyFormatter()\n>>> print(formatter(mapping))\n{\n    'key1': 1,\n    'key2': OrderedDict({\n        'key3': 3,\n        'key4': 4,\n    }),\n    'key5': defaultdict(<class 'str'>, {\n        'key6': 6,\n        'a_very_long_dictionary_key7': ChainMap({\n            'key10': [\n                10,\n                11,\n                12,\n                13,\n            ],\n            'key8': 8,\n            'key9': 9,\n        }),\n        'key11': Counter({\n            'H': 1,\n            'e': 1,\n            'l': 2,\n            'o': 1,\n        }),\n    }),\n    'key12': {\n        0: 'a',\n        1: 'b',\n        2: 'c',\n    },\n}\n```\n\n> [!IMPORTANT]\n>\n> - The minimum (tested) python version required to use the `PyPformat` package is **3.9**.\n> - The complete functionality of the `PyPformat` package (including all format configuration options) is described in [PyPformat - Usage](https://github.com/SpectraL519/pypformat/blob/v1.2.3/docs/usage.md) and [PyPformat - Utility](https://github.com/SpectraL519/pypformat/blob/v1.2.3/docs/utility.md) documents.\n> - While the `PyPformat` package is already quite versatile and customizable, its development is ongoing. A detailed list of the planned features/improvements can be found in the [PyPformat - TODO](https://github.com/SpectraL519/pypformat/blob/v1.2.3/docs/todo.md) document (please note that this list is not fixed and may be expanded).\n\n<br />\n<br />\n\n## Installation\n\nThe `PyPformat` package can be installed via pip:\n\n```shell\npip install pypformat\n```\n\n<br />\n<br />\n\n## For Developers\n\nThe [PyPformat - Dev notes](https://github.com/SpectraL519/pypformat/blob/v1.2.3/docs/dev_notes.md) document contains the information about project development, testing and formatting.\n\n<br />\n<br />\n\n## Licence\n\nThe `PyPformat` project is licenced under the [MIT Licence](https://opensource.org/license/mit/), which can be inspected in the [LICENCE](https://github.com/SpectraL519/pypformat/blob/v1.2.3/LICENSE) file in the project's root directory.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python pretty formatting package",
    "version": "1.2.3",
    "project_urls": {
        "Repository": "https://github.com/SpectraL519/pypformat.git"
    },
    "split_keywords": [
        "string",
        " format",
        " formatting",
        " pretty",
        " print"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8649bb323ee5dfda0d9925cb1a70b71b7299b5a49404770a33c44fecbf7d7ac2",
                "md5": "8adb90af1cba325740a110b2202d1fdb",
                "sha256": "03ab8bc2f71d5e6567bdecf4c8b44777fdd531af27fb0abea53c59a99c658f95"
            },
            "downloads": -1,
            "filename": "pypformat-1.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8adb90af1cba325740a110b2202d1fdb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 11998,
            "upload_time": "2025-07-26T11:24:37",
            "upload_time_iso_8601": "2025-07-26T11:24:37.808404Z",
            "url": "https://files.pythonhosted.org/packages/86/49/bb323ee5dfda0d9925cb1a70b71b7299b5a49404770a33c44fecbf7d7ac2/pypformat-1.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2c4bae777602f77d993b9dbe02d59141a8c801273b7ae1bb28e4cca10b38e69c",
                "md5": "dd426cd41250f7bc8de16472e6cad751",
                "sha256": "de791a67c9209b46ff0259f8048b5ac11405a4f95a53c9e12b0bc39848c05e1f"
            },
            "downloads": -1,
            "filename": "pypformat-1.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "dd426cd41250f7bc8de16472e6cad751",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 18677,
            "upload_time": "2025-07-26T11:24:38",
            "upload_time_iso_8601": "2025-07-26T11:24:38.884544Z",
            "url": "https://files.pythonhosted.org/packages/2c/4b/ae777602f77d993b9dbe02d59141a8c801273b7ae1bb28e4cca10b38e69c/pypformat-1.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-26 11:24:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SpectraL519",
    "github_project": "pypformat",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "pypformat"
}
        
Elapsed time: 1.27259s