treeloom 0.2.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.
Files changed (135) hide show
  1. treeloom-0.2.0/.claude/commands/create-release.md +17 -0
  2. treeloom-0.2.0/.github/workflows/release.yml +115 -0
  3. treeloom-0.2.0/.github/workflows/test.yml +79 -0
  4. treeloom-0.2.0/.gitignore +15 -0
  5. treeloom-0.2.0/CLAUDE.md +890 -0
  6. treeloom-0.2.0/PKG-INFO +277 -0
  7. treeloom-0.2.0/README.md +229 -0
  8. treeloom-0.2.0/RESEARCH.md +221 -0
  9. treeloom-0.2.0/docs/sanicode-integration.md +333 -0
  10. treeloom-0.2.0/llms-full.txt +329 -0
  11. treeloom-0.2.0/llms.txt +49 -0
  12. treeloom-0.2.0/pyproject.toml +71 -0
  13. treeloom-0.2.0/scripts/release.sh +104 -0
  14. treeloom-0.2.0/scripts/scaffold.sh +35 -0
  15. treeloom-0.2.0/src/treeloom/__init__.py +60 -0
  16. treeloom-0.2.0/src/treeloom/analysis/__init__.py +25 -0
  17. treeloom-0.2.0/src/treeloom/analysis/reachability.py +117 -0
  18. treeloom-0.2.0/src/treeloom/analysis/summary.py +124 -0
  19. treeloom-0.2.0/src/treeloom/analysis/taint.py +308 -0
  20. treeloom-0.2.0/src/treeloom/cli/__init__.py +0 -0
  21. treeloom-0.2.0/src/treeloom/cli/_util.py +89 -0
  22. treeloom-0.2.0/src/treeloom/cli/build.py +51 -0
  23. treeloom-0.2.0/src/treeloom/cli/config.py +178 -0
  24. treeloom-0.2.0/src/treeloom/cli/dot_cmd.py +95 -0
  25. treeloom-0.2.0/src/treeloom/cli/info.py +76 -0
  26. treeloom-0.2.0/src/treeloom/cli/main.py +67 -0
  27. treeloom-0.2.0/src/treeloom/cli/query.py +100 -0
  28. treeloom-0.2.0/src/treeloom/cli/taint_cmd.py +269 -0
  29. treeloom-0.2.0/src/treeloom/cli/viz_cmd.py +60 -0
  30. treeloom-0.2.0/src/treeloom/export/__init__.py +7 -0
  31. treeloom-0.2.0/src/treeloom/export/dot.py +105 -0
  32. treeloom-0.2.0/src/treeloom/export/html.py +499 -0
  33. treeloom-0.2.0/src/treeloom/export/json.py +26 -0
  34. treeloom-0.2.0/src/treeloom/graph/__init__.py +12 -0
  35. treeloom-0.2.0/src/treeloom/graph/backend.py +136 -0
  36. treeloom-0.2.0/src/treeloom/graph/builder.py +461 -0
  37. treeloom-0.2.0/src/treeloom/graph/cpg.py +305 -0
  38. treeloom-0.2.0/src/treeloom/lang/__init__.py +12 -0
  39. treeloom-0.2.0/src/treeloom/lang/base.py +87 -0
  40. treeloom-0.2.0/src/treeloom/lang/builtin/__init__.py +1 -0
  41. treeloom-0.2.0/src/treeloom/lang/builtin/c.py +490 -0
  42. treeloom-0.2.0/src/treeloom/lang/builtin/cpp.py +681 -0
  43. treeloom-0.2.0/src/treeloom/lang/builtin/go.py +636 -0
  44. treeloom-0.2.0/src/treeloom/lang/builtin/java.py +584 -0
  45. treeloom-0.2.0/src/treeloom/lang/builtin/javascript.py +672 -0
  46. treeloom-0.2.0/src/treeloom/lang/builtin/python.py +578 -0
  47. treeloom-0.2.0/src/treeloom/lang/builtin/rust.py +622 -0
  48. treeloom-0.2.0/src/treeloom/lang/builtin/typescript.py +637 -0
  49. treeloom-0.2.0/src/treeloom/lang/protocol.py +143 -0
  50. treeloom-0.2.0/src/treeloom/lang/registry.py +108 -0
  51. treeloom-0.2.0/src/treeloom/model/__init__.py +15 -0
  52. treeloom-0.2.0/src/treeloom/model/edges.py +44 -0
  53. treeloom-0.2.0/src/treeloom/model/location.py +52 -0
  54. treeloom-0.2.0/src/treeloom/model/nodes.py +65 -0
  55. treeloom-0.2.0/src/treeloom/overlay/__init__.py +5 -0
  56. treeloom-0.2.0/src/treeloom/overlay/api.py +57 -0
  57. treeloom-0.2.0/src/treeloom/query/__init__.py +6 -0
  58. treeloom-0.2.0/src/treeloom/query/api.py +263 -0
  59. treeloom-0.2.0/src/treeloom/query/pattern.py +146 -0
  60. treeloom-0.2.0/src/treeloom/version.py +1 -0
  61. treeloom-0.2.0/tests/__init__.py +0 -0
  62. treeloom-0.2.0/tests/analysis/__init__.py +0 -0
  63. treeloom-0.2.0/tests/analysis/conftest.py +44 -0
  64. treeloom-0.2.0/tests/analysis/test_reachability.py +102 -0
  65. treeloom-0.2.0/tests/analysis/test_summary.py +118 -0
  66. treeloom-0.2.0/tests/analysis/test_taint.py +327 -0
  67. treeloom-0.2.0/tests/conftest.py +1 -0
  68. treeloom-0.2.0/tests/export/__init__.py +0 -0
  69. treeloom-0.2.0/tests/export/test_dot.py +120 -0
  70. treeloom-0.2.0/tests/export/test_html.py +126 -0
  71. treeloom-0.2.0/tests/export/test_json.py +130 -0
  72. treeloom-0.2.0/tests/export/test_overlay.py +72 -0
  73. treeloom-0.2.0/tests/fixtures/c/control_flow.c +18 -0
  74. treeloom-0.2.0/tests/fixtures/c/simple_function.c +6 -0
  75. treeloom-0.2.0/tests/fixtures/c/struct_example.c +18 -0
  76. treeloom-0.2.0/tests/fixtures/cpp/control_flow.cpp +42 -0
  77. treeloom-0.2.0/tests/fixtures/cpp/functions.cpp +28 -0
  78. treeloom-0.2.0/tests/fixtures/cpp/simple_class.cpp +33 -0
  79. treeloom-0.2.0/tests/fixtures/go/control_flow.go +27 -0
  80. treeloom-0.2.0/tests/fixtures/go/imports.go +13 -0
  81. treeloom-0.2.0/tests/fixtures/go/simple_function.go +6 -0
  82. treeloom-0.2.0/tests/fixtures/go/struct_methods.go +23 -0
  83. treeloom-0.2.0/tests/fixtures/java/ControlFlow.java +35 -0
  84. treeloom-0.2.0/tests/fixtures/java/Interfaces.java +23 -0
  85. treeloom-0.2.0/tests/fixtures/java/SimpleClass.java +23 -0
  86. treeloom-0.2.0/tests/fixtures/javascript/arrow_functions.js +11 -0
  87. treeloom-0.2.0/tests/fixtures/javascript/class_with_methods.js +14 -0
  88. treeloom-0.2.0/tests/fixtures/javascript/control_flow.js +19 -0
  89. treeloom-0.2.0/tests/fixtures/javascript/imports.js +7 -0
  90. treeloom-0.2.0/tests/fixtures/javascript/simple_function.js +4 -0
  91. treeloom-0.2.0/tests/fixtures/python/augmented_assignment.py +5 -0
  92. treeloom-0.2.0/tests/fixtures/python/class_with_methods.py +10 -0
  93. treeloom-0.2.0/tests/fixtures/python/control_flow.py +13 -0
  94. treeloom-0.2.0/tests/fixtures/python/data_flow.py +10 -0
  95. treeloom-0.2.0/tests/fixtures/python/function_calls.py +7 -0
  96. treeloom-0.2.0/tests/fixtures/python/imports.py +4 -0
  97. treeloom-0.2.0/tests/fixtures/python/simple_function.py +3 -0
  98. treeloom-0.2.0/tests/fixtures/rust/control_flow.rs +43 -0
  99. treeloom-0.2.0/tests/fixtures/rust/simple_function.rs +4 -0
  100. treeloom-0.2.0/tests/fixtures/rust/struct_impl.rs +26 -0
  101. treeloom-0.2.0/tests/fixtures/typescript/class_with_types.ts +31 -0
  102. treeloom-0.2.0/tests/fixtures/typescript/imports.ts +7 -0
  103. treeloom-0.2.0/tests/fixtures/typescript/interfaces.ts +22 -0
  104. treeloom-0.2.0/tests/fixtures/typescript/simple_function.ts +11 -0
  105. treeloom-0.2.0/tests/graph/__init__.py +0 -0
  106. treeloom-0.2.0/tests/graph/test_backend.py +194 -0
  107. treeloom-0.2.0/tests/graph/test_builder.py +244 -0
  108. treeloom-0.2.0/tests/graph/test_cpg.py +264 -0
  109. treeloom-0.2.0/tests/lang/__init__.py +0 -0
  110. treeloom-0.2.0/tests/lang/test_base.py +74 -0
  111. treeloom-0.2.0/tests/lang/test_c.py +258 -0
  112. treeloom-0.2.0/tests/lang/test_cpp.py +434 -0
  113. treeloom-0.2.0/tests/lang/test_go.py +200 -0
  114. treeloom-0.2.0/tests/lang/test_java.py +317 -0
  115. treeloom-0.2.0/tests/lang/test_javascript.py +289 -0
  116. treeloom-0.2.0/tests/lang/test_python.py +348 -0
  117. treeloom-0.2.0/tests/lang/test_registry.py +46 -0
  118. treeloom-0.2.0/tests/lang/test_rust.py +247 -0
  119. treeloom-0.2.0/tests/lang/test_typescript.py +216 -0
  120. treeloom-0.2.0/tests/model/__init__.py +0 -0
  121. treeloom-0.2.0/tests/model/test_edges.py +69 -0
  122. treeloom-0.2.0/tests/model/test_location.py +149 -0
  123. treeloom-0.2.0/tests/model/test_nodes.py +124 -0
  124. treeloom-0.2.0/tests/query/__init__.py +0 -0
  125. treeloom-0.2.0/tests/query/conftest.py +104 -0
  126. treeloom-0.2.0/tests/query/test_api.py +243 -0
  127. treeloom-0.2.0/tests/query/test_pattern.py +361 -0
  128. treeloom-0.2.0/tests/test_cli/__init__.py +0 -0
  129. treeloom-0.2.0/tests/test_cli/test_build.py +116 -0
  130. treeloom-0.2.0/tests/test_cli/test_config.py +83 -0
  131. treeloom-0.2.0/tests/test_cli/test_dot_cmd.py +126 -0
  132. treeloom-0.2.0/tests/test_cli/test_info.py +58 -0
  133. treeloom-0.2.0/tests/test_cli/test_query.py +125 -0
  134. treeloom-0.2.0/tests/test_cli/test_taint_cmd.py +267 -0
  135. treeloom-0.2.0/tests/test_cli/test_viz_cmd.py +77 -0
