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.
Files changed (164) hide show
  1. {invocation_tree-0.0.14/invocation_tree.egg-info → invocation_tree-0.0.16}/PKG-INFO +36 -9
  2. {invocation_tree-0.0.14 → invocation_tree-0.0.16}/README.md +2 -1
  3. invocation_tree-0.0.16/images/compute.gif +0 -0
  4. {invocation_tree-0.0.14 → invocation_tree-0.0.16}/images/create_gif.sh +8 -2
  5. {invocation_tree-0.0.14 → invocation_tree-0.0.16}/images/create_images.sh +4 -4
  6. invocation_tree-0.0.16/images/factorial.gif +0 -0
  7. invocation_tree-0.0.16/images/permutations.gif +0 -0
  8. invocation_tree-0.0.16/images/students.gif +0 -0
  9. {invocation_tree-0.0.14 → invocation_tree-0.0.16}/invocation_tree/__init__.py +17 -6
  10. {invocation_tree-0.0.14 → invocation_tree-0.0.16/invocation_tree.egg-info}/PKG-INFO +36 -9
  11. invocation_tree-0.0.16/invocation_tree.egg-info/SOURCES.txt +21 -0
  12. invocation_tree-0.0.16/pyproject.toml +33 -0
  13. invocation_tree-0.0.14/images/#generator_function.py# +0 -13
  14. invocation_tree-0.0.14/images/compute.gif +0 -0
  15. invocation_tree-0.0.14/images/compute.py~ +0 -22
  16. invocation_tree-0.0.14/images/compute1.png +0 -0
  17. invocation_tree-0.0.14/images/compute2.png +0 -0
  18. invocation_tree-0.0.14/images/compute3.png +0 -0
  19. invocation_tree-0.0.14/images/compute4.png +0 -0
  20. invocation_tree-0.0.14/images/compute5.png +0 -0
  21. invocation_tree-0.0.14/images/compute6.png +0 -0
  22. invocation_tree-0.0.14/images/compute7.png +0 -0
  23. invocation_tree-0.0.14/images/compute8.png +0 -0
  24. invocation_tree-0.0.14/images/compute9.png +0 -0
  25. invocation_tree-0.0.14/images/create_images.sh~ +0 -4
  26. invocation_tree-0.0.14/images/eager_pipeline.py~ +0 -28
  27. invocation_tree-0.0.14/images/eager_pipeline1.png +0 -0
  28. invocation_tree-0.0.14/images/eager_pipeline2.png +0 -0
  29. invocation_tree-0.0.14/images/eager_pipeline3.png +0 -0
  30. invocation_tree-0.0.14/images/eager_pipeline4.png +0 -0
  31. invocation_tree-0.0.14/images/eager_pipeline5.png +0 -0
  32. invocation_tree-0.0.14/images/eager_pipeline6.png +0 -0
  33. invocation_tree-0.0.14/images/eager_pipeline7.png +0 -0
  34. invocation_tree-0.0.14/images/factorial.gif +0 -0
  35. invocation_tree-0.0.14/images/factorial.py~ +0 -11
  36. invocation_tree-0.0.14/images/factorial1.png +0 -0
  37. invocation_tree-0.0.14/images/factorial2.png +0 -0
  38. invocation_tree-0.0.14/images/factorial3.png +0 -0
  39. invocation_tree-0.0.14/images/factorial4.png +0 -0
  40. invocation_tree-0.0.14/images/factorial5.png +0 -0
  41. invocation_tree-0.0.14/images/factorial6.png +0 -0
  42. invocation_tree-0.0.14/images/factorial7.png +0 -0
  43. invocation_tree-0.0.14/images/generator_expression.py~ +0 -9
  44. invocation_tree-0.0.14/images/generator_expression1.png +0 -0
  45. invocation_tree-0.0.14/images/generator_expression2.png +0 -0
  46. invocation_tree-0.0.14/images/generator_expression3.png +0 -0
  47. invocation_tree-0.0.14/images/generator_expression4.png +0 -0
  48. invocation_tree-0.0.14/images/generator_expression5.png +0 -0
  49. invocation_tree-0.0.14/images/generator_expression6.png +0 -0
  50. invocation_tree-0.0.14/images/generator_expression7.png +0 -0
  51. invocation_tree-0.0.14/images/generator_expression8.png +0 -0
  52. invocation_tree-0.0.14/images/generator_expression9.png +0 -0
  53. invocation_tree-0.0.14/images/generator_function1.png +0 -0
  54. invocation_tree-0.0.14/images/generator_function2.png +0 -0
  55. invocation_tree-0.0.14/images/generator_function3.png +0 -0
  56. invocation_tree-0.0.14/images/generator_function4.png +0 -0
  57. invocation_tree-0.0.14/images/generator_function5.png +0 -0
  58. invocation_tree-0.0.14/images/generator_function6.png +0 -0
  59. invocation_tree-0.0.14/images/generator_function7.png +0 -0
  60. invocation_tree-0.0.14/images/generator_function8.png +0 -0
  61. invocation_tree-0.0.14/images/generator_function9.png +0 -0
  62. invocation_tree-0.0.14/images/generator_pipeline.py~ +0 -26
  63. invocation_tree-0.0.14/images/generator_pipeline1.png +0 -0
  64. invocation_tree-0.0.14/images/generator_pipeline10.png +0 -0
  65. invocation_tree-0.0.14/images/generator_pipeline11.png +0 -0
  66. invocation_tree-0.0.14/images/generator_pipeline12.png +0 -0
  67. invocation_tree-0.0.14/images/generator_pipeline13.png +0 -0
  68. invocation_tree-0.0.14/images/generator_pipeline14.png +0 -0
  69. invocation_tree-0.0.14/images/generator_pipeline15.png +0 -0
  70. invocation_tree-0.0.14/images/generator_pipeline16.png +0 -0
  71. invocation_tree-0.0.14/images/generator_pipeline17.png +0 -0
  72. invocation_tree-0.0.14/images/generator_pipeline18.png +0 -0
  73. invocation_tree-0.0.14/images/generator_pipeline19.png +0 -0
  74. invocation_tree-0.0.14/images/generator_pipeline2.png +0 -0
  75. invocation_tree-0.0.14/images/generator_pipeline20.png +0 -0
  76. invocation_tree-0.0.14/images/generator_pipeline21.png +0 -0
  77. invocation_tree-0.0.14/images/generator_pipeline22.png +0 -0
  78. invocation_tree-0.0.14/images/generator_pipeline23.png +0 -0
  79. invocation_tree-0.0.14/images/generator_pipeline24.png +0 -0
  80. invocation_tree-0.0.14/images/generator_pipeline25.png +0 -0
  81. invocation_tree-0.0.14/images/generator_pipeline26.png +0 -0
  82. invocation_tree-0.0.14/images/generator_pipeline27.png +0 -0
  83. invocation_tree-0.0.14/images/generator_pipeline3.png +0 -0
  84. invocation_tree-0.0.14/images/generator_pipeline4.png +0 -0
  85. invocation_tree-0.0.14/images/generator_pipeline5.png +0 -0
  86. invocation_tree-0.0.14/images/generator_pipeline6.png +0 -0
  87. invocation_tree-0.0.14/images/generator_pipeline7.png +0 -0
  88. invocation_tree-0.0.14/images/generator_pipeline8.png +0 -0
  89. invocation_tree-0.0.14/images/generator_pipeline9.png +0 -0
  90. invocation_tree-0.0.14/images/invocation_tree.pdf +0 -0
  91. invocation_tree-0.0.14/images/invocation_tree0.pdf +0 -0
  92. invocation_tree-0.0.14/images/iterable.py +0 -44
  93. invocation_tree-0.0.14/images/iterable.py~ +0 -31
  94. invocation_tree-0.0.14/images/my_list.py +0 -20
  95. invocation_tree-0.0.14/images/my_list.py~ +0 -4
  96. invocation_tree-0.0.14/images/my_range.py~ +0 -14
  97. invocation_tree-0.0.14/images/my_range0.png +0 -0
  98. invocation_tree-0.0.14/images/my_range1.png +0 -0
  99. invocation_tree-0.0.14/images/my_range10.png +0 -0
  100. invocation_tree-0.0.14/images/my_range11.png +0 -0
  101. invocation_tree-0.0.14/images/my_range12.png +0 -0
  102. invocation_tree-0.0.14/images/my_range13.png +0 -0
  103. invocation_tree-0.0.14/images/my_range14.png +0 -0
  104. invocation_tree-0.0.14/images/my_range15.png +0 -0
  105. invocation_tree-0.0.14/images/my_range2.png +0 -0
  106. invocation_tree-0.0.14/images/my_range3.png +0 -0
  107. invocation_tree-0.0.14/images/my_range4.png +0 -0
  108. invocation_tree-0.0.14/images/my_range5.png +0 -0
  109. invocation_tree-0.0.14/images/my_range6.png +0 -0
  110. invocation_tree-0.0.14/images/my_range7.png +0 -0
  111. invocation_tree-0.0.14/images/my_range8.png +0 -0
  112. invocation_tree-0.0.14/images/my_range9.png +0 -0
  113. invocation_tree-0.0.14/images/out.txt +0 -8
  114. invocation_tree-0.0.14/images/permutations.gif +0 -0
  115. invocation_tree-0.0.14/images/permutations.py~ +0 -8
  116. invocation_tree-0.0.14/images/permutations1.png +0 -0
  117. invocation_tree-0.0.14/images/permutations10.png +0 -0
  118. invocation_tree-0.0.14/images/permutations11.png +0 -0
  119. invocation_tree-0.0.14/images/permutations12.png +0 -0
  120. invocation_tree-0.0.14/images/permutations13.png +0 -0
  121. invocation_tree-0.0.14/images/permutations2.png +0 -0
  122. invocation_tree-0.0.14/images/permutations22.png~ +0 -0
  123. invocation_tree-0.0.14/images/permutations3.png +0 -0
  124. invocation_tree-0.0.14/images/permutations4.png +0 -0
  125. invocation_tree-0.0.14/images/permutations5.png +0 -0
  126. invocation_tree-0.0.14/images/permutations6.png +0 -0
  127. invocation_tree-0.0.14/images/permutations7.png +0 -0
  128. invocation_tree-0.0.14/images/permutations8.png +0 -0
  129. invocation_tree-0.0.14/images/permutations9.png +0 -0
  130. invocation_tree-0.0.14/images/student.gif +0 -0
  131. invocation_tree-0.0.14/images/students.gif +0 -0
  132. invocation_tree-0.0.14/images/students.py~ +0 -30
  133. invocation_tree-0.0.14/images/students1.png +0 -0
  134. invocation_tree-0.0.14/images/students10.png +0 -0
  135. invocation_tree-0.0.14/images/students11.png +0 -0
  136. invocation_tree-0.0.14/images/students12.png +0 -0
  137. invocation_tree-0.0.14/images/students13.png +0 -0
  138. invocation_tree-0.0.14/images/students14.png +0 -0
  139. invocation_tree-0.0.14/images/students15.png +0 -0
  140. invocation_tree-0.0.14/images/students2.png +0 -0
  141. invocation_tree-0.0.14/images/students3.png +0 -0
  142. invocation_tree-0.0.14/images/students4.png +0 -0
  143. invocation_tree-0.0.14/images/students5.png +0 -0
  144. invocation_tree-0.0.14/images/students6.png +0 -0
  145. invocation_tree-0.0.14/images/students7.png +0 -0
  146. invocation_tree-0.0.14/images/students8.png +0 -0
  147. invocation_tree-0.0.14/images/students9.png +0 -0
  148. invocation_tree-0.0.14/images/test.py +0 -15
  149. invocation_tree-0.0.14/images/tree.gv~ +0 -22
  150. invocation_tree-0.0.14/images/tree.pdf +0 -0
  151. invocation_tree-0.0.14/install.txt +0 -31
  152. invocation_tree-0.0.14/invocation_tree.egg-info/SOURCES.txt +0 -156
  153. invocation_tree-0.0.14/setup.py +0 -35
  154. {invocation_tree-0.0.14 → invocation_tree-0.0.16}/LICENSE.txt +0 -0
  155. {invocation_tree-0.0.14 → invocation_tree-0.0.16}/MANIFEST.in +0 -0
  156. {invocation_tree-0.0.14 → invocation_tree-0.0.16}/images/compute.py +0 -0
  157. {invocation_tree-0.0.14 → invocation_tree-0.0.16}/images/factorial.py +0 -0
  158. {invocation_tree-0.0.14 → invocation_tree-0.0.16}/images/permutations.py +0 -0
  159. {invocation_tree-0.0.14 → invocation_tree-0.0.16}/images/students.py +0 -0
  160. {invocation_tree-0.0.14 → invocation_tree-0.0.16}/images/vscode.png +0 -0
  161. {invocation_tree-0.0.14 → invocation_tree-0.0.16}/invocation_tree.egg-info/dependency_links.txt +0 -0
  162. {invocation_tree-0.0.14 → invocation_tree-0.0.16}/invocation_tree.egg-info/requires.txt +0 -0
  163. {invocation_tree-0.0.14 → invocation_tree-0.0.16}/invocation_tree.egg-info/top_level.txt +0 -0
  164. {invocation_tree-0.0.14 → invocation_tree-0.0.16}/setup.cfg +0 -0
