Skip to main content

A colorized object pretty printer - for Python.

Project description

inspecta PyPI version Build Status Coverage Status

A colorized object pretty printer - for Python.

Introduction

The default pprint is not human friendly enough - color syntax highlighting to the rescue.

Install

Install using pip:

$ pip install inspecta

Use

Very basic example:

import inspecta

data = {
    'foo': {
        'bar': {
            'baz': [
                {
                    'a': 1,
                    'b': 'two',
                    'c': ('three', 4, 'five')
                }
            ]
        }
    },
    'bar': [1, 2, 3],
    'baz': True
}

print('\n.inspect(data)\n')

print(inspecta.inspect(data))

print('\n.print(data)\n')

inspecta.print(data)

Run this with optional environment variables COLORS / ERROR_COLORS set too truthy or falsy values, so see various error info formatting in terminal.

Something like this (imagine some colorized formatting):

.inspect(data)

{   'bar': [1, 2, 3],
    'baz': True,
    'foo': {'bar': {'baz': [{'a': 1, 'b': 'two', 'c': ('three', 4, 'five')}]}}}


.print(data)

{   'bar': [1, 2, 3],
    'baz': True,
    'foo': {'bar': {'baz': [{'a': 1, 'b': 'two', 'c': ('three', 4, 'five')}]}}}

Test

Clone down source code:

$ make install

Run colorful tests, with only native environment (dependency sandboxing up to you):

$ make test

Run less colorful tests, with multi-environment (using tox):

$ make test-tox

About

This project was mainly initiated - in lack of solid existing alternatives - to be used at our work at Markable.ai to have common code conventions between various programming environments where Python (research, CV, AI) is heavily used.

License

Released under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inspecta-0.1.3.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

inspecta-0.1.3-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file inspecta-0.1.3.tar.gz.

File metadata

  • Download URL: inspecta-0.1.3.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.20.1 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for inspecta-0.1.3.tar.gz
Algorithm Hash digest
SHA256 17124dfae9b05e6226cc426036aa7736bbdf37d61ae5cc85178474ca9ec3d6c1
MD5 7fa1ec828c204e3dffde5c9ea3ea3a11
BLAKE2b-256 74403703630202705f96bd08a32a74ef7772345f7e84109915caeed057eeaff8

See more details on using hashes here.

File details

Details for the file inspecta-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: inspecta-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.20.1 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for inspecta-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 043b4dc3e6b7727e706e793befcba9981eb00f2b1c012c49f6d9cdcb2c18b15f
MD5 fe3ce2479aff95018147f93353b0144e
BLAKE2b-256 03aa5ad8e223fa564d474b465771710b8b7b23896b59651cf115f510bcfda3ee

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page