Name | pypformat JSON |
Version |
1.1.2
JSON |
| download |
home_page | None |
Summary | Python pretty formatting package |
upload_time | 2024-12-31 12:26:24 |
maintainer | None |
docs_url | None |
author | SpectraL519 |
requires_python | >=3.9 |
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. |
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 the [PyPformat - Usage](https://github.com/SpectraL519/pypformat/tree/76ae00f2c20df2911e04d8f6b12e81bb9ba192b1/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/tree/76ae00f2c20df2911e04d8f6b12e81bb9ba192b1/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/tree/76ae00f2c20df2911e04d8f6b12e81bb9ba192b1/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/tree/76ae00f2c20df2911e04d8f6b12e81bb9ba192b1/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/93/39/2b17e782693ed9682a0ded791348b495af87f81dff4bca0f25782a262929/pypformat-1.1.2.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 the [PyPformat - Usage](https://github.com/SpectraL519/pypformat/tree/76ae00f2c20df2911e04d8f6b12e81bb9ba192b1/docs/usage.md) document.\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/tree/76ae00f2c20df2911e04d8f6b12e81bb9ba192b1/docs/todo.md) document.\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/tree/76ae00f2c20df2911e04d8f6b12e81bb9ba192b1/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/tree/76ae00f2c20df2911e04d8f6b12e81bb9ba192b1/LICENSE) file in the project's root directory.\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 Jakub Musia\u0142 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. ",
"summary": "Python pretty formatting package",
"version": "1.1.2",
"project_urls": {
"Repository": "https://github.com/SpectraL519/pypformat.git"
},
"split_keywords": [
"string",
" format",
" formatting",
" pretty",
" print"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1eec61d3a6767e2c69890bc3b93c1940e043aa07fa0fc087299d901ea3049c58",
"md5": "7bccf4e52ad6a3c6ec676b6f7fbd0f02",
"sha256": "2199e291196ad0b75fed539d5cfd583811993b8aee1e83a91aeabe9312872993"
},
"downloads": -1,
"filename": "pypformat-1.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7bccf4e52ad6a3c6ec676b6f7fbd0f02",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 11996,
"upload_time": "2024-12-31T12:26:20",
"upload_time_iso_8601": "2024-12-31T12:26:20.082120Z",
"url": "https://files.pythonhosted.org/packages/1e/ec/61d3a6767e2c69890bc3b93c1940e043aa07fa0fc087299d901ea3049c58/pypformat-1.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "93392b17e782693ed9682a0ded791348b495af87f81dff4bca0f25782a262929",
"md5": "86ccb36190e33190c92802fe17bb2334",
"sha256": "84e0cfb1bc110f8233b02c30f1f406914a668e57f149569338701629dffb5927"
},
"downloads": -1,
"filename": "pypformat-1.1.2.tar.gz",
"has_sig": false,
"md5_digest": "86ccb36190e33190c92802fe17bb2334",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 18895,
"upload_time": "2024-12-31T12:26:24",
"upload_time_iso_8601": "2024-12-31T12:26:24.138986Z",
"url": "https://files.pythonhosted.org/packages/93/39/2b17e782693ed9682a0ded791348b495af87f81dff4bca0f25782a262929/pypformat-1.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-31 12:26:24",
"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"
}