invocation-tree 0.0.14__tar.gz → 0.0.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {invocation_tree-0.0.14/invocation_tree.egg-info → invocation_tree-0.0.16}/PKG-INFO +36 -9
- {invocation_tree-0.0.14 → invocation_tree-0.0.16}/README.md +2 -1
- invocation_tree-0.0.16/images/compute.gif +0 -0
- {invocation_tree-0.0.14 → invocation_tree-0.0.16}/images/create_gif.sh +8 -2
- {invocation_tree-0.0.14 → invocation_tree-0.0.16}/images/create_images.sh +4 -4
- invocation_tree-0.0.16/images/factorial.gif +0 -0
- invocation_tree-0.0.16/images/permutations.gif +0 -0
- invocation_tree-0.0.16/images/students.gif +0 -0
- {invocation_tree-0.0.14 → invocation_tree-0.0.16}/invocation_tree/__init__.py +17 -6
- {invocation_tree-0.0.14 → invocation_tree-0.0.16/invocation_tree.egg-info}/PKG-INFO +36 -9
- invocation_tree-0.0.16/invocation_tree.egg-info/SOURCES.txt +21 -0
- invocation_tree-0.0.16/pyproject.toml +33 -0
- invocation_tree-0.0.14/images/#generator_function.py# +0 -13
- invocation_tree-0.0.14/images/compute.gif +0 -0
- invocation_tree-0.0.14/images/compute.py~ +0 -22
- invocation_tree-0.0.14/images/compute1.png +0 -0
- invocation_tree-0.0.14/images/compute2.png +0 -0
- invocation_tree-0.0.14/images/compute3.png +0 -0
- invocation_tree-0.0.14/images/compute4.png +0 -0
- invocation_tree-0.0.14/images/compute5.png +0 -0
- invocation_tree-0.0.14/images/compute6.png +0 -0
- invocation_tree-0.0.14/images/compute7.png +0 -0
- invocation_tree-0.0.14/images/compute8.png +0 -0
- invocation_tree-0.0.14/images/compute9.png +0 -0
- invocation_tree-0.0.14/images/create_images.sh~ +0 -4
- invocation_tree-0.0.14/images/eager_pipeline.py~ +0 -28
- invocation_tree-0.0.14/images/eager_pipeline1.png +0 -0
- invocation_tree-0.0.14/images/eager_pipeline2.png +0 -0
- invocation_tree-0.0.14/images/eager_pipeline3.png +0 -0
- invocation_tree-0.0.14/images/eager_pipeline4.png +0 -0
- invocation_tree-0.0.14/images/eager_pipeline5.png +0 -0
- invocation_tree-0.0.14/images/eager_pipeline6.png +0 -0
- invocation_tree-0.0.14/images/eager_pipeline7.png +0 -0
- invocation_tree-0.0.14/images/factorial.gif +0 -0
- invocation_tree-0.0.14/images/factorial.py~ +0 -11
- invocation_tree-0.0.14/images/factorial1.png +0 -0
- invocation_tree-0.0.14/images/factorial2.png +0 -0
- invocation_tree-0.0.14/images/factorial3.png +0 -0
- invocation_tree-0.0.14/images/factorial4.png +0 -0
- invocation_tree-0.0.14/images/factorial5.png +0 -0
- invocation_tree-0.0.14/images/factorial6.png +0 -0
- invocation_tree-0.0.14/images/factorial7.png +0 -0
- invocation_tree-0.0.14/images/generator_expression.py~ +0 -9
- invocation_tree-0.0.14/images/generator_expression1.png +0 -0
- invocation_tree-0.0.14/images/generator_expression2.png +0 -0
- invocation_tree-0.0.14/images/generator_expression3.png +0 -0
- invocation_tree-0.0.14/images/generator_expression4.png +0 -0
- invocation_tree-0.0.14/images/generator_expression5.png +0 -0
- invocation_tree-0.0.14/images/generator_expression6.png +0 -0
- invocation_tree-0.0.14/images/generator_expression7.png +0 -0
- invocation_tree-0.0.14/images/generator_expression8.png +0 -0
- invocation_tree-0.0.14/images/generator_expression9.png +0 -0
- invocation_tree-0.0.14/images/generator_function1.png +0 -0
- invocation_tree-0.0.14/images/generator_function2.png +0 -0
- invocation_tree-0.0.14/images/generator_function3.png +0 -0
- invocation_tree-0.0.14/images/generator_function4.png +0 -0
- invocation_tree-0.0.14/images/generator_function5.png +0 -0
- invocation_tree-0.0.14/images/generator_function6.png +0 -0
- invocation_tree-0.0.14/images/generator_function7.png +0 -0
- invocation_tree-0.0.14/images/generator_function8.png +0 -0
- invocation_tree-0.0.14/images/generator_function9.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline.py~ +0 -26
- invocation_tree-0.0.14/images/generator_pipeline1.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline10.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline11.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline12.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline13.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline14.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline15.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline16.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline17.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline18.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline19.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline2.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline20.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline21.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline22.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline23.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline24.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline25.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline26.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline27.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline3.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline4.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline5.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline6.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline7.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline8.png +0 -0
- invocation_tree-0.0.14/images/generator_pipeline9.png +0 -0
- invocation_tree-0.0.14/images/invocation_tree.pdf +0 -0
- invocation_tree-0.0.14/images/invocation_tree0.pdf +0 -0
- invocation_tree-0.0.14/images/iterable.py +0 -44
- invocation_tree-0.0.14/images/iterable.py~ +0 -31
- invocation_tree-0.0.14/images/my_list.py +0 -20
- invocation_tree-0.0.14/images/my_list.py~ +0 -4
- invocation_tree-0.0.14/images/my_range.py~ +0 -14
- invocation_tree-0.0.14/images/my_range0.png +0 -0
- invocation_tree-0.0.14/images/my_range1.png +0 -0
- invocation_tree-0.0.14/images/my_range10.png +0 -0
- invocation_tree-0.0.14/images/my_range11.png +0 -0
- invocation_tree-0.0.14/images/my_range12.png +0 -0
- invocation_tree-0.0.14/images/my_range13.png +0 -0
- invocation_tree-0.0.14/images/my_range14.png +0 -0
- invocation_tree-0.0.14/images/my_range15.png +0 -0
- invocation_tree-0.0.14/images/my_range2.png +0 -0
- invocation_tree-0.0.14/images/my_range3.png +0 -0
- invocation_tree-0.0.14/images/my_range4.png +0 -0
- invocation_tree-0.0.14/images/my_range5.png +0 -0
- invocation_tree-0.0.14/images/my_range6.png +0 -0
- invocation_tree-0.0.14/images/my_range7.png +0 -0
- invocation_tree-0.0.14/images/my_range8.png +0 -0
- invocation_tree-0.0.14/images/my_range9.png +0 -0
- invocation_tree-0.0.14/images/out.txt +0 -8
- invocation_tree-0.0.14/images/permutations.gif +0 -0
- invocation_tree-0.0.14/images/permutations.py~ +0 -8
- invocation_tree-0.0.14/images/permutations1.png +0 -0
- invocation_tree-0.0.14/images/permutations10.png +0 -0
- invocation_tree-0.0.14/images/permutations11.png +0 -0
- invocation_tree-0.0.14/images/permutations12.png +0 -0
- invocation_tree-0.0.14/images/permutations13.png +0 -0
- invocation_tree-0.0.14/images/permutations2.png +0 -0
- invocation_tree-0.0.14/images/permutations22.png~ +0 -0
- invocation_tree-0.0.14/images/permutations3.png +0 -0
- invocation_tree-0.0.14/images/permutations4.png +0 -0
- invocation_tree-0.0.14/images/permutations5.png +0 -0
- invocation_tree-0.0.14/images/permutations6.png +0 -0
- invocation_tree-0.0.14/images/permutations7.png +0 -0
- invocation_tree-0.0.14/images/permutations8.png +0 -0
- invocation_tree-0.0.14/images/permutations9.png +0 -0
- invocation_tree-0.0.14/images/student.gif +0 -0
- invocation_tree-0.0.14/images/students.gif +0 -0
- invocation_tree-0.0.14/images/students.py~ +0 -30
- invocation_tree-0.0.14/images/students1.png +0 -0
- invocation_tree-0.0.14/images/students10.png +0 -0
- invocation_tree-0.0.14/images/students11.png +0 -0
- invocation_tree-0.0.14/images/students12.png +0 -0
- invocation_tree-0.0.14/images/students13.png +0 -0
- invocation_tree-0.0.14/images/students14.png +0 -0
- invocation_tree-0.0.14/images/students15.png +0 -0
- invocation_tree-0.0.14/images/students2.png +0 -0
- invocation_tree-0.0.14/images/students3.png +0 -0
- invocation_tree-0.0.14/images/students4.png +0 -0
- invocation_tree-0.0.14/images/students5.png +0 -0
- invocation_tree-0.0.14/images/students6.png +0 -0
- invocation_tree-0.0.14/images/students7.png +0 -0
- invocation_tree-0.0.14/images/students8.png +0 -0
- invocation_tree-0.0.14/images/students9.png +0 -0
- invocation_tree-0.0.14/images/test.py +0 -15
- invocation_tree-0.0.14/images/tree.gv~ +0 -22
- invocation_tree-0.0.14/images/tree.pdf +0 -0
- invocation_tree-0.0.14/install.txt +0 -31
- invocation_tree-0.0.14/invocation_tree.egg-info/SOURCES.txt +0 -156
- invocation_tree-0.0.14/setup.py +0 -35
- {invocation_tree-0.0.14 → invocation_tree-0.0.16}/LICENSE.txt +0 -0
- {invocation_tree-0.0.14 → invocation_tree-0.0.16}/MANIFEST.in +0 -0
- {invocation_tree-0.0.14 → invocation_tree-0.0.16}/images/compute.py +0 -0
- {invocation_tree-0.0.14 → invocation_tree-0.0.16}/images/factorial.py +0 -0
- {invocation_tree-0.0.14 → invocation_tree-0.0.16}/images/permutations.py +0 -0
- {invocation_tree-0.0.14 → invocation_tree-0.0.16}/images/students.py +0 -0
- {invocation_tree-0.0.14 → invocation_tree-0.0.16}/images/vscode.png +0 -0
- {invocation_tree-0.0.14 → invocation_tree-0.0.16}/invocation_tree.egg-info/dependency_links.txt +0 -0
- {invocation_tree-0.0.14 → invocation_tree-0.0.16}/invocation_tree.egg-info/requires.txt +0 -0
- {invocation_tree-0.0.14 → invocation_tree-0.0.16}/invocation_tree.egg-info/top_level.txt +0 -0
- {invocation_tree-0.0.14 → invocation_tree-0.0.16}/setup.cfg +0 -0
|
@@ -1,21 +1,47 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: invocation_tree
|
|
3
|
-
Version: 0.0.
|
|
4
|
-
Summary:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
Version: 0.0.16
|
|
4
|
+
Summary: Generates an invocation tree of functions calls.
|
|
5
|
+
Author-email: Bas Terwijn <bterwijn@gmail.com>
|
|
6
|
+
License: BSD 2-Clause License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2017, pyexample
|
|
9
|
+
All rights reserved.
|
|
10
|
+
|
|
11
|
+
Redistribution and use in source and binary forms, with or without
|
|
12
|
+
modification, are permitted provided that the following conditions are met:
|
|
13
|
+
|
|
14
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
15
|
+
list of conditions and the following disclaimer.
|
|
16
|
+
|
|
17
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
18
|
+
this list of conditions and the following disclaimer in the documentation
|
|
19
|
+
and/or other materials provided with the distribution.
|
|
20
|
+
|
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
22
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
23
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
24
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
25
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
26
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
27
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
28
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
29
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
30
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
31
|
+
|
|
32
|
+
Project-URL: Homepage, https://github.com/bterwijn/invocation_tree
|
|
33
|
+
Project-URL: Repository, https://github.com/bterwijn/invocation_tree.git
|
|
9
34
|
Classifier: Development Status :: 4 - Beta
|
|
10
35
|
Classifier: Intended Audience :: Education
|
|
11
36
|
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: License :: OSI Approved :: BSD License
|
|
13
37
|
Classifier: Programming Language :: Python :: 3
|
|
14
38
|
Classifier: Topic :: Education
|
|
15
39
|
Classifier: Topic :: Software Development :: Debuggers
|
|
40
|
+
Requires-Python: >=3.7
|
|
16
41
|
Description-Content-Type: text/markdown
|
|
17
42
|
License-File: LICENSE.txt
|
|
18
43
|
Requires-Dist: graphviz
|
|
44
|
+
Dynamic: license-file
|
|
19
45
|
|
|
20
46
|
# Installation #
|
|
21
47
|
Install (or upgrade) `invocation_tree` using pip:
|
|
@@ -168,6 +194,7 @@ print( tree(factorial, 4) ) # show invocation tree of calling factorial(4)
|
|
|
168
194
|
24
|
|
169
195
|
```
|
|
170
196
|
|
|
197
|
+
## Permutations ##
|
|
171
198
|
This `permutations()` example shows the depth-first nature of recursive execution:
|
|
172
199
|
|
|
173
200
|
```python
|
|
@@ -244,7 +271,7 @@ For convenience we provide these functions to set common configurations:
|
|
|
244
271
|
- **ivt.non_blocking(filename)**, non-blocking on each function call and return
|
|
245
272
|
|
|
246
273
|
# Troubleshooting #
|
|
247
|
-
- Adobe Acrobat Reader [doesn't refresh a PDF file](https://
|
|
274
|
+
- Adobe Acrobat Reader [doesn't refresh a PDF file](https://community.adobe.com/t5/acrobat-reader-discussions/reload-refresh-pdfs/td-p/9632292) when it changes on disk and blocks updates which results in an `Could not open 'somefile.pdf' for writing : Permission denied` error. One solution is to install a PDF reader that does refresh ([SumatraPDF](https://www.sumatrapdfreader.org/), [Okular](https://okular.kde.org/), ...) and set it as the default PDF reader. Another solution is to `render()` the graph to a different output format and to open it manually.
|
|
248
275
|
|
|
249
276
|
## Memory_Graph Package ##
|
|
250
277
|
The [invocation_tree](https://pypi.org/project/invocation-tree/) package visualizes function calls at different moments in time. If instead you want a detailed visualization of your data at the current time, check out the [memory_graph](https://pypi.org/project/memory-graph/) package.
|
|
@@ -149,6 +149,7 @@ print( tree(factorial, 4) ) # show invocation tree of calling factorial(4)
|
|
|
149
149
|
24
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
+
## Permutations ##
|
|
152
153
|
This `permutations()` example shows the depth-first nature of recursive execution:
|
|
153
154
|
|
|
154
155
|
```python
|
|
@@ -225,7 +226,7 @@ For convenience we provide these functions to set common configurations:
|
|
|
225
226
|
- **ivt.non_blocking(filename)**, non-blocking on each function call and return
|
|
226
227
|
|
|
227
228
|
# Troubleshooting #
|
|
228
|
-
- Adobe Acrobat Reader [doesn't refresh a PDF file](https://
|
|
229
|
+
- Adobe Acrobat Reader [doesn't refresh a PDF file](https://community.adobe.com/t5/acrobat-reader-discussions/reload-refresh-pdfs/td-p/9632292) when it changes on disk and blocks updates which results in an `Could not open 'somefile.pdf' for writing : Permission denied` error. One solution is to install a PDF reader that does refresh ([SumatraPDF](https://www.sumatrapdfreader.org/), [Okular](https://okular.kde.org/), ...) and set it as the default PDF reader. Another solution is to `render()` the graph to a different output format and to open it manually.
|
|
229
230
|
|
|
230
231
|
## Memory_Graph Package ##
|
|
231
232
|
The [invocation_tree](https://pypi.org/project/invocation-tree/) package visualizes function calls at different moments in time. If instead you want a detailed visualization of your data at the current time, check out the [memory_graph](https://pypi.org/project/memory-graph/) package.
|
|
Binary file
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# sudo apt install imagemagick
|
|
6
6
|
|
|
7
7
|
name="$1"
|
|
8
|
-
files=$(ls -v $name*.png)
|
|
8
|
+
files=$(ls -v $name*.png | tr '\n' ' ')
|
|
9
9
|
echo "creating gif with:"
|
|
10
10
|
echo "$files"
|
|
11
11
|
|
|
@@ -15,5 +15,11 @@ echo "largest_size: $largest_size"
|
|
|
15
15
|
echo "resizing images"
|
|
16
16
|
mogrify -resize $largest_size -background white -gravity North -extent $largest_size $files
|
|
17
17
|
echo "creating file: $name.gif"
|
|
18
|
-
convert -delay 150 -loop 0 $files $name.gif
|
|
18
|
+
convert -delay 150 -dither None -loop 0 $files $name.gif
|
|
19
|
+
|
|
20
|
+
if [ "$2" = "-d" ]; then
|
|
21
|
+
echo "deleting: $files"
|
|
22
|
+
rm $files
|
|
23
|
+
fi
|
|
24
|
+
|
|
19
25
|
echo "done"
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
rm -f compute*.png
|
|
3
3
|
python compute.py
|
|
4
4
|
rm -f compute0.png
|
|
5
|
-
bash create_gif.sh compute
|
|
5
|
+
bash create_gif.sh compute -d
|
|
6
6
|
|
|
7
7
|
rm -f students*.png
|
|
8
8
|
python students.py
|
|
9
9
|
rm -f students0.png
|
|
10
|
-
bash create_gif.sh students
|
|
10
|
+
bash create_gif.sh students -d
|
|
11
11
|
|
|
12
12
|
rm -f factorial*.png
|
|
13
13
|
python factorial.py
|
|
14
14
|
rm -f factorial0.png
|
|
15
|
-
bash create_gif.sh factorial
|
|
15
|
+
bash create_gif.sh factorial -d
|
|
16
16
|
|
|
17
17
|
rm -f permutations*.png
|
|
18
18
|
python permutations.py
|
|
19
19
|
rm -f permutations0.png
|
|
20
|
-
bash create_gif.sh permutations
|
|
20
|
+
bash create_gif.sh permutations -d
|
|
21
21
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -7,7 +7,7 @@ import html
|
|
|
7
7
|
import sys
|
|
8
8
|
import difflib
|
|
9
9
|
|
|
10
|
-
__version__ = "0.0.
|
|
10
|
+
__version__ = "0.0.16"
|
|
11
11
|
__author__ = 'Bas Terwijn'
|
|
12
12
|
|
|
13
13
|
def highlight_diff(str1, str2):
|
|
@@ -60,7 +60,8 @@ class Tree_Node:
|
|
|
60
60
|
class Invocation_Tree:
|
|
61
61
|
|
|
62
62
|
def __init__(self,
|
|
63
|
-
filename='tree.pdf',
|
|
63
|
+
filename='tree.pdf',
|
|
64
|
+
render=True,
|
|
64
65
|
show=True,
|
|
65
66
|
block=True,
|
|
66
67
|
src_loc=True,
|
|
@@ -78,6 +79,7 @@ class Invocation_Tree:
|
|
|
78
79
|
# --- config
|
|
79
80
|
self.filename = filename
|
|
80
81
|
self.prev_filename = None
|
|
82
|
+
self.render = render
|
|
81
83
|
self.show = show
|
|
82
84
|
self.block = block
|
|
83
85
|
self.src_loc = src_loc
|
|
@@ -104,6 +106,7 @@ class Invocation_Tree:
|
|
|
104
106
|
self.node_id_to_table = {}
|
|
105
107
|
self.edges = []
|
|
106
108
|
self.is_highlighted = False
|
|
109
|
+
self.graph = None
|
|
107
110
|
self.ignore_calls = {'Invocation_Tree.__exit__', 'Invocation_Tree.stop_trace'}
|
|
108
111
|
|
|
109
112
|
def __repr__(self):
|
|
@@ -234,9 +237,10 @@ class Invocation_Tree:
|
|
|
234
237
|
def output_graph(self, frame, event):
|
|
235
238
|
if self.block or self.gifcount >= 0:
|
|
236
239
|
self.is_highlighted = False
|
|
237
|
-
graph = self.create_graph()
|
|
240
|
+
self.graph = self.create_graph()
|
|
238
241
|
if self.is_highlighted:
|
|
239
|
-
self.
|
|
242
|
+
if self.render:
|
|
243
|
+
self.render_graph(self.graph)
|
|
240
244
|
if self.block:
|
|
241
245
|
if self.src_loc:
|
|
242
246
|
filename = frame.f_code.co_filename
|
|
@@ -244,8 +248,12 @@ class Invocation_Tree:
|
|
|
244
248
|
print(f'{event.capitalize()} at {filename}:{line_nr}', end='. ')
|
|
245
249
|
input('Press <Enter> to continue...')
|
|
246
250
|
else:
|
|
247
|
-
graph = self.create_graph()
|
|
248
|
-
self.
|
|
251
|
+
self.graph = self.create_graph()
|
|
252
|
+
if self.render:
|
|
253
|
+
self.render_graph(self.graph)
|
|
254
|
+
|
|
255
|
+
def get_graph(self):
|
|
256
|
+
return self.graph
|
|
249
257
|
|
|
250
258
|
def trace_calls(self, frame, event, arg):
|
|
251
259
|
class_fun_name = get_class_function_name(frame)
|
|
@@ -273,6 +281,9 @@ def blocking_each_change(filename='tree.pdf'):
|
|
|
273
281
|
def debugger(filename='tree.pdf'):
|
|
274
282
|
return Invocation_Tree(filename=filename, show=False, block=False, each_line=True)
|
|
275
283
|
|
|
284
|
+
def debugger_no_render(filename='tree.pdf'):
|
|
285
|
+
return Invocation_Tree(filename=filename, render=False, show=False, block=False, each_line=True)
|
|
286
|
+
|
|
276
287
|
def gif(filename='tree.png'):
|
|
277
288
|
return Invocation_Tree(filename=filename, show=False, block=False, gifcount=0)
|
|
278
289
|
|
|
@@ -1,21 +1,47 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: invocation_tree
|
|
3
|
-
Version: 0.0.
|
|
4
|
-
Summary:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
Version: 0.0.16
|
|
4
|
+
Summary: Generates an invocation tree of functions calls.
|
|
5
|
+
Author-email: Bas Terwijn <bterwijn@gmail.com>
|
|
6
|
+
License: BSD 2-Clause License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2017, pyexample
|
|
9
|
+
All rights reserved.
|
|
10
|
+
|
|
11
|
+
Redistribution and use in source and binary forms, with or without
|
|
12
|
+
modification, are permitted provided that the following conditions are met:
|
|
13
|
+
|
|
14
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
15
|
+
list of conditions and the following disclaimer.
|
|
16
|
+
|
|
17
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
18
|
+
this list of conditions and the following disclaimer in the documentation
|
|
19
|
+
and/or other materials provided with the distribution.
|
|
20
|
+
|
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
22
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
23
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
24
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
25
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
26
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
27
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
28
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
29
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
30
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
31
|
+
|
|
32
|
+
Project-URL: Homepage, https://github.com/bterwijn/invocation_tree
|
|
33
|
+
Project-URL: Repository, https://github.com/bterwijn/invocation_tree.git
|
|
9
34
|
Classifier: Development Status :: 4 - Beta
|
|
10
35
|
Classifier: Intended Audience :: Education
|
|
11
36
|
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: License :: OSI Approved :: BSD License
|
|
13
37
|
Classifier: Programming Language :: Python :: 3
|
|
14
38
|
Classifier: Topic :: Education
|
|
15
39
|
Classifier: Topic :: Software Development :: Debuggers
|
|
40
|
+
Requires-Python: >=3.7
|
|
16
41
|
Description-Content-Type: text/markdown
|
|
17
42
|
License-File: LICENSE.txt
|
|
18
43
|
Requires-Dist: graphviz
|
|
44
|
+
Dynamic: license-file
|
|
19
45
|
|
|
20
46
|
# Installation #
|
|
21
47
|
Install (or upgrade) `invocation_tree` using pip:
|
|
@@ -168,6 +194,7 @@ print( tree(factorial, 4) ) # show invocation tree of calling factorial(4)
|
|
|
168
194
|
24
|
|
169
195
|
```
|
|
170
196
|
|
|
197
|
+
## Permutations ##
|
|
171
198
|
This `permutations()` example shows the depth-first nature of recursive execution:
|
|
172
199
|
|
|
173
200
|
```python
|
|
@@ -244,7 +271,7 @@ For convenience we provide these functions to set common configurations:
|
|
|
244
271
|
- **ivt.non_blocking(filename)**, non-blocking on each function call and return
|
|
245
272
|
|
|
246
273
|
# Troubleshooting #
|
|
247
|
-
- Adobe Acrobat Reader [doesn't refresh a PDF file](https://
|
|
274
|
+
- Adobe Acrobat Reader [doesn't refresh a PDF file](https://community.adobe.com/t5/acrobat-reader-discussions/reload-refresh-pdfs/td-p/9632292) when it changes on disk and blocks updates which results in an `Could not open 'somefile.pdf' for writing : Permission denied` error. One solution is to install a PDF reader that does refresh ([SumatraPDF](https://www.sumatrapdfreader.org/), [Okular](https://okular.kde.org/), ...) and set it as the default PDF reader. Another solution is to `render()` the graph to a different output format and to open it manually.
|
|
248
275
|
|
|
249
276
|
## Memory_Graph Package ##
|
|
250
277
|
The [invocation_tree](https://pypi.org/project/invocation-tree/) package visualizes function calls at different moments in time. If instead you want a detailed visualization of your data at the current time, check out the [memory_graph](https://pypi.org/project/memory-graph/) package.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
LICENSE.txt
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
images/compute.gif
|
|
6
|
+
images/compute.py
|
|
7
|
+
images/create_gif.sh
|
|
8
|
+
images/create_images.sh
|
|
9
|
+
images/factorial.gif
|
|
10
|
+
images/factorial.py
|
|
11
|
+
images/permutations.gif
|
|
12
|
+
images/permutations.py
|
|
13
|
+
images/students.gif
|
|
14
|
+
images/students.py
|
|
15
|
+
images/vscode.png
|
|
16
|
+
invocation_tree/__init__.py
|
|
17
|
+
invocation_tree.egg-info/PKG-INFO
|
|
18
|
+
invocation_tree.egg-info/SOURCES.txt
|
|
19
|
+
invocation_tree.egg-info/dependency_links.txt
|
|
20
|
+
invocation_tree.egg-info/requires.txt
|
|
21
|
+
invocation_tree.egg-info/top_level.txt
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "invocation_tree"
|
|
7
|
+
version = "0.0.16"
|
|
8
|
+
description = "Generates an invocation tree of functions calls."
|
|
9
|
+
authors = [
|
|
10
|
+
{name = "Bas Terwijn", email = "bterwijn@gmail.com"}
|
|
11
|
+
]
|
|
12
|
+
#license = { text = "BSD-2-Clause" } # needed for python <=3.8
|
|
13
|
+
license = { file = "LICENSE.txt" }
|
|
14
|
+
readme = "README.md"
|
|
15
|
+
requires-python = ">=3.7"
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Education",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Topic :: Education",
|
|
22
|
+
"Topic :: Software Development :: Debuggers",
|
|
23
|
+
]
|
|
24
|
+
dependencies = [
|
|
25
|
+
"graphviz",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
Homepage = "https://github.com/bterwijn/invocation_tree"
|
|
30
|
+
Repository = "https://github.com/bterwijn/invocation_tree.git"
|
|
31
|
+
|
|
32
|
+
[tool.setuptools]
|
|
33
|
+
packages = ["invocation_tree"]
|
|
Binary file
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import invocation_tree as invo_tree
|
|
2
|
-
|
|
3
|
-
def main():
|
|
4
|
-
a = 10
|
|
5
|
-
a = expression(a)
|
|
6
|
-
return multiply(a, 6)
|
|
7
|
-
|
|
8
|
-
def expression(a):
|
|
9
|
-
a = subtract(a, 5)
|
|
10
|
-
return add(a, 2)
|
|
11
|
-
|
|
12
|
-
def subtract(a, b):
|
|
13
|
-
return a - b
|
|
14
|
-
|
|
15
|
-
def add(a, b):
|
|
16
|
-
return a + b
|
|
17
|
-
|
|
18
|
-
def multiply(a, b):
|
|
19
|
-
return a * b
|
|
20
|
-
|
|
21
|
-
tree = invo_tree.gif('compute.png')
|
|
22
|
-
print( tree(main) )
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import invocation_tree as invo_tree
|
|
2
|
-
|
|
3
|
-
def subtract(pipeline):
|
|
4
|
-
for a in pipeline:
|
|
5
|
-
yield a - 3
|
|
6
|
-
|
|
7
|
-
def multiply(pipeline):
|
|
8
|
-
for a in pipeline:
|
|
9
|
-
yield a * 6
|
|
10
|
-
|
|
11
|
-
def my_sum(pipeline):
|
|
12
|
-
total = 0
|
|
13
|
-
for i in pipeline:
|
|
14
|
-
total += i
|
|
15
|
-
return total # return not yield, so not lazy
|
|
16
|
-
|
|
17
|
-
def main():
|
|
18
|
-
pipeline = range(1,4)
|
|
19
|
-
pipeline = subtract(pipeline)
|
|
20
|
-
pipeline = (a + 9 for a in pipeline)
|
|
21
|
-
pipeline = multiply(pipeline)
|
|
22
|
-
return my_sum(pipeline)
|
|
23
|
-
|
|
24
|
-
tree = invo_tree.blocking()
|
|
25
|
-
import types
|
|
26
|
-
tree.to_string[types.GeneratorType] = lambda x: 'generator' # short name for generators
|
|
27
|
-
tree.to_string[type(iter(range(0)))] = lambda x: 'iterator' # short name for iterator
|
|
28
|
-
print( tree(main) )
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import invocation_tree as invo_tree
|
|
2
|
-
|
|
3
|
-
def subtract(pipeline):
|
|
4
|
-
for a in pipeline:
|
|
5
|
-
yield a - 7
|
|
6
|
-
|
|
7
|
-
def add(pipeline):
|
|
8
|
-
for a in pipeline:
|
|
9
|
-
yield a + 2
|
|
10
|
-
|
|
11
|
-
def multiply(pipeline):
|
|
12
|
-
for a in pipeline:
|
|
13
|
-
yield a * 6
|
|
14
|
-
|
|
15
|
-
def main():
|
|
16
|
-
pipeline = range(1,4)
|
|
17
|
-
pipeline = subtract(pipeline)
|
|
18
|
-
pipeline = (a+2 for a in pipeline)
|
|
19
|
-
pipeline = multiply(pipeline)
|
|
20
|
-
return list(pipeline)
|
|
21
|
-
|
|
22
|
-
tree = invo_tree.blocking() # gif('generator_pipeline.png')
|
|
23
|
-
import types
|
|
24
|
-
tree.to_string[types.GeneratorType] = lambda x: 'generator' # short name for generators
|
|
25
|
-
tree.to_string[type(iter(range(0)))] = lambda x: 'range_iterator' # short name for range_iterator
|
|
26
|
-
print( tree(main) )
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|