Metadata-Version: 2.1
Name: pinspect
Version: 0.0.2
Summary: Pretty inspect object
Home-page: https://github.com/dizcza/pinspect
Author: Danylo Ulianych
Author-email: d.ulianych@gmail.com
License: MIT
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: networkx (>=2.4)
Requires-Dist: pyvis (>=0.1.7.0)
Requires-Dist: tqdm

# Pretty inspect

[![Build Status](https://travis-ci.org/dizcza/pinspect.svg?branch=master)](https://travis-ci.org/dizcza/pinspect)
[![Coverage Status](https://coveralls.io/repos/github/dizcza/pinspect/badge.svg?branch=master)](https://coveralls.io/github/dizcza/pinspect?branch=master)
[![Documentation Status](https://readthedocs.org/projects/pinspect/badge/?version=latest)](https://pinspect.readthedocs.io/en/latest/?badge=latest)


Inspired by the complexity of [Neo](https://github.com/NeuralEnsemble/python-neo).

When browsing/inspecting an object, you want to collect all methods and attributes that match the key.

### Example

Browsing the documentation of `neo.io.BlackrockIO` and looking for the ways of extracting `Epoch`s, you found `read_epoch()` method. But calling this method raises `AssertionError`. You need to go deeper.
1. Run `pip install pinspect neo`
2. Download BlackRock [sampledata.zip](http://www.blackrockmicro.com/wp-content/software/sampledata.zip)

```
wget http://www.blackrockmicro.com/wp-content/software/sampledata.zip
unzip sampledata.zip
```

3. In python,

```python
from neo.io import BlackrockIO
from pinspect import find

session = BlackrockIO('sampleData')
graph = find(session, 'epoch', verbose=True)
```

Output:

```
BlackrockIO.rescale_epoch_duration() -> 'TypeError'
BlackrockIO.read_epoch() -> 'AssertionError'
BlackrockIO._rescale_epoch_duration() -> 'TypeError'
BlackrockIO.read()[0].segments[0].epochs -> 'list of size 0'
BlackrockIO.read()[0].segments[0].events[0].to_epoch() -> 'Epoch'
```

The last two lines are candidates to explore manually.

### Graph visualization

You can pass `visualize=True` and enjoy the beautiful `networkx` with `pyvis` interacting graph rendering.
Hover over the nodes (objects) and edges (methods and attributes) to explore the graph in details and inspect how a particular object has been generated.

![](screenshots/neo_BlackRockIO_Epoch.png)

#### Unfiltered graph

Below is the full unfiltered graph of `neo.BlackRockIO` of all possible method and attribute calls. Can you find the green dot?

![](screenshots/neo_BlackRockIO.png)

### Requirements

1. Python 3.6+
2. [requirements.txt](requirements.txt)

### Alternative

Another package to inspect python variables is [objbrowser](https://github.com/titusjan/objbrowser).