@@ -0,0 +1,17 @@
1
+ # Create Release
2
+
3
+ Help me create a new release of treeloom.
4
+
5
+ ## Steps
6
+
7
+ 1. Ask me for the version number (should follow semver: major.minor.patch)
8
+ 2. Ask me for a brief description of what changed in this release
9
+ 3. Update the changelog section in README.md with the new version entry (newest first)
10
+ 4. Run the release script: `./scripts/release.sh <version> "<description>"`
11
+
12
+ ## Notes
13
+
14
+ - The release script handles updating version.py, pyproject.toml, committing, tagging, and pushing
15
+ - GitHub Actions will automatically create a GitHub Release and publish to PyPI
16
+ - Make sure all tests pass before releasing: `pytest`
17
+ - Make sure linting passes: `ruff check src tests`
@@ -0,0 +1,115 @@
1
+ name: Release and Publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*.*.*'
7
+
8
+ permissions:
9
+ contents: write
10
+ id-token: write
11
+
12
+ jobs:
13
+ create-release:
14
+ name: Create GitHub Release
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Wait for tests to pass
21
+ uses: lewagon/wait-on-check-action@v1.3.1
22
+ with:
23
+ ref: ${{ github.ref }}
24
+ check-regexp: 'Test on Python'
25
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
26
+ wait-interval: 10
27
+
28
+ - name: Extract version from tag
29
+ id: version
30
+ run: |
31
+ VERSION=${GITHUB_REF#refs/tags/v}
32
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
33
+ echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
34
+
35
+ - name: Read version from version.py
36
+ id: read_version
37
+ run: |
38
+ VERSION_PY=$(grep -E '^__version__' src/treeloom/version.py | cut -d'"' -f2)
39
+ echo "version_py=$VERSION_PY" >> $GITHUB_OUTPUT
40
+
41
+ - name: Verify version match
42
+ run: |
43
+ if [ "${{ steps.version.outputs.version }}" != "${{ steps.read_version.outputs.version_py }}" ]; then
44
+ echo "Error: Tag version (${{ steps.version.outputs.version }}) does not match version.py (${{ steps.read_version.outputs.version_py }})"
45
+ exit 1
46
+ fi
47
+
48
+ - name: Extract changelog for this version
49
+ id: changelog
50
+ run: |
51
+ VERSION="${{ steps.version.outputs.version }}"
52
+ CHANGELOG=$(awk "/### Version $VERSION/,/### Version [0-9]/ { if (/### Version [0-9]/ && !/### Version $VERSION/) exit; if (!/### Version $VERSION/) print }" README.md | sed '/^$/d')
53
+ if [ -z "$CHANGELOG" ]; then
54
+ CHANGELOG="Release version $VERSION"
55
+ fi
56
+ echo "$CHANGELOG" > /tmp/changelog.txt
57
+
58
+ - name: Create GitHub Release
59
+ env:
60
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61
+ run: |
62
+ CHANGELOG=$(cat /tmp/changelog.txt)
63
+ gh release create "${{ steps.version.outputs.tag }}" \
64
+ --title "Release ${{ steps.version.outputs.tag }}" \
65
+ --notes "$CHANGELOG" \
66
+ --verify-tag
67
+
68
+ build:
69
+ name: Build distribution
70
+ needs: [create-release]
71
+ runs-on: ubuntu-latest
72
+
73
+ steps:
74
+ - uses: actions/checkout@v4
75
+
76
+ - name: Set up Python
77
+ uses: actions/setup-python@v5
78
+ with:
79
+ python-version: "3.11"
80
+
81
+ - name: Install build dependencies
82
+ run: |
83
+ python -m pip install --upgrade pip
84
+ pip install build
85
+
86
+ - name: Build package
87
+ run: python -m build
88
+
89
+ - name: Store distribution packages
90
+ uses: actions/upload-artifact@v4
91
+ with:
92
+ name: python-package-distributions
93
+ path: dist/
94
+
95
+ publish-to-pypi:
96
+ name: Publish to PyPI
97
+ needs: [build]
98
+ runs-on: ubuntu-latest
99
+
100
+ environment:
101
+ name: pypi
102
+ url: https://pypi.org/p/treeloom
103
+
104
+ permissions:
105
+ id-token: write
106
+
107
+ steps:
108
+ - name: Download distribution packages
109
+ uses: actions/download-artifact@v4
110
+ with:
111
+ name: python-package-distributions
112
+ path: dist/
113
+
114
+ - name: Publish to PyPI
115
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,79 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ tags:
7
+ - 'v*.*.*'
8
+ pull_request:
9
+ branches: [ main ]
10
+
11
+ jobs:
12
+ test:
13
+ name: Test on Python ${{ matrix.python-version }}
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ matrix:
17
+ python-version: ["3.10", "3.11", "3.12"]
18
+
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+
22
+ - name: Set up Python ${{ matrix.python-version }}
23
+ uses: actions/setup-python@v5
24
+ with:
25
+ python-version: ${{ matrix.python-version }}
26
+
27
+ - name: Install dependencies
28
+ run: |
29
+ python -m pip install --upgrade pip
30
+ pip install -e .[all]
31
+
32
+ - name: Run tests with pytest
33
+ run: |
34
+ pytest --cov=treeloom --cov-report=xml --cov-report=term-missing
35
+
36
+ - name: Lint with ruff
37
+ run: |
38
+ ruff check src tests
39
+
40
+ build:
41
+ name: Build distribution
42
+ runs-on: ubuntu-latest
43
+ needs: [test]
44
+
45
+ steps:
46
+ - uses: actions/checkout@v4
47
+
48
+ - name: Set up Python
49
+ uses: actions/setup-python@v5
50
+ with:
51
+ python-version: "3.11"
52
+
53
+ - name: Install build dependencies
54
+ run: |
55
+ python -m pip install --upgrade pip
56
+ pip install build
57
+
58
+ - name: Build package
59
+ run: python -m build
60
+
61
+ - name: Check build with twine
62
+ run: |
63
+ pip install twine
64
+ twine check dist/*
65
+
66
+ status:
67
+ name: Tests Status
68
+ runs-on: ubuntu-latest
69
+ needs: [test, build]
70
+ if: always()
71
+
72
+ steps:
73
+ - name: Check test results
74
+ run: |
75
+ if [ "${{ needs.test.result }}" != "success" ] || [ "${{ needs.build.result }}" != "success" ]; then
76
+ echo "Tests or build failed"
77
+ exit 1
78
+ fi
79
+ echo "All tests passed successfully"
@@ -0,0 +1,15 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+ *.egg
9
+ .venv/
10
+ venv/
11
+ .pytest_cache/
12
+ .mypy_cache/
13
+ .ruff_cache/
14
+ htmlcov/
15
+ .coverage