trio-vis
trio-vis is a plugin for visualizing the scope history of your Trio project.
How to use
-
Install
trio-visviapip install trio-vis(trio-vis-pip) -
In your source code, register
SC_Monitor()as an Instrument while runningtriofrom trio_vis import SC_Monitor trio.run(my_main_funciton, instruments=[SC_Monitor()])
-
After your program finished(or exited), the scope history would be stored in
./sc-logs.json -
Upload your log file to sc-visualizer, this is a twin project which focuses on visualization work.
-
See your visualization result and help us improve.
Configuration
Import VisConfig from trio_vis, and provide it as an argument while making your SC_Monitor object.
from trio_vis import SC_Monitor, VisConfig
cfg = VisConfig(print_task_tree=True)
trio.run(my_main_funciton, instruments=[SC_Monitor(config=cfg)])
What does it do
trio-vis utilize the Instrument API to monitor the lifetime of scopes (Task,Nursery).
Since the Instrument API doesn't provide callbacks for Nursery, we make inferences on our own.
Why visualize
Derived from curio, trio combines the idea of Structured Concurrency with existing single-threaded event-driven architecture. Which does make concurrent programs more manageable.
To make trio comparable with curio, contributors of trio also want to mimic the feature of curio-monitor to monitor the current system running state. This idea could be traced back to trio-issue-413.
Since then, projects have been developed (shown below).
However, trio is not curio, at least lifetimes of scopes are structured by nature. I argue that by utilizing the feature of Structured Concurrency, we could visualize programs better. Developers could easily conceptualize their program, and bring their developing experience to the next level.
Previous work
- python-trio/trio-monitor: officail project developed under trio, however it use the old InstruementAPI
- syncrypt/trio-inspector: is a webmonitor to visualize the current state of the program
- Tronic/trio-web-monitor: a experiment to unified all previous work, developed by Tronic
- oremanj/trio-monitor
Future plan
This project is in an early developing stage. Stay tuned for future update.
Metadata
Release files for trio-vis 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| trio-vis-0.1.0.tar.gz | 12.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| trio_vis-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.9 kB
Release files / trio-vis-0.1.0.tar.gz
| Download URL | trio-vis-0.1.0.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a582d1e30a2e8fc26c821020ca30042175af38068bb11fef22f9d2410552ee5e
|
|
BLAKE2b-256 checksum How to use checksums |
62f56ef95a15bcf362e6cf7170724db9ce62a87e71c96f10196a59d57a69578c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.11 CPython/3.9.7 Darwin/21.1.0
|
Release files / trio_vis-0.1.0-py3-none-any.whl
| Download URL | trio_vis-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a998feb589fb5ed07cbb06826f8952ffc8bbfd12174720277fa546a4dbca7b5d
|
|
BLAKE2b-256 checksum How to use checksums |
8c9068cc0e32ba96d3216edcbb3fdfa27ab51f587b22ee539fae9486af81543b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.11 CPython/3.9.7 Darwin/21.1.0
|