Metadata-Version: 2.1
Name: xunter
Version: 0.1.3
Summary: Profiling for the xonsh shell based on hunter.
Home-page: https://github.com/anki-code/xunter
Author: anki-code
Author-email: no@no.no
License: MIT
Project-URL: Documentation, https://github.com/anki-code/xunter/blob/master/README.md
Project-URL: Code, https://github.com/anki-code/xunter
Project-URL: Issue tracker, https://github.com/anki-code/xunter/issues
Platform: any
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: System :: Shells
Classifier: Topic :: System :: System Shells
Classifier: Topic :: Terminals
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: xonsh
Requires-Dist: hunter

<p align="center">
<b>xunter</b> is to profiling <a href="https://xon.sh">xonsh shell</a> using <a href="https://github.com/ionelmc/python-hunter">hunter</a>. Time tracking is on board.
</p>

<p align="center">  
If you like the idea click ⭐ on the repo and <a href="https://twitter.com/intent/tweet?text=Trace%20xonsh%20shell%20code!&url=https://github.com/anki-code/xunter" target="_blank">tweet</a>.
</p>

## Install

Install xunter into the environment where xonsh you want to trace resides.

```xsh
pip install xunter
```

## Usage

Xunter is working as drop-in replacement of `xonsh` with additional arguments:
```xsh
xonsh  --no-rc -c "2+2"
xunter --no-rc -c "2+2" ++depth-lt 5
#      ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^
#            xonsh         xunter
```
Examples:
```xsh
xunter --no-rc -c "2+2" ++depth-lt 10
xunter --no-rc ++depth-lt 5 ++output /tmp/22.xunter
xunter --no-rc -c '2+2' ++filter 'Q(filename_has="main.py")'

xunter --no-rc -c 'echo 1' ++filter 'Q(filename_has="specs.py"),Q(function="run_subproc")'
# [...]/site-packages/xonsh/procs/specs.py:910:run_subproc 
#   <= xonsh/built_ins.py:206:subproc_captured_hiddenobject 
#   <= <string>:1:<module> <= xonsh/codecache.py:64:run_compiled_code 
#   <= xonsh/codecache.py:218:run_code_with_cache
#   <= xonsh/main.py:519:main_xonsh 
#   <= xonsh/main.py:470:main 
#   <= xunter/xunter:91:<module>
#   - time_sec=[0.1505]

# Don't forget about xonsh`s awesome macro call:
xunter --no-rc -c 'echo 1' ++filter! Q(filename_has="specs.py"),Q(function="run_subproc")
```
To set `++filter` read about [filters](https://python-hunter.readthedocs.io/en/latest/filtering.html) 
and take a look into the [cookbook](https://python-hunter.readthedocs.io/en/latest/cookbook.html). 

## Convert log to table

```python
xunter --no-rc -c "2+2" ++depth-lt 10 ++printer stack ++output /tmp/22.xunter
xunter2excel /tmp/22.xunter
```

## Investigations

By putting `import ipdb; ipdb.set_trace()` in the any place of code you can investigate the environment interactively.

## Known issues

If you see the unexpected exceptions try to install xonsh from the main branch first.

## See also

* [xonsh-install](https://github.com/anki-code/xonsh-install)
