{"library":"prettyprinter","title":"PrettyPrinter","description":"PrettyPrinter is a Python library (version 0.18.0) that offers syntax-highlighting, declarative, and composable pretty printing for Python 3.5+ data structures. It aims to be a feature-rich alternative to Python's standard `pprint` module, providing improved readability, customizability, and integrations with other libraries. Its release cadence has been somewhat irregular, but the 0.18.0 version released in 2019 has been stable, suggesting a mature library.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install prettyprinter"],"cli":null},"imports":["from prettyprinter import pprint","from prettyprinter import install_extras","from prettyprinter import register_pretty, pretty_call"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from prettyprinter import pprint, register_pretty, pretty_call\n\n# Basic pretty-printing of a nested dictionary\ndata = {\n    'name': 'PrettyPrinter Example',\n    'details': {\n        'id': 12345,\n        'items': [\n            {'item_id': 'A1', 'value': 100.5, 'tags': ['new', 'sale']},\n            {'item_id': 'B2', 'value': 200, 'tags': ['old']},\n            {'item_id': 'C3', 'value': 50.75, 'tags': []}\n        ],\n        'status': 'active'\n    },\n    'configs': [\n        {'key': 'timeout', 'value': 30},\n        {'key': 'retries', 'value': 5}\n    ]\n}\n\nprint('--- Standard print ---')\nprint(data)\nprint('\\n--- PrettyPrinter output ---')\npprint(data)\n\n# Custom pretty-printing for a user-defined class\nclass MyObject:\n    def __init__(self, name, values):\n        self.name = name\n        self.values = values\n\n@register_pretty(MyObject)\ndef pretty_my_object(value, ctx):\n    return pretty_call(\n        ctx,\n        MyObject,\n        name=value.name,\n        values=value.values\n    )\n\nmy_instance = MyObject('CustomItem', [{'x': 1, 'y': 2}, {'z': 3}])\nprint('\\n--- Custom object pretty-printing ---')\npprint(my_instance)\n\n# To enable shell integration (e.g., for `ipython` or default python shell):\n# from prettyprinter import install_extras\n# install_extras(['ipython']) # or ['python']\n# {'a': 1, 'b': 2} # will now be pretty-printed in the shell","lang":"python","description":"This quickstart demonstrates basic pretty-printing of a nested dictionary and how to define custom pretty-printing rules for your own classes using `@register_pretty`. It also notes how to enable shell integrations for a more persistent pretty-printing experience.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":"0.18.0","pypi_latest":"0.18.0","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":2.2,"avg_import_s":0.15,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"prettyprinter","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.16,"mem_mb":5.6,"disk_size":"27.5M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"prettyprinter","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.2,"import_time_s":0.11,"mem_mb":5.6,"disk_size":"28M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"prettyprinter","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.21,"mem_mb":6.2,"disk_size":"30.2M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"prettyprinter","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.2,"import_time_s":0.19,"mem_mb":6.2,"disk_size":"31M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"prettyprinter","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.19,"mem_mb":5.9,"disk_size":"22.0M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"prettyprinter","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.1,"import_time_s":0.22,"mem_mb":5.9,"disk_size":"23M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"prettyprinter","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.14,"mem_mb":5,"disk_size":"21.8M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"prettyprinter","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.1,"import_time_s":0.14,"mem_mb":5,"disk_size":"22M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"prettyprinter","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.1,"mem_mb":4.2,"disk_size":"27.0M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"prettyprinter","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.5,"import_time_s":0.09,"mem_mb":4.2,"disk_size":"27M"}]}}