Trace every use of selected objects
Project description
Trace every use of selected objects.
Install
pip install object-trace
Example result
Given the following script
from object_trace import trace, print_traces
def producer_of_X(cache):
cache["X"] = trace(42.42, "X")
def inscrutable_user_of_X(cache):
cache["Y"] = cache["X"] + 1
cache["X"] = 15.1
with print_traces():
d = {}
producer_of_X(d)
inscrutable_user_of_X(d)
print(d["X"])
running python3.9 example.py
prints:
# Trace for label=`X`
_ : call `<module>` |
[/mnt/c/Users/alexv/repos/object_trace/example.py:1]
15 : call `producer_of_X` | producer_of_X(d)
[/mnt/c/Users/alexv/repos/object_trace/example.py:4]
5 : use | cache["X"] = trace(42.42, "X")
5 : Ref count 6->3 | cache["X"] = trace(42.42, "X")
16 : call `inscrutable_user_of_X` | inscrutable_user_of_X(d)
[/mnt/c/Users/alexv/repos/object_trace/example.py:8]
9 : use | cache["Y"] = cache["X"] + 1
10 : Ref count 3->2 | cache["X"] = 15.1
--------------------------------------------------------------------------------
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
object-trace-0.1.2.tar.gz
(5.1 kB
view hashes)
Built Distribution
Close
Hashes for object_trace-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8c3aa5deda0ce0913fbd81150565c349c41c3656462d87dc1709ddec9286ff7 |
|
MD5 | 4cb380daaeb616a903913922edd4cce1 |
|
BLAKE2b-256 | c845a9dbf94592dbabbcf6bbaba240e0d667d6858f35de5798a47268134ea36d |