{ "info": { "author": "Philip Olson", "author_email": "philip.olson@pm.me", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7" ], "description": "# Pretty SimpleNamespace\n\n\n\n
\n\n\n\n**Table of Contents**\n\n- [What is it?](#what-is-it)\n- [Why create it?](#why-create-it)\n- [Simple usage](#simple-usage)\n- [Features](#features)\n- [Limitations](#limitations)\n- [Related projects](#related-projects)\n- [Api](#api)\n- [Test](#test)\n\n\n\n
\n\n### What is it?\n\n- A stringifier and formatter for SimpleNamespace which attempts to make the\n data as readable as possible.\n\n
\n\n### Why create it?\n\n- I use SimpleNamespace often to hold state and needed a way to print it out for\n debugging purposes.\n\n
\n\n### Simple usage\n\n```py\nfrom pretty_simple_namespace import pprint\nfrom types import SimpleNamespace as o\n\njoe = o(\n name={\"first\": \"joe\", \"last\": \"schmo\"},\n age=30,\n favoriteFoods=[\"apples\", \"steak\"],\n)\n\npprint(joe)\n# prints\n# {\n# name: {\n# first: 'joe'\n# last: 'schmo'\n# }\n# age: 30\n# favoriteFoods: [\n# 'apples'\n# 'steak'\n# ]\n# }\n```\n\n
\n\n### Features\n- handles recursive structures by tracking and printing references nicely\n- recurses into types `list`, `dict` and `SimpleNamespace` for now\n- has special-case printing for types `bool`, `str`, `callable` and `None`\n - booleans and None are printed lowercase\n - strings are wrapped in single quotes\n - callable appends `()` e.g. `myMethod()`. Arguments aren't represented\n- all other types are printed by wrapping it in `str` e.g. `str(userDefinedType)`\n\n
\n\n### Limitations\n- multi-line strings look ugly\n- doesn't have a way to recurse into structures other than what's listed above\n\n
\n\n### Related projects\n\n- [tedent](https://github.com/olsonpm/py_tedent)\n\n
\n\n### Api\n\n#### format(something, indent=2) => str\n- formats `something` to a string as seen in [Simple usage](#simple-usage)\n\n#### pprint(something, indent=2) => None\n- just prints the formated `something`\n\n#### wrapWith(\\*, indent) => [Wrapped module](#wrapped-module)\n- use this when you want to call `format` or `pprint` with a different default\n indent value so you don't have to pass it manually all the time.\n\n e.g.\n ```py\n from pretty_simple_namespace import wrapWith\n\n pprint = wrapWith(indent=4).pprint\n pprint(o(tabbed4spaces=True))\n # {\n # tabbed4spaces: true\n # }\n ```\n\n#### Wrapped module\n- just an instance of SimpleNamespace with two attributes `format` and `pprint`.\n\n
\n\n### Test\n\n```sh\n#\n# you must have poetry installed\n#\n$ poetry shell\n$ poetry install\n$ python runTests.py\n```\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/olsonpm/py_pretty-simple-namespace", "keywords": "", "license": "", "maintainer": "Philip Olson", "maintainer_email": "philip.olson@pm.me", "name": "pretty-simple-namespace", "package_url": "https://pypi.org/project/pretty-simple-namespace/", "platform": "", "project_url": "https://pypi.org/project/pretty-simple-namespace/", "project_urls": { "Homepage": "https://github.com/olsonpm/py_pretty-simple-namespace", "Repository": "https://github.com/olsonpm/py_pretty-simple-namespace" }, "release_url": "https://pypi.org/project/pretty-simple-namespace/0.1.1/", "requires_dist": null, "requires_python": ">=3.7,<4.0", "summary": "A pretty printer for SimpleNamespace", "version": "0.1.1" }, "last_serial": 5289546, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "0813c1bbc673e70e28a3d9cdfbd76e2a", "sha256": "e14a2bd752dd866f5cc1b0d1882272d32f589852e78302a7f40a4c67c6f7a06f" }, "downloads": -1, "filename": "pretty_simple_namespace-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "0813c1bbc673e70e28a3d9cdfbd76e2a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 41127, "upload_time": "2019-01-21T21:15:48", "url": "https://files.pythonhosted.org/packages/43/56/6b4404464d43e9c0ead712a17cd3b18849d3f4ca663da14626832fe3177d/pretty_simple_namespace-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "933a30cea9907c492b77099259638ad2", "sha256": "56b18a978bb5538d259f3fd10680dec04ddfe8bb59b216af61eaf45ed9598a19" }, "downloads": -1, "filename": "pretty_simple_namespace-0.1.0.tar.gz", "has_sig": false, "md5_digest": "933a30cea9907c492b77099259638ad2", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 12833, "upload_time": "2019-01-21T21:15:50", "url": "https://files.pythonhosted.org/packages/da/a9/2b21f1954c7c161231b31b1702f698ddcc85ab7be6e0858e468e940f78d0/pretty_simple_namespace-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "c3d1d72716c1debc3799b1070e8a56e9", "sha256": "17cb165fa3a3e55605c6f3204bf077d62fc53a7005afe2de3cb9c4ed6c2718a5" }, "downloads": -1, "filename": "pretty_simple_namespace-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c3d1d72716c1debc3799b1070e8a56e9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 1102091, "upload_time": "2019-05-19T20:45:43", "url": "https://files.pythonhosted.org/packages/b2/8c/461c20ac66fe60e912985ec578fe9cebad62033198e559482d6fc6311ba7/pretty_simple_namespace-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "efb4f8fc0f391588fad309f74f2e5c47", "sha256": "7579dcb10091defe84d3702aa0680b8ccf4ee00f93e8b0bf85195a7b93aef4af" }, "downloads": -1, "filename": "pretty_simple_namespace-0.1.1.tar.gz", "has_sig": false, "md5_digest": "efb4f8fc0f391588fad309f74f2e5c47", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 914418, "upload_time": "2019-05-19T20:45:46", "url": "https://files.pythonhosted.org/packages/1e/df/54830ecc0bc254b7a53e160f734fcad933a69c901c42cadaca71892c5369/pretty_simple_namespace-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c3d1d72716c1debc3799b1070e8a56e9", "sha256": "17cb165fa3a3e55605c6f3204bf077d62fc53a7005afe2de3cb9c4ed6c2718a5" }, "downloads": -1, "filename": "pretty_simple_namespace-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c3d1d72716c1debc3799b1070e8a56e9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 1102091, "upload_time": "2019-05-19T20:45:43", "url": "https://files.pythonhosted.org/packages/b2/8c/461c20ac66fe60e912985ec578fe9cebad62033198e559482d6fc6311ba7/pretty_simple_namespace-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "efb4f8fc0f391588fad309f74f2e5c47", "sha256": "7579dcb10091defe84d3702aa0680b8ccf4ee00f93e8b0bf85195a7b93aef4af" }, "downloads": -1, "filename": "pretty_simple_namespace-0.1.1.tar.gz", "has_sig": false, "md5_digest": "efb4f8fc0f391588fad309f74f2e5c47", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 914418, "upload_time": "2019-05-19T20:45:46", "url": "https://files.pythonhosted.org/packages/1e/df/54830ecc0bc254b7a53e160f734fcad933a69c901c42cadaca71892c5369/pretty_simple_namespace-0.1.1.tar.gz" } ] }