@@ -1,21 +1,47 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: invocation_tree
3
- Version: 0.0.14
4
- Summary: Generate an invocation tree of functions calls.
5
- Home-page: https://github.com/bterwijn/invocation_tree
6
- Author: Bas Terwijn
7
- Author-email: bterwijn@gmail.com
8
- License: BSD 2-clause
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://superuser.com/questions/337011/windows-pdf-viewer-that-auto-refreshes-pdf-when-compiling-with-pdflatex) 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 ([Evince](https://www.fosshub.com/Evince.html), [Okular](https://okular.kde.org/), [SumatraPDF](https://www.sumatrapdfreader.org/), ...) and set it as the default PDF reader. Another solution is to save the tree to a different [Graphviz Output Format](https://graphviz.org/docs/outputs/).
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://superuser.com/questions/337011/windows-pdf-viewer-that-auto-refreshes-pdf-when-compiling-with-pdflatex) 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 ([Evince](https://www.fosshub.com/Evince.html), [Okular](https://okular.kde.org/), [SumatraPDF](https://www.sumatrapdfreader.org/), ...) and set it as the default PDF reader. Another solution is to save the tree to a different [Graphviz Output Format](https://graphviz.org/docs/outputs/).
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.
@@ -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
 
@@ -7,7 +7,7 @@ import html
7
7
  import sys
