Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grimen/python-inspecta
A colorized object pretty printer - for Python.
https://github.com/grimen/python-inspecta
color colors debugging inspection inspector pretty-printer prettyprinter python python2 python3 syntax-highlighting terminal
Last synced: about 1 month ago
JSON representation
A colorized object pretty printer - for Python.
- Host: GitHub
- URL: https://github.com/grimen/python-inspecta
- Owner: grimen
- License: mit
- Created: 2019-01-27T10:13:01.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-17T05:55:01.000Z (over 5 years ago)
- Last Synced: 2024-08-09T18:53:10.546Z (3 months ago)
- Topics: color, colors, debugging, inspection, inspector, pretty-printer, prettyprinter, python, python2, python3, syntax-highlighting, terminal
- Language: Python
- Homepage: https://pypi.org/project/inspecta
- Size: 25.4 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# `inspecta` [![PyPI version](https://badge.fury.io/py/inspecta.svg)](https://badge.fury.io/py/inspecta) [![Build Status](https://travis-ci.com/grimen/python-inspecta.svg?branch=master)](https://travis-ci.com/grimen/python-inspecta) [![Coverage Status](https://codecov.io/gh/grimen/python-inspecta/branch/master/graph/badge.svg)](https://codecov.io/gh/grimen/python-inspecta)
*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**:
```sh
$ pip install inspecta
```## Use
Very basic **[example](https://github.com/grimen/python-inspecta/tree/master/examples/basic.py)**:
```python
import inspectadata = {
'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):
```bash
.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:
```sh
$ make install
```Run **colorful tests**, with only native environment (dependency sandboxing up to you):
```sh
$ make test
```Run **less colorful tests**, with **multi-environment** (using **tox**):
```sh
$ make test-tox
```## About
This project was mainly initiated - in lack of solid existing alternatives - to be used at our work at **[Markable.ai](https://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.