Metadata-Version: 2.1
Name: pyliveupdate
Version: 0.2.3
Summary: A tool to manipulate python code at runtime for logging, profiling, debugging, etc.
Home-page: https://github.com/devopspp/pyliveupdate
Author: devopspp
License: GPLv3
Keywords: runtime instrumentation logging profiling debugging
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Classifier: Topic :: System :: Logging
Classifier: Topic :: System :: Monitoring
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Debuggers
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.5
Description-Content-Type: text/markdown
Requires-Dist: bytecode
Requires-Dist: Werkzeug
Requires-Dist: grpcio

# pyliveupdate
`PyLiveUpdate` is a Python runtime monitoring, profiling, debugging and bugfixing tool.

PyLiveUpdate allows developers to profile, troubleshoot and fix production issues for Python applications without restarting the programs.

# Demo

[![asciicast](https://asciinema.org/a/yBJ24GinkhK3bizbVE1tGLFhy.svg)](https://asciinema.org/a/yBJ24GinkhK3bizbVE1tGLFhy)

# Key features (under developing)
* Profile specific Python functions' (by function names or module names) call time.
* Add / remove profilings without restart programs.
* Show profiling results with call summary and flamegraphs.

# Quick start

## Compatibility
* Supports Python 3.5+ on Linux. 

## Install

```
pip install pyliveupdate
```
or
```
git clone https://github.com/devopspp/pyliveupdate.git
pip install -e pyliveupdate
```

## How to use
We currently implemented function profiling and are implementing more.
Please feel free to let us know if you find other features useful: https://github.com/devopspp/pyliveupdate/issues/2.

## profile function call time

1. Start pyliveupdate server
```
pylu-controller
```
2. In your program (like examples/program1.py) main module add 
```	
from pyliveupdate import *
from pyliveupdatescripts import *
UpdateStub().start()
```
3. Run your program (make sure in the correct directory)
```
cd examples
python program1.py
```
4. Start profile a set of functions
```
FP.profile(['__main__.**', 'module1.**'])
```
or
any functions
```
FP.profile('**')
```
5. Check output in either your program output or `/tmp/pyliveupdate.log`
6. List applied profiling
```
FP.ls()
```
7. Stop a profiling by its id without stopping your program
```
FP.revert(1)
```
8. Process the logs to generate a summary and a flamegraph
```
pylu-processlogs -i /tmp/pyliveupdate.log
```
9. View the generated call summary and flamegraph
### Function call summary
The following summary gives in process `4510` thread `5`, `views.results` was called `10` times and each time takes `139 ms`, `views.results` called `manager.all` for `20` times.
```
4510-Thread-5
function  hit  time/hit (ms)
views.results 10  138.562
  -manager.all 20  14.212
    -__init__.__hash__ 10  0.035
    -manager.get_queryset 20  0.922
      -query.__init__ 20  0.616
        -query.__init__ 20  0.071
```
### Flamegraph
![alt text](examples/pyliveupdate.log.svg)



# Known Users
Welcome to register your company name here: https://github.com/devopspp/pyliveupdate/issues/1


