Metadata-Version: 2.1
Name: pypformat
Version: 1.1.1
Summary: Python pretty formatting package
Author: SpectraL519
License: MIT License
        
        Copyright (c) 2024 Jakub Musiał
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Repository, https://github.com/SpectraL519/pypformat.git
Keywords: string,format,formatting,pretty,print
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
License-File: LICENSE
Requires-Dist: colored==2.2.*
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: tox; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: icecream; extra == "dev"

# 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, OrderedDict, 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}
...             ),
...         },
...     ),
... }
>>>
>>> pprint(mapping)
{'key1': 1,
 '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}),
                      '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,
        }),
    }),
}
```

> [!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 the [PyPformat - Usage](https://github.com/SpectraL519/pypformat/commit/1b4c0168af545d5dda2819a3a8372c3dd70dca0b/docs/usage.md) document.
> - 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/commit/1b4c0168af545d5dda2819a3a8372c3dd70dca0b/docs/todo.md) document.

<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/commit/1b4c0168af545d5dda2819a3a8372c3dd70dca0b/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/commit/1b4c0168af545d5dda2819a3a8372c3dd70dca0b/LICENSE) file in the project's root directory.
