Skip to main content

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


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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

object_trace-0.1.2-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file object-trace-0.1.2.tar.gz.

File metadata

  • Download URL: object-trace-0.1.2.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for object-trace-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1428fb1315b177de88c18821225f4ae4457b4995ee4a353c17ae2a5c624f8383
MD5 a6502e708e48b810f32dad5df6a6505d
BLAKE2b-256 c267feefa5aa1a37809715f8993a1fb65863652234ad22b1a14c98a791dd7873

See more details on using hashes here.

File details

Details for the file object_trace-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: object_trace-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for object_trace-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a8c3aa5deda0ce0913fbd81150565c349c41c3656462d87dc1709ddec9286ff7
MD5 4cb380daaeb616a903913922edd4cce1
BLAKE2b-256 c845a9dbf94592dbabbcf6bbaba240e0d667d6858f35de5798a47268134ea36d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page