atrace 0.1.0__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.
- atrace-0.1.0/.github/workflows/publish-to-pypi.yml +30 -0
- atrace-0.1.0/.gitignore +13 -0
- atrace-0.1.0/.python-version +1 -0
- atrace-0.1.0/PKG-INFO +5 -0
- atrace-0.1.0/README.md +0 -0
- atrace-0.1.0/pyproject.toml +12 -0
- atrace-0.1.0/src/atrace/__init__.py +2 -0
- atrace-0.1.0/src/atrace/py.typed +0 -0
- atrace-0.1.0/src/experiments/devto_example.py +58 -0
- atrace-0.1.0/src/experiments/pytracetool_example.py +13 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# From https://docs.astral.sh/uv/guides/integration/github/#publishing-to-pypi
|
|
2
|
+
name: "Publish to pypi"
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
# Runs on pushes targeting the default branch
|
|
6
|
+
push:
|
|
7
|
+
branches: ["main"]
|
|
8
|
+
|
|
9
|
+
# Allows you to run this workflow manually from the Actions tab
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
run:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
environment:
|
|
16
|
+
name: pypi
|
|
17
|
+
permissions:
|
|
18
|
+
id-token: write
|
|
19
|
+
contents: read
|
|
20
|
+
steps:
|
|
21
|
+
- name: Checkout
|
|
22
|
+
uses: actions/checkout@v5
|
|
23
|
+
- name: Install uv
|
|
24
|
+
uses: astral-sh/setup-uv@v7
|
|
25
|
+
- name: Install Python 3.13
|
|
26
|
+
run: uv python install 3.13
|
|
27
|
+
- name: Build
|
|
28
|
+
run: uv build
|
|
29
|
+
- name: Publish
|
|
30
|
+
run: uv publish
|
atrace-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
atrace-0.1.0/PKG-INFO
ADDED
atrace-0.1.0/README.md
ADDED
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "atrace"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = ""
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [{ name = "Nicholas Wolff", email = "nwolff@gmail.com" }]
|
|
7
|
+
requires-python = ">=3.7"
|
|
8
|
+
dependencies = []
|
|
9
|
+
|
|
10
|
+
[build-system]
|
|
11
|
+
requires = ["hatchling"]
|
|
12
|
+
build-backend = "hatchling.build"
|
|
File without changes
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def trace_vars(frame, event, arg):
|
|
5
|
+
|
|
6
|
+
if event != "line":
|
|
7
|
+
return trace_vars
|
|
8
|
+
code = frame.f_code
|
|
9
|
+
lineno = frame.f_lineno
|
|
10
|
+
locals_now = frame.f_locals.copy()
|
|
11
|
+
global last_locals
|
|
12
|
+
|
|
13
|
+
if code.co_name not in last_locals:
|
|
14
|
+
last_locals[code.co_name] = locals_now
|
|
15
|
+
return trace_vars
|
|
16
|
+
|
|
17
|
+
old_locals = last_locals[code.co_name]
|
|
18
|
+
|
|
19
|
+
for var, new_val in locals_now.items():
|
|
20
|
+
if var not in old_locals:
|
|
21
|
+
print(f"[{code.co_name}:{lineno}] NEW {var} = {new_val}")
|
|
22
|
+
elif old_locals[var] != new_val:
|
|
23
|
+
print(
|
|
24
|
+
f"[{code.co_name}:{lineno}] MODIFIED {var}: {old_locals[var]} → {new_val}"
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
for var in old_locals:
|
|
28
|
+
if var not in locals_now:
|
|
29
|
+
print(f"[{code.co_name}:{lineno}] DELETED {var}")
|
|
30
|
+
|
|
31
|
+
last_locals[code.co_name] = locals_now
|
|
32
|
+
return trace_vars
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def monitor(func):
|
|
36
|
+
|
|
37
|
+
def wrapper(*args, **kwargs):
|
|
38
|
+
global last_locals
|
|
39
|
+
last_locals = {}
|
|
40
|
+
sys.settrace(trace_vars)
|
|
41
|
+
try:
|
|
42
|
+
return func(*args, **kwargs)
|
|
43
|
+
finally:
|
|
44
|
+
sys.settrace(None)
|
|
45
|
+
|
|
46
|
+
return wrapper
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@monitor
|
|
50
|
+
def run_example():
|
|
51
|
+
a = 10
|
|
52
|
+
b = a + 5
|
|
53
|
+
b = b * 2
|
|
54
|
+
del a
|
|
55
|
+
return b
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
run_example()
|