tracerset 1.2.4__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.
Potentially problematic release.
This version of tracerset might be problematic. Click here for more details.
- tracerset-1.2.4/LICENSE +201 -0
- tracerset-1.2.4/MANIFEST.in +4 -0
- tracerset-1.2.4/PKG-INFO +334 -0
- tracerset-1.2.4/README.md +319 -0
- tracerset-1.2.4/pyproject.toml +21 -0
- tracerset-1.2.4/setup.cfg +4 -0
- tracerset-1.2.4/tracerset/__init__.py +0 -0
- tracerset-1.2.4/tracerset/tracerset.py +447 -0
- tracerset-1.2.4/tracerset/utilities/__init__.py +0 -0
- tracerset-1.2.4/tracerset/utilities/ast2dot.py +148 -0
- tracerset-1.2.4/tracerset/utilities/cst2dot.py +160 -0
- tracerset-1.2.4/tracerset/utilities/detailed.py +1531 -0
- tracerset-1.2.4/tracerset/utilities/event_recorder.py +213 -0
- tracerset-1.2.4/tracerset.egg-info/PKG-INFO +334 -0
- tracerset-1.2.4/tracerset.egg-info/SOURCES.txt +17 -0
- tracerset-1.2.4/tracerset.egg-info/dependency_links.txt +1 -0
- tracerset-1.2.4/tracerset.egg-info/entry_points.txt +2 -0
- tracerset-1.2.4/tracerset.egg-info/requires.txt +6 -0
- tracerset-1.2.4/tracerset.egg-info/top_level.txt +1 -0
tracerset-1.2.4/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
tracerset-1.2.4/PKG-INFO
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tracerset
|
|
3
|
+
Version: 1.2.4
|
|
4
|
+
Summary: Execution-Centric Program Comprehension Environment for Python
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Dist: graphviz
|
|
9
|
+
Requires-Dist: libcst
|
|
10
|
+
Requires-Dist: python_ta
|
|
11
|
+
Requires-Dist: xdot
|
|
12
|
+
Requires-Dist: pytest
|
|
13
|
+
Requires-Dist: complexipy
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# TracerSET v1.2.4
|
|
17
|
+
|
|
18
|
+
**Execution-Centric Program Comprehension Environment for Python**
|
|
19
|
+
|
|
20
|
+
TracerSET is a [program comprehension](https://en.wikipedia.org/wiki/Program_comprehension) environment for Python that combines complementary structural representations with runtime execution inspection. It provides token, syntax-tree, control-flow, cognitive-complexity, and bytecode views alongside step-by-step execution tracing. Selected token, AST, and bytecode views are associated with traced source lines, helping users explore relationships between program structure and concrete execution behavior. These associations do not imply that every displayed structural element was evaluated during that execution step.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
## System Requirements
|
|
24
|
+
- Python >=3.10
|
|
25
|
+
- Linux, Windows, and macOS; visualization and artifact-opening behavior varies by platform
|
|
26
|
+
- Download from [here](https://github.com/SET-IITGN/TracerSET/releases/download/v1.2.4/tracerset-1.2.4-py3-none-any.whl), and Install using ```pip3 install tracerset-1.2.4-py3-none-any.whl```
|
|
27
|
+
- Uninstall using ```pip3 uninstall tracerset-1.2.4-py3-none-any.whl```
|
|
28
|
+
|
|
29
|
+
### Other dependencies
|
|
30
|
+
(non-exhaustive)
|
|
31
|
+
```
|
|
32
|
+
graphviz
|
|
33
|
+
libcst
|
|
34
|
+
python_ta
|
|
35
|
+
xdot
|
|
36
|
+
pytest
|
|
37
|
+
complexipy
|
|
38
|
+
```
|
|
39
|
+
---
|
|
40
|
+
## Table of Contents
|
|
41
|
+
- [Key Idea](#key-idea)
|
|
42
|
+
- [Features](#features)
|
|
43
|
+
- [Automatic JSON Recording](#automatic-json-recording)
|
|
44
|
+
- [Usage](#usage)
|
|
45
|
+
- [Beginner](#beginner)
|
|
46
|
+
- [Intermediate](#intermediate)
|
|
47
|
+
- [Advanced](#advanced)
|
|
48
|
+
- [Screenshots](#screenshots)
|
|
49
|
+
- [Video Demonstrations](#video-demonstrations)
|
|
50
|
+
- [System Requirements](#system-requirements)
|
|
51
|
+
- [Design Philosophy](#design-philosophy)
|
|
52
|
+
- [Notes on Python Bytecode and Runtime Behavior](#notes-on-python-bytecode-and-runtime-behavior)
|
|
53
|
+
- [Limitations](#limitations)
|
|
54
|
+
- [Responsible Use Notice](#responsible-use-notice)
|
|
55
|
+
- [Contact](#contact)
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Key Idea
|
|
60
|
+
Program understanding typically relies on separate tools and views:
|
|
61
|
+
- Source-level debugging (runtime execution)
|
|
62
|
+
- Static structure analysis (AST, CST)
|
|
63
|
+
- Control-flow reasoning (CFG)
|
|
64
|
+
- Cognitive complexity analysis
|
|
65
|
+
- Bytecode inspection
|
|
66
|
+
- Execution tracing tools
|
|
67
|
+
|
|
68
|
+
TracerSET presents these perspectives in a single environment where:
|
|
69
|
+
- Structural analyses and representations are presented before traced execution
|
|
70
|
+
- Runtime behavior is inspected through tracing events
|
|
71
|
+
- Selected token, AST, and bytecode information is associated with traced source lines
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Features
|
|
75
|
+
- Step-by-step execution tracing of Python programs
|
|
76
|
+
- Runtime stack visualization
|
|
77
|
+
- Local and global binding inspection at runtime tracing events
|
|
78
|
+
- At displayed line events, variable state is inspected before execution associated with the reported source line
|
|
79
|
+
- Advanced-mode alias sets grouping selected local and global bindings that refer to the same object
|
|
80
|
+
- Runtime scope views represent bindings visible from the inspected frame, not physical object-storage locations
|
|
81
|
+
- Source code highlighting during execution
|
|
82
|
+
- Token stream analysis (whole-program and execution-aligned views)
|
|
83
|
+
- Concrete Syntax Tree (CST) visualization
|
|
84
|
+
- Abstract Syntax Tree (AST) analysis (whole-program and execution-aligned views)
|
|
85
|
+
- Control Flow Graph (CFG) generation
|
|
86
|
+
- Python bytecode disassembly and source-line-associated instruction views
|
|
87
|
+
- Execution tracing via Python `trace` module
|
|
88
|
+
- Alias sets (advanced mode)
|
|
89
|
+
- Cognitive complexity score
|
|
90
|
+
- Automatic advanced-mode JSON recording of TracerSET events alongside the existing terminal display
|
|
91
|
+
- Progressive learning modes:
|
|
92
|
+
- Beginner (default)
|
|
93
|
+
- Intermediate
|
|
94
|
+
- Advanced
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Automatic JSON Recording
|
|
98
|
+
|
|
99
|
+
In advanced mode, TracerSET automatically records events from its detailed trace in a JSON file while preserving the existing terminal display and interactive stepping.
|
|
100
|
+
|
|
101
|
+
### Invocation and Output Location
|
|
102
|
+
|
|
103
|
+
No environment variables or additional command-line options are required:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
python3 tracerset.py advanced factorial.py
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The recording is created in the same directory as the target source file:
|
|
110
|
+
|
|
111
|
+
```text
|
|
112
|
+
factorial.py
|
|
113
|
+
factorial-tracerset.json
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
For a target such as `examples/factorial.py`, the recording is written to
|
|
117
|
+
`examples/factorial-tracerset.json`.
|
|
118
|
+
|
|
119
|
+
The output filename follows the pattern `<source-stem>-tracerset.json`.
|
|
120
|
+
|
|
121
|
+
### Recording Scope
|
|
122
|
+
|
|
123
|
+
- Recording is enabled only in advanced mode.
|
|
124
|
+
- Only events from TracerSET's detailed trace are recorded.
|
|
125
|
+
- Built-in Python `trace` output is not included.
|
|
126
|
+
- Earlier structural-analysis output and target stdout/stderr are not captured.
|
|
127
|
+
- Terminal displays, colors, and interactive pauses remain available.
|
|
128
|
+
- Beginner and intermediate modes do not create or update the JSON file.
|
|
129
|
+
|
|
130
|
+
The recording represents the TracerSET execution only. Intermediate and advanced modes still perform the separate executions described under Execution Behavior.
|
|
131
|
+
|
|
132
|
+
### Recorded Information
|
|
133
|
+
|
|
134
|
+
The JSON contains run metadata, an ordered event list, and a recording
|
|
135
|
+
summary.
|
|
136
|
+
|
|
137
|
+
Recorded TracerSET event types are:
|
|
138
|
+
- Function calls
|
|
139
|
+
- Source-line events
|
|
140
|
+
- Return events
|
|
141
|
+
- Exception events
|
|
142
|
+
|
|
143
|
+
Depending on the event, recorded information includes:
|
|
144
|
+
- Event sequence number and elapsed time
|
|
145
|
+
- Source filename, line number, and function name
|
|
146
|
+
- Source-line text and runtime stack context
|
|
147
|
+
- Bounded snapshots of filtered local and global display values
|
|
148
|
+
- Binding identities and alias information
|
|
149
|
+
- Return values or exception information
|
|
150
|
+
|
|
151
|
+
Advanced source-line events additionally include:
|
|
152
|
+
- Source-associated token information
|
|
153
|
+
- Selected AST fragments
|
|
154
|
+
- Source-associated bytecode instructions
|
|
155
|
+
|
|
156
|
+
These structural associations do not establish that every displayed
|
|
157
|
+
element or bytecode instruction executed during that event.
|
|
158
|
+
|
|
159
|
+
The JSON is a structured event export, not a verbatim terminal transcript.
|
|
160
|
+
Some variable values have already been transformed by the terminal-display
|
|
161
|
+
logic. Arbitrary objects may be represented by type and identity rather
|
|
162
|
+
than complete object contents.
|
|
163
|
+
|
|
164
|
+
### Repeated Runs and Overwriting
|
|
165
|
+
|
|
166
|
+
Each advanced-mode run replaces the previous JSON recording for the same
|
|
167
|
+
target source file. Events are not appended across runs.
|
|
168
|
+
|
|
169
|
+
The previous contents are erased when the recorder opens the destination.
|
|
170
|
+
Copy or rename a recording before another advanced-mode run if it must
|
|
171
|
+
be retained.
|
|
172
|
+
|
|
173
|
+
Beginner and intermediate runs leave an existing recording untouched.
|
|
174
|
+
|
|
175
|
+
### Recording Limits and Precautions
|
|
176
|
+
|
|
177
|
+
- Variable snapshots are bounded; large or deeply nested values may be truncated.
|
|
178
|
+
- Object identities are process-local and may be reused after object destruction.
|
|
179
|
+
- Recording adds snapshotting and file-I/O overhead.
|
|
180
|
+
- Large executions may produce substantial output files.
|
|
181
|
+
- The target directory must be writable for automatic recording to succeed.
|
|
182
|
+
- An interrupted process or write failure may leave incomplete JSON.
|
|
183
|
+
- Recorder finalization does not, by itself, establish target-program success.
|
|
184
|
+
- Recordings may contain sensitive program data and should be handled accordingly.
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Usage
|
|
189
|
+
```
|
|
190
|
+
tracerset [file.py] #reads from terminal (stdin) if no file provided, mode defaults to beginner if no mode provided
|
|
191
|
+
tracerset beginner [file.py] #reads from terminal (stdin) if no file provided
|
|
192
|
+
tracerset intermediate [file.py] #reads from terminal (stdin) if no file provided
|
|
193
|
+
tracerset advanced [file.py] #reads from terminal (stdin) if no file provided
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Execution Behavior
|
|
197
|
+
|
|
198
|
+
Beginner mode runs the target through the TracerSET's trace. Intermediate and advanced modes run the target separately through Python's `trace` module and then through the TracerSET's trace. These are separate executions, not two views of one recorded run. Programs may request input or produce side effects more than once. Randomness, time-dependent values, files, and other external state may
|
|
199
|
+
differ between runs. Interactive pauses are enabled when standard input is a terminal. When source is supplied through stdin, input is read until EOF.
|
|
200
|
+
|
|
201
|
+
### ```beginner``` mode
|
|
202
|
+
Focuses on **basic runtime understanding of program execution**.
|
|
203
|
+
|
|
204
|
+
This mode (default) is designed for first-time programmers to understand how a Python program runs step by step.
|
|
205
|
+
Includes:
|
|
206
|
+
- Source code display and highlighting
|
|
207
|
+
- Step-by-step execution-event display
|
|
208
|
+
- Local and global variable inspection
|
|
209
|
+
- Runtime stack display
|
|
210
|
+
- Return-value and exception reporting
|
|
211
|
+
|
|
212
|
+
At this stage, the learner primarily observes execution flow. Token, syntax-tree, CFG, and bytecode views are not introduced in this mode.
|
|
213
|
+
|
|
214
|
+
### ```intermediate``` mode
|
|
215
|
+
Focuses on **connecting program structure with runtime execution**.
|
|
216
|
+
|
|
217
|
+
This mode builds on beginner by introducing structural understanding of the program while still emphasizing execution.
|
|
218
|
+
Includes:
|
|
219
|
+
- Source code display
|
|
220
|
+
- Control Flow Graph (CFG)
|
|
221
|
+
- Abstract Syntax Tree (AST) visualization
|
|
222
|
+
- Program execution trace (Python trace module output)
|
|
223
|
+
- Step-by-step program execution trace (TracerSET)
|
|
224
|
+
- Cognitive complexity analysis (function-level complexity metrics via external analyzers)
|
|
225
|
+
|
|
226
|
+
This stage helps the learner connect:
|
|
227
|
+
- How the program is structured (AST)
|
|
228
|
+
- How the program executes (trace + step-by-step execution)
|
|
229
|
+
|
|
230
|
+
Tokens, CST, and bytecode are not introduced yet.
|
|
231
|
+
|
|
232
|
+
### ```advanced``` mode
|
|
233
|
+
Focuses on **detailed structural representations and runtime behavior**.
|
|
234
|
+
|
|
235
|
+
This mode exposes both compiler-level structure and detailed runtime behavior for deep analysis.
|
|
236
|
+
Includes:
|
|
237
|
+
- Source code display
|
|
238
|
+
- Control Flow Graph (CFG)
|
|
239
|
+
- Whole-program token stream analysis
|
|
240
|
+
- Execution-aligned token stream visualization
|
|
241
|
+
- Concrete Syntax Tree (CST)
|
|
242
|
+
- Whole-program Abstract Syntax Tree (AST)
|
|
243
|
+
- Execution-aligned AST visualization
|
|
244
|
+
- Whole-program Python bytecode disassembly
|
|
245
|
+
- Execution-aligned VM instruction visualization
|
|
246
|
+
- Program execution trace (Python trace module output)
|
|
247
|
+
- Step-by-step program execution trace (TracerSET)
|
|
248
|
+
- Execution-aligned Alias sets (ALIAS)
|
|
249
|
+
- Automatic JSON recording of TracerSET events to `<source-stem>-tracerset.json` beside the target source file
|
|
250
|
+
- Cognitive complexity analysis (function-level complexity metrics via external analyzers)
|
|
251
|
+
|
|
252
|
+
This mode brings together complementary perspectives on:
|
|
253
|
+
- Token information selected by traced source line
|
|
254
|
+
- Selected AST fragments associated with traced source lines
|
|
255
|
+
- Bytecode instructions associated with traced source lines in the current code object
|
|
256
|
+
- Alias sets for selected direct local/global bindings
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Screenshots
|
|
261
|
+
**Version 1.0.2**
|
|
262
|
+
<img width="1920" height="867" alt="TracerSET Screenshot" src="https://github.com/user-attachments/assets/5f844c58-260c-43d5-b75c-43dd4f446dc3" />
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## Video Demonstrations
|
|
267
|
+
**Version 1.0.2**
|
|
268
|
+
- [Recursive program execution](https://drive.google.com/file/d/1MAl578WOT7DtDi_TZLdOyqpdHjXAL0Q5/view?usp=sharing)
|
|
269
|
+
- [Programs using imports](https://drive.google.com/file/d/1UqJ2msjRhtzBqg6Dex_61MBzc8nuI8yQ/view?usp=sharing)
|
|
270
|
+
- More demonstrations coming soon
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
## Design Philosophy
|
|
274
|
+
TracerSET organizes program comprehension around three complementary
|
|
275
|
+
kinds of information:
|
|
276
|
+
|
|
277
|
+
- **Structural context**: tokens, CST, AST, CFG, cognitive complexity, and bytecode disassembly
|
|
278
|
+
- **Runtime observations**: execution events, stack context, variable bindings, return values, and exceptions
|
|
279
|
+
- **Execution-associated representations**: selected token, AST, and bytecode information mapped to traced source lines
|
|
280
|
+
|
|
281
|
+
Alias sets are derived from object identity among selected bindings in the inspected frame's local and global namespaces.
|
|
282
|
+
|
|
283
|
+
Structural views provide context for interpreting runtime behavior. Source-line association does not establish that every displayed token, AST element, or bytecode instruction was evaluated.
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## Notes on Python Bytecode and Runtime Behavior
|
|
288
|
+
|
|
289
|
+
TracerSET provides CPython bytecode disassembly and, in advanced mode, displays instructions associated with traced source lines in the current code object.
|
|
290
|
+
|
|
291
|
+
The execution-associated VM view is based on source-line mappings. It is not an instruction-by-instruction record of observed opcode execution. A displayed instruction's association with a traced line does not establish that it executed during that visit.
|
|
292
|
+
|
|
293
|
+
Important considerations:
|
|
294
|
+
- One source line may correspond to multiple instructions
|
|
295
|
+
- Control flow may execute only part of the code associated with a line
|
|
296
|
+
- Instruction sequences and source mappings vary across Python versions
|
|
297
|
+
- Some instruction details are omitted or formatted for presentation
|
|
298
|
+
- Bytecode is interpreter-specific and should not be treated as a portable language-level representation
|
|
299
|
+
|
|
300
|
+
Interpret this view as compiler-generated instructions associated with an execution location, alongside the separately observed runtime state.
|
|
301
|
+
|
|
302
|
+
### Analysis Scope
|
|
303
|
+
|
|
304
|
+
In this documentation, whole-input views refer to analysis of the supplied source file. Some structural analyses additionally discover selected local Python modules. Coverage of imported code differs between analyses and is not comprehensive.
|
|
305
|
+
|
|
306
|
+
## Limitations
|
|
307
|
+
- Currently supports Python programs only.
|
|
308
|
+
- Execution incurs runtime overhead due to tracing and analysis.
|
|
309
|
+
- Best suited for small to medium-sized programs used for education and program comprehension.
|
|
310
|
+
- Large or deeply recursive programs may produce verbose traces.
|
|
311
|
+
- Trace behavior, bytecode, and VM instruction sequences may vary across Python versions and runtime environments.
|
|
312
|
+
- Bytecode disassembly and VM-level execution views are CPython-specific and may not generalize to implementations such as PyPy or Jython.
|
|
313
|
+
- A single source line may map to multiple VM instructions, and mappings are interpreter-dependent.
|
|
314
|
+
- Execution-aligned views are driven by Python tracing events and source-line mappings. Multi-line expressions, comprehensions, generator expressions, lambdas, and other compiler-generated constructs may produce execution events that do not correspond to complete source-level statements, reflecting the behavior of the underlying Python interpreter.
|
|
315
|
+
- Dynamic features such as `exec`, `eval`, metaprogramming, and runtime code generation may reduce trace precision.
|
|
316
|
+
- Advanced concurrency features (threads, multiprocessing, async execution) are not fully supported; tracing is limited to the currently executing Python thread and frame context, without coverage of inter-process execution or event-loop-level scheduling.
|
|
317
|
+
- Not intended as a replacement for production-grade debuggers or profilers.
|
|
318
|
+
- Some visualization features depend on external tools such as Graphviz and xdot.
|
|
319
|
+
- Cognitive complexity analysis relies on external tooling and may vary across tool versions and environments.
|
|
320
|
+
- Different views may cover different file sets. Local-import discovery is limited and does not implement complete Python package/import resolution.
|
|
321
|
+
- Token alignment uses token starting lines. AST alignment uses node starting lines and displays selected fragments. Multiple statements on one line, multiline constructs, and nested code objects can limit correspondence.
|
|
322
|
+
- Alias sets cover selected direct bindings in the current frame's local and global namespaces. They do not recursively enumerate references through containers, attributes, or all other frames.
|
|
323
|
+
- Object inspection and formatting may invoke user-defined representation or attribute-access behavior. Tracing and inspection are not guaranteed to be observationally neutral.
|
|
324
|
+
- TracerSET executes the target within a constructed execution environment. It does not reproduce every aspect of direct script execution, including target-specific command-line argument handling.
|
|
325
|
+
- Current output consists of terminal displays and generated analysis artifacts. Advanced mode now provides structured JSON export of TracerSET events. JSONL export is not currently provided.
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## Responsible Use Notice
|
|
330
|
+
During the preparation of the content in this repository, the developers were assisted by Generative AI tools to some extent. The content was reviewed and edited as needed and developers take full responsibility for the content in this repository. Regardless of this, bugs may still exist!
|
|
331
|
+
|
|
332
|
+
## Contact
|
|
333
|
+
Shouvick Mondal
|
|
334
|
+
shouvick.mondal@iitgn.ac.in
|