{ "info": { "author": "Mark Grandi", "author_email": "markgrandi@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# pretty-py3\n\nPython advanced pretty printer. This pretty printer is intended to\nreplace the old `pprint` python module which does not allow developers\nto provide their own pretty print callbacks.\n\nThis module is based on ruby's `prettyprint.rb` library by `Tanaka Akira`.\n\nThis was converted to python3 by `Mark Grandi` and others\n\n\n## Example Usage\n\n\nTo directly print the representation of an object use `pprint`:\n\n```\nfrom pretty import pprint\npprint(complex_object)\n```\n\nTo get a string of the output use `pretty`:\n\n```\nfrom pretty import pretty\nstring = pretty(complex_object)\n```\n\n\n## Extending\n\n\nThe pretty library allows developers to add pretty printing rules for their\nown objects. This process is straightforward. All you have to do is to\nadd a `__pretty__` method to your object and call the methods on the\npretty printer passed:\n\n class MyObject(object):\n\n def __pretty__(self, p, cycle):\n ...\n\nHere the example implementation of a `__pretty__` method for a list\nsubclass::\n\n```\nclass MyList(list):\n\n def __pretty__(self, p, cycle):\n if cycle:\n p.text('MyList(...)')\n else:\n with p.group(8, 'MyList([', '])'):\n for idx, item in enumerate(self):\n if idx:\n p.text(',')\n p.breakable()\n p.pretty(item)\n```\n\nThe `cycle` parameter is `True` if pretty detected a cycle. You *have* to\nreact to that or the result is an infinite loop. `p.text()` just adds\nnon breaking text to the output, `p.breakable()` either adds a whitespace\nor breaks here. If you pass it an argument it's used instead of the\ndefault space. `p.pretty` prettyprints another object using the pretty print\nmethod.\n\nThe first parameter to the `group` function specifies the extra indentation\nof the next line. The second and the third parameter are the opening and\nclosing strings that will be printed before and after the group.\nIn this example the next item will either be not\nbreaked (if the items are short enough) or aligned with the right edge of\nthe opening bracked of `MyList`.\n\n## Changelog\n\n### 0.2.4\n\n* Merged pull request #2 (https://github.com/mgrandi/pretty-py3/pull/2) from @alexshpilkin,\n\"Fix double indentation in PrettyPrinter.group()\"\n* Merged pull request #3 (https://github.com/mgrandi/pretty-py3/pull/3) from @alexshpilkin,\n\"Better support for set and OrderedDict types\"\n\n\n### 0.2.3\n\n* Merged pull request #1 (https://github.com/mgrandi/pretty-py3/pull/1) from @avoidscorn,\n\"Add missing comma in single-element tuple.\"\n\n### 0.2.2\n\n* Finish porting it to python3\n\n\n## Copyright\n\n`copyright 2007` by Armin Ronacher.\n\n`copyright 2014` by Mark Grandi - python 3 port\n\n`license` BSD License.\n\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/mgrandi/pretty-py3", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pretty-py3", "package_url": "https://pypi.org/project/pretty-py3/", "platform": "", "project_url": "https://pypi.org/project/pretty-py3/", "project_urls": { "Homepage": "https://github.com/mgrandi/pretty-py3" }, "release_url": "https://pypi.org/project/pretty-py3/0.2.4.post1/", "requires_dist": null, "requires_python": "", "summary": "extensible pprint successor - python3 version", "version": "0.2.4.post1" }, "last_serial": 4679552, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "8397780ea2b505d588fd4b1a50e9c26d", "sha256": "d048b0ac9c64b1f6de5837de4e0953f8d96670979ef5848ec45192706db53f77" }, "downloads": -1, "filename": "pretty-py3-0.2.tar.gz", "has_sig": false, "md5_digest": "8397780ea2b505d588fd4b1a50e9c26d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6163, "upload_time": "2014-01-21T07:15:58", "url": "https://files.pythonhosted.org/packages/89/0c/4887b81cc7a8965606124c4da1c73290d38640d25cad4a15a11d74fe551d/pretty-py3-0.2.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "f716f0981d00b0dc4ca9437a7d396847", "sha256": "ccb8c4c87d95c3d17fb6faf68cbae7892fed2b969cbc9fc0b2ae58a604c1d6dc" }, "downloads": -1, "filename": "pretty-py3-0.2.1.tar.gz", "has_sig": false, "md5_digest": "f716f0981d00b0dc4ca9437a7d396847", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6337, "upload_time": "2014-01-21T07:21:22", "url": "https://files.pythonhosted.org/packages/14/d6/bade8c656a5c0a0845b63322a348f5e31bb5934aae8a976cc963a48690a0/pretty-py3-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "a0ccc1e66c21d91ad401af8628a86faa", "sha256": "b576f4730a27d49409bb37bc2c01ec04a39923dfb5b005d6ca1a611e7d7ff2d4" }, "downloads": -1, "filename": "pretty-py3-0.2.2.tar.gz", "has_sig": false, "md5_digest": "a0ccc1e66c21d91ad401af8628a86faa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6133, "upload_time": "2014-01-21T07:50:17", "url": "https://files.pythonhosted.org/packages/6d/29/62fbbea45e00ebe1653fe8e0bed0a64c25c51bc56b22d6f9e4bde72b4966/pretty-py3-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "6cc268a7921e7c2002767235a563dc9e", "sha256": "5ea398555e36d34166c800de13af1b8f8568edbd7d2982d80706c256a23361df" }, "downloads": -1, "filename": "pretty-py3-0.2.3.tar.gz", "has_sig": false, "md5_digest": "6cc268a7921e7c2002767235a563dc9e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6135, "upload_time": "2014-03-05T08:08:52", "url": "https://files.pythonhosted.org/packages/73/cb/7dd4c4e4c80bcf70f8ed16f4754e405af4a20e8ae46d21e180e92cbed614/pretty-py3-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "3987b5a41fb350ac666e2a3317a315a3", "sha256": "92d0d3eb75051ff0aa0dfa72bfdf36c73fb1b54ce7ee9400645c3a9f18dcd16a" }, "downloads": -1, "filename": "pretty_py3-0.2.4-py3-none-any.whl", "has_sig": false, "md5_digest": "3987b5a41fb350ac666e2a3317a315a3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7272, "upload_time": "2019-01-10T04:02:26", "url": "https://files.pythonhosted.org/packages/13/1d/ebca044adacb5bf1a456967cd9a1135ad326a34ad006fa23c6d99ad7a53e/pretty_py3-0.2.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5a0222098b3ce4da3d244734172b66ba", "sha256": "0953e0f475b2a76a89e06d643dad11509f771736c7c6aacd1efb9ae50b27f564" }, "downloads": -1, "filename": "pretty-py3-0.2.4.tar.gz", "has_sig": false, "md5_digest": "5a0222098b3ce4da3d244734172b66ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6960, "upload_time": "2019-01-10T04:02:28", "url": "https://files.pythonhosted.org/packages/77/35/a398c4565522e7c7eb3602cce465e6738228a709d2cadedfc8328dc0662c/pretty-py3-0.2.4.tar.gz" } ], "0.2.4.post1": [ { "comment_text": "", "digests": { "md5": "cd13516fb130bba53fdec6b53af0ae4f", "sha256": "f171ad7710fc678540297951d7dd4325682de2d1e8f69167ad241548f9a7111f" }, "downloads": -1, "filename": "pretty_py3-0.2.4.post1-py3-none-any.whl", "has_sig": false, "md5_digest": "cd13516fb130bba53fdec6b53af0ae4f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7339, "upload_time": "2019-01-10T04:10:35", "url": "https://files.pythonhosted.org/packages/05/55/2e64673fdb825988ce5f03ecb77667c57937cce94349141ca098c38725e0/pretty_py3-0.2.4.post1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2c3a95b68b04935d8da1ad466454a49f", "sha256": "9589d46fe842724f44195f277ecb283c1efa536ebaa80e62b528e722402435dc" }, "downloads": -1, "filename": "pretty-py3-0.2.4.post1.tar.gz", "has_sig": false, "md5_digest": "2c3a95b68b04935d8da1ad466454a49f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6978, "upload_time": "2019-01-10T04:10:36", "url": "https://files.pythonhosted.org/packages/dc/04/65e5bdbca3ffaa3987e8493d68126a2e3d333c2e468fc8c8702a56e835fd/pretty-py3-0.2.4.post1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "cd13516fb130bba53fdec6b53af0ae4f", "sha256": "f171ad7710fc678540297951d7dd4325682de2d1e8f69167ad241548f9a7111f" }, "downloads": -1, "filename": "pretty_py3-0.2.4.post1-py3-none-any.whl", "has_sig": false, "md5_digest": "cd13516fb130bba53fdec6b53af0ae4f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7339, "upload_time": "2019-01-10T04:10:35", "url": "https://files.pythonhosted.org/packages/05/55/2e64673fdb825988ce5f03ecb77667c57937cce94349141ca098c38725e0/pretty_py3-0.2.4.post1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2c3a95b68b04935d8da1ad466454a49f", "sha256": "9589d46fe842724f44195f277ecb283c1efa536ebaa80e62b528e722402435dc" }, "downloads": -1, "filename": "pretty-py3-0.2.4.post1.tar.gz", "has_sig": false, "md5_digest": "2c3a95b68b04935d8da1ad466454a49f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6978, "upload_time": "2019-01-10T04:10:36", "url": "https://files.pythonhosted.org/packages/dc/04/65e5bdbca3ffaa3987e8493d68126a2e3d333c2e468fc8c8702a56e835fd/pretty-py3-0.2.4.post1.tar.gz" } ] }