8
8
  import difflib
9
9
 
10
- __version__ = "0.0.14"
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.render_graph(graph)
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.render_graph(graph)
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
1
+ Metadata-Version: 2.4
2
2
  Name: invocation_tree
3
- Version: 0.0.14
4
- Summary: Generate an invocation tree of functions calls.
5
- Home-page: https://github.com/bterwijn/invocation_tree
6
- Author: Bas Terwijn
7
- Author-email: bterwijn@gmail.com
8
- License: BSD 2-clause
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://superuser.com/questions/337011/windows-pdf-viewer-that-auto-refreshes-pdf-when-compiling-with-pdflatex) 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 ([Evince](https://www.fosshub.com/Evince.html), [Okular](https://okular.kde.org/), [SumatraPDF](https://www.sumatrapdfreader.org/), ...) and set it as the default PDF reader. Another solution is to save the tree to a different [Graphviz Output Format](https://graphviz.org/docs/outputs/).
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"]
@@ -1,13 +0,0 @@
1
- import invocation_tree as invo_tree
2
-
3
- def my_generator():
4
- yield 1
5
- yield 2
6
- yield 3
7
-
8
- def main():
9
- result = list(my_generator())
10
- print('result:', result)
11
-
12
- tree = invo_tree.gif('generator_function.png')
13
- tree(main)
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,4 +0,0 @@
1
-
2
- python students.py
3
- rm students0.png
4
- bash create_gif.sh students
@@ -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
@@ -1,11 +0,0 @@
1
- import invocation_tree
2
-
3
- def factorial(n):
4
- if n <= 0:
5
- return 1
6
- return n * factorial(n - 1)
7
-
8
- invocation_tree = invocation_tree.Invocation_Tree()
9
- invocation_tree.block = False
10
-
11
- print( invocation_tree(factorial, 4) )
@@ -1,9 +0,0 @@
1
- import invocation_tree as invo_tree
2
-
3
- def main():
4
- iterable_in = range(1,4)
5
- iterable_out = (i*10 for i in iterable_in) # generator expression
6
- print(list(iterable_out))
7
-
8
- tree = invo_tree.gif('generator_function.png')
9
- tree(main)
@@ -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) )