bizmap 0.3.10__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 (158) hide show
  1. bizmap-0.3.10/.github/workflows/ci.yml +56 -0
  2. bizmap-0.3.10/.github/workflows/impact.yml +35 -0
  3. bizmap-0.3.10/.github/workflows/release.yml +117 -0
  4. bizmap-0.3.10/.gitignore +24 -0
  5. bizmap-0.3.10/CHANGELOG.md +1226 -0
  6. bizmap-0.3.10/LICENSE +21 -0
  7. bizmap-0.3.10/PKG-INFO +313 -0
  8. bizmap-0.3.10/README.md +281 -0
  9. bizmap-0.3.10/action.yml +165 -0
  10. bizmap-0.3.10/docs/detector-rules.md +244 -0
  11. bizmap-0.3.10/docs/graph-schema.md +276 -0
  12. bizmap-0.3.10/docs/how-it-works.md +183 -0
  13. bizmap-0.3.10/examples/checkout/api/billing.go +37 -0
  14. bizmap-0.3.10/examples/checkout/api/bizmap.yaml +2 -0
  15. bizmap-0.3.10/examples/checkout/api/go.mod +8 -0
  16. bizmap-0.3.10/examples/checkout/api/handlers.go +55 -0
  17. bizmap-0.3.10/examples/checkout/api/jobs.go +28 -0
  18. bizmap-0.3.10/examples/checkout/api/main.go +36 -0
  19. bizmap-0.3.10/examples/checkout/api/migrations/0001_orders.sql +8 -0
  20. bizmap-0.3.10/examples/checkout/api/repo.go +56 -0
  21. bizmap-0.3.10/examples/checkout/api/routes.go +12 -0
  22. bizmap-0.3.10/examples/checkout/billing/app.py +40 -0
  23. bizmap-0.3.10/examples/checkout/billing/bizmap.yaml +2 -0
  24. bizmap-0.3.10/examples/checkout/billing/migrations/0001_invoices.sql +7 -0
  25. bizmap-0.3.10/examples/checkout/bizmap.yaml +16 -0
  26. bizmap-0.3.10/examples/checkout/web/bizmap.yaml +2 -0
  27. bizmap-0.3.10/examples/checkout/web/src/api/client.ts +5 -0
  28. bizmap-0.3.10/examples/checkout/web/src/checkout.ts +21 -0
  29. bizmap-0.3.10/examples/clinic/audit/actions.go +10 -0
  30. bizmap-0.3.10/examples/clinic/bizmap.yaml +9 -0
  31. bizmap-0.3.10/examples/clinic/cmd/seed/main.go +18 -0
  32. bizmap-0.3.10/examples/clinic/cmd/server/main.go +84 -0
  33. bizmap-0.3.10/examples/clinic/consent/item.go +10 -0
  34. bizmap-0.3.10/examples/clinic/controllers/orders/handler.go +94 -0
  35. bizmap-0.3.10/examples/clinic/controllers/users/handler.go +49 -0
  36. bizmap-0.3.10/examples/clinic/demo/setup.go +14 -0
  37. bizmap-0.3.10/examples/clinic/emailprefs/paths.go +3 -0
  38. bizmap-0.3.10/examples/clinic/exits/service.go +10 -0
  39. bizmap-0.3.10/examples/clinic/go.mod +8 -0
  40. bizmap-0.3.10/examples/clinic/jobs/jobs.go +50 -0
  41. bizmap-0.3.10/examples/clinic/middleware/current.go +7 -0
  42. bizmap-0.3.10/examples/clinic/notify/send.go +13 -0
  43. bizmap-0.3.10/examples/clinic/profile/photo.go +27 -0
  44. bizmap-0.3.10/examples/clinic/repositories/orders/repo.go +129 -0
  45. bizmap-0.3.10/examples/clinic/repositories/users/repo.go +38 -0
  46. bizmap-0.3.10/examples/clinic/routes/paths.go +4 -0
  47. bizmap-0.3.10/examples/clinic/schema.sql +43 -0
  48. bizmap-0.3.10/examples/clinic/services/orders/service.go +51 -0
  49. bizmap-0.3.10/examples/clinic/services/users/service.go +31 -0
  50. bizmap-0.3.10/examples/pyplatform/bizmap.yaml +12 -0
  51. bizmap-0.3.10/examples/pyplatform/catalog/alembic/versions/0001_init.py +41 -0
  52. bizmap-0.3.10/examples/pyplatform/catalog/alembic/versions/0002_notes.py +26 -0
  53. bizmap-0.3.10/examples/pyplatform/catalog/app.py +57 -0
  54. bizmap-0.3.10/examples/pyplatform/catalog/bizmap.yaml +5 -0
  55. bizmap-0.3.10/examples/pyplatform/catalog/db.py +36 -0
  56. bizmap-0.3.10/examples/pyplatform/catalog/models.py +44 -0
  57. bizmap-0.3.10/examples/pyplatform/catalog/paths.py +7 -0
  58. bizmap-0.3.10/examples/pyplatform/catalog/schema.sql +61 -0
  59. bizmap-0.3.10/examples/pyplatform/catalog/tasks.py +26 -0
  60. bizmap-0.3.10/examples/pyplatform/storefront/bizmap.yaml +4 -0
  61. bizmap-0.3.10/examples/pyplatform/storefront/client.py +36 -0
  62. bizmap-0.3.10/examples/pyplatform/storefront/loop.py +13 -0
  63. bizmap-0.3.10/examples/pyplatform/web/bizmap.yaml +4 -0
  64. bizmap-0.3.10/examples/pyplatform/web/server.ts +19 -0
  65. bizmap-0.3.10/examples/pyplatform/worker/bizmap.yaml +5 -0
  66. bizmap-0.3.10/examples/pyplatform/worker/collections.py +5 -0
  67. bizmap-0.3.10/examples/pyplatform/worker/main.py +50 -0
  68. bizmap-0.3.10/examples/shop/bizmap.yaml +6 -0
  69. bizmap-0.3.10/examples/shop/cmd/shop/main.go +45 -0
  70. bizmap-0.3.10/examples/shop/go.mod +8 -0
  71. bizmap-0.3.10/examples/shop/handlers/handlers.go +61 -0
  72. bizmap-0.3.10/examples/shop/jobs/jobs.go +34 -0
  73. bizmap-0.3.10/examples/shop/python/worker.py +23 -0
  74. bizmap-0.3.10/examples/shop/repository/repository.go +163 -0
  75. bizmap-0.3.10/examples/shop/schema.sql +96 -0
  76. bizmap-0.3.10/examples/shop/service/service.go +46 -0
  77. bizmap-0.3.10/pyproject.toml +72 -0
  78. bizmap-0.3.10/scripts/bench_scale.py +61 -0
  79. bizmap-0.3.10/src/bizmap/__init__.py +3 -0
  80. bizmap-0.3.10/src/bizmap/cli.py +402 -0
  81. bizmap-0.3.10/src/bizmap/detect/__init__.py +1 -0
  82. bizmap-0.3.10/src/bizmap/detect/go_lang.py +3097 -0
  83. bizmap-0.3.10/src/bizmap/detect/js_lang.py +4164 -0
  84. bizmap-0.3.10/src/bizmap/detect/py_resolve.py +1054 -0
  85. bizmap-0.3.10/src/bizmap/detect/py_schema.py +546 -0
  86. bizmap-0.3.10/src/bizmap/detect/python_lang.py +4636 -0
  87. bizmap-0.3.10/src/bizmap/detect/rules.py +121 -0
  88. bizmap-0.3.10/src/bizmap/detect/tsutil.py +113 -0
  89. bizmap-0.3.10/src/bizmap/files.py +147 -0
  90. bizmap-0.3.10/src/bizmap/graph.py +324 -0
  91. bizmap-0.3.10/src/bizmap/http_match.py +495 -0
  92. bizmap-0.3.10/src/bizmap/impact.py +887 -0
  93. bizmap-0.3.10/src/bizmap/mermaid.py +432 -0
  94. bizmap-0.3.10/src/bizmap/overrides.py +268 -0
  95. bizmap-0.3.10/src/bizmap/registry.py +191 -0
  96. bizmap-0.3.10/src/bizmap/report.py +244 -0
  97. bizmap-0.3.10/src/bizmap/rules/__init__.py +1 -0
  98. bizmap-0.3.10/src/bizmap/rules/celery.yaml +20 -0
  99. bizmap-0.3.10/src/bizmap/rules/echo.yaml +29 -0
  100. bizmap-0.3.10/src/bizmap/rules/express.yaml +26 -0
  101. bizmap-0.3.10/src/bizmap/rules/fastapi.yaml +26 -0
  102. bizmap-0.3.10/src/bizmap/rules/firebase.yaml +46 -0
  103. bizmap-0.3.10/src/bizmap/rules/flask.yaml +29 -0
  104. bizmap-0.3.10/src/bizmap/rules/go_ticker.yaml +28 -0
  105. bizmap-0.3.10/src/bizmap/rules/httpx.yaml +21 -0
  106. bizmap-0.3.10/src/bizmap/rules/pgx.yaml +25 -0
  107. bizmap-0.3.10/src/bizmap/rules/sqlalchemy.yaml +24 -0
  108. bizmap-0.3.10/src/bizmap/rules/supabase.yaml +21 -0
  109. bizmap-0.3.10/src/bizmap/scan.py +2209 -0
  110. bizmap-0.3.10/src/bizmap/schema_replay.py +1156 -0
  111. bizmap-0.3.10/src/bizmap/snapshot.py +52 -0
  112. bizmap-0.3.10/src/bizmap/spans.py +581 -0
  113. bizmap-0.3.10/src/bizmap/sql_analyze.py +1242 -0
  114. bizmap-0.3.10/src/bizmap/why.py +263 -0
  115. bizmap-0.3.10/tests/conftest.py +25 -0
  116. bizmap-0.3.10/tests/snapshots/checkout.txt +97 -0
  117. bizmap-0.3.10/tests/snapshots/clinic.txt +245 -0
  118. bizmap-0.3.10/tests/snapshots/pyplatform.txt +242 -0
  119. bizmap-0.3.10/tests/snapshots/shop.txt +204 -0
  120. bizmap-0.3.10/tests/test_client_instances.py +413 -0
  121. bizmap-0.3.10/tests/test_example_checkout.py +67 -0
  122. bizmap-0.3.10/tests/test_executor_calls.py +142 -0
  123. bizmap-0.3.10/tests/test_field_dispatch.py +401 -0
  124. bizmap-0.3.10/tests/test_function_tables.py +125 -0
  125. bizmap-0.3.10/tests/test_go_accuracy.py +234 -0
  126. bizmap-0.3.10/tests/test_go_jobs.py +83 -0
  127. bizmap-0.3.10/tests/test_go_nested_groups.py +126 -0
  128. bizmap-0.3.10/tests/test_go_routes.py +83 -0
  129. bizmap-0.3.10/tests/test_go_strings.py +40 -0
  130. bizmap-0.3.10/tests/test_http_accounting.py +28 -0
  131. bizmap-0.3.10/tests/test_impact.py +1563 -0
  132. bizmap-0.3.10/tests/test_merge_equals_joint.py +53 -0
  133. bizmap-0.3.10/tests/test_module_calls_and_passed_fns.py +143 -0
  134. bizmap-0.3.10/tests/test_precision.py +421 -0
  135. bizmap-0.3.10/tests/test_py_execute_args.py +61 -0
  136. bizmap-0.3.10/tests/test_python_package_roots.py +254 -0
  137. bizmap-0.3.10/tests/test_report.py +204 -0
  138. bizmap-0.3.10/tests/test_route_literals.py +934 -0
  139. bizmap-0.3.10/tests/test_rules.py +21 -0
  140. bizmap-0.3.10/tests/test_scan_example.py +136 -0
  141. bizmap-0.3.10/tests/test_schema_replay.py +60 -0
  142. bizmap-0.3.10/tests/test_snapshots.py +90 -0
  143. bizmap-0.3.10/tests/test_sql_analyze.py +121 -0
  144. bizmap-0.3.10/tests/test_sql_outside_schema.py +80 -0
  145. bizmap-0.3.10/tests/test_sql_references.py +180 -0
  146. bizmap-0.3.10/tests/test_ts_path_helpers.py +419 -0
  147. bizmap-0.3.10/tests/test_unscanned_sinks.py +162 -0
  148. bizmap-0.3.10/tests/test_v013.py +407 -0
  149. bizmap-0.3.10/tests/test_v02.py +472 -0
  150. bizmap-0.3.10/tests/test_v021.py +437 -0
  151. bizmap-0.3.10/tests/test_v022.py +574 -0
  152. bizmap-0.3.10/tests/test_v023.py +498 -0
  153. bizmap-0.3.10/tests/test_v024.py +507 -0
  154. bizmap-0.3.10/tests/test_v025.py +678 -0
  155. bizmap-0.3.10/tests/test_v026.py +579 -0
  156. bizmap-0.3.10/tests/test_v027.py +509 -0
  157. bizmap-0.3.10/tests/test_v028.py +458 -0
  158. bizmap-0.3.10/tests/test_v029.py +451 -0
@@ -0,0 +1,56 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ python-version: ["3.11", "3.12"]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: ${{ matrix.python-version }}
19
+ - name: Install
20
+ run: pip install -e ".[dev]"
21
+ - name: Ruff
22
+ run: ruff check src tests
23
+ - name: Pytest
24
+ run: pytest -q
25
+
26
+ package:
27
+ runs-on: ubuntu-latest
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+ - uses: actions/setup-python@v5
31
+ with:
32
+ python-version: "3.12"
33
+ - name: Non-editable install
34
+ run: |
35
+ pip install .
36
+ bizmap --version
37
+ - name: Smoke-test report on examples
38
+ run: |
39
+ bizmap report examples/shop
40
+ bizmap report examples/pyplatform
41
+ bizmap report examples/clinic --redact --salt ci
42
+ - name: Checkout demo (README)
43
+ run: |
44
+ bizmap scan examples/checkout --mermaid --out /tmp/checkout.json
45
+ cat /tmp/checkout*.mmd
46
+ bizmap why orders.status --graph /tmp/checkout.json
47
+ bizmap report examples/checkout
48
+ - name: Scale benchmark (informational)
49
+ run: python scripts/bench_scale.py 500:150 1000:300 2000:600 && python scripts/bench_scale.py 2000:600 --profile
50
+ - name: Impact of a synthetic diff (PR-comment Action)
51
+ run: |
52
+ printf '%s\n' 'diff --git a/examples/checkout/api/billing.go b/examples/checkout/api/billing.go' \
53
+ '--- a/examples/checkout/api/billing.go' '+++ b/examples/checkout/api/billing.go' \
54
+ '@@ -27,1 +27,1 @@' '-old' '+new' > /tmp/pr.diff
55
+ bizmap impact --graph /tmp/checkout.json --diff /tmp/pr.diff --prefix examples/checkout | tee /tmp/impact.md
56
+ grep -q "CreateInvoice" /tmp/impact.md
@@ -0,0 +1,35 @@
1
+ # Dogfood: runs the BizMap impact Action from this checkout on this repo's PRs.
2
+ name: Impact
3
+ on: pull_request
4
+ permissions:
5
+ contents: read
6
+ pull-requests: write
7
+ concurrency:
8
+ group: bizmap-impact-${{ github.event.pull_request.number }}
9
+ cancel-in-progress: true
10
+ jobs:
11
+ impact:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: ./
16
+ with:
17
+ path: .
18
+ # The PR head checked out directly (shallow): exercises the merge-base path
19
+ # (base-branch drift must not count as the PR's change). Summary only.
20
+ impact-head-ref:
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ with:
25
+ ref: ${{ github.event.pull_request.head.sha }}
26
+ - uses: ./
27
+ id: bizmap
28
+ with:
29
+ path: .
30
+ comment: "false"
31
+ - name: The report was produced
32
+ env:
33
+ STATUS: ${{ steps.bizmap.outputs.status }}
34
+ run: |
35
+ test "$STATUS" = ok
@@ -0,0 +1,117 @@
1
+ # Publish to PyPI when a version tag is pushed (Trusted Publishing, no token).
2
+ #
3
+ # One-time setup on PyPI (project "bizmap" → Publishing → Add a trusted publisher,
4
+ # or "pending publisher" before the first upload):
5
+ # owner: lucas-simao · repository: bizmap · workflow: release.yml · environment: pypi
6
+ # And on GitHub: Settings → Environments → New environment "pypi"
7
+ # (optionally with required reviewers, so each publish waits for approval).
8
+ #
9
+ # GitHub runs the workflow file of the tagged commit, so tags on commits older
10
+ # than this file (v0.3.3–v0.3.5) don't trigger it by push. Publish those with
11
+ # Actions → Release → "Run workflow" and the tag name: this file (from main)
12
+ # checks out and builds that tag.
13
+ #
14
+ # A manual run can be started from any branch, and its jobs use that branch's
15
+ # copy of this file. Only `main` (dispatch) and `v*` tags may publish: the
16
+ # `publish` job checks it, and the `pypi` environment should also be limited to
17
+ # them (Settings → Environments → pypi → Deployment branches and tags: `main`
18
+ # and tag pattern `v*`).
19
+ #
20
+ # Third-party actions are pinned by commit SHA (comment = version).
21
+ name: Release
22
+
23
+ on:
24
+ push:
25
+ tags: ["v*"]
26
+ workflow_dispatch:
27
+ inputs:
28
+ tag:
29
+ description: "Existing tag to publish (e.g. v0.3.5)"
30
+ required: true
31
+
32
+ permissions:
33
+ contents: read
34
+
35
+ env:
36
+ TAG: ${{ inputs.tag || github.ref_name }}
37
+
38
+ jobs:
39
+ build:
40
+ runs-on: ubuntu-latest
41
+ steps:
42
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
43
+ with:
44
+ ref: ${{ env.TAG }}
45
+ fetch-depth: 0
46
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
47
+ with:
48
+ python-version: "3.12"
49
+ - name: Tag is a version tag on main, matching the package and the CHANGELOG
50
+ run: |
51
+ case "$TAG" in v[0-9]*) ;; *) echo "::error::'$TAG' is not a version tag (vX.Y.Z)"; exit 1 ;; esac
52
+ git rev-parse -q --verify "refs/tags/$TAG" >/dev/null || { echo "::error::tag $TAG does not exist"; exit 1; }
53
+ git fetch --no-tags origin main
54
+ if ! git merge-base --is-ancestor "refs/tags/$TAG" origin/main; then
55
+ echo "::error::$TAG is not on main"
56
+ exit 1
57
+ fi
58
+ tag="${TAG#v}"
59
+ version="$(python -c 'import tomllib;print(tomllib.load(open("pyproject.toml","rb"))["project"]["version"])')"
60
+ echo "tag=$tag version=$version"
61
+ if [ "$tag" != "$version" ]; then
62
+ echo "::error::tag $TAG does not match pyproject version $version"
63
+ exit 1
64
+ fi
65
+ grep -qF "## $version " CHANGELOG.md || { echo "::error::CHANGELOG.md has no '## $version' section"; exit 1; }
66
+ - name: Test before publishing
67
+ run: |
68
+ python -m pip install --quiet -e ".[dev]"
69
+ python -m pytest -q
70
+ - name: Build sdist and wheel
71
+ run: |
72
+ python -m pip install --quiet build twine
73
+ python -m build
74
+ python -m twine check dist/*
75
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
76
+ with:
77
+ name: dist
78
+ path: dist/
79
+
80
+ publish:
81
+ needs: build
82
+ if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
83
+ runs-on: ubuntu-latest
84
+ environment:
85
+ name: pypi
86
+ url: https://pypi.org/project/bizmap/
87
+ permissions:
88
+ id-token: write # Trusted Publishing (OIDC); no API token stored
89
+ steps:
90
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
91
+ with:
92
+ name: dist
93
+ path: dist/
94
+ - uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
95
+
96
+ github-release:
97
+ needs: publish
98
+ runs-on: ubuntu-latest
99
+ permissions:
100
+ contents: write
101
+ steps:
102
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
103
+ with:
104
+ ref: ${{ env.TAG }}
105
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
106
+ with:
107
+ name: dist
108
+ path: dist/
109
+ - name: Release notes from CHANGELOG.md
110
+ run: |
111
+ version="${TAG#v}"
112
+ awk -v v="## $version " 'index($0, v) == 1 {on=1; next} on && /^## / {exit} on {print}' CHANGELOG.md > notes.md
113
+ test -s notes.md || echo "See CHANGELOG.md." > notes.md
114
+ - name: Create the GitHub release
115
+ env:
116
+ GH_TOKEN: ${{ github.token }}
117
+ run: gh release create "$TAG" dist/* --title "$TAG" --notes-file notes.md --verify-tag
@@ -0,0 +1,24 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.egg-info/
6
+ .eggs/
7
+ dist/
8
+ build/
9
+ .venv/
10
+ venv/
11
+ .pytest_cache/
12
+ .ruff_cache/
13
+ .mypy_cache/
14
+ .coverage
15
+ htmlcov/
16
+
17
+ # Scan output (generated locally)
18
+ /bizmap.graph.json
19
+ /bizmap.graph.mmd
20
+
21
+ # Editors / OS
22
+ .idea/
23
+ .vscode/
24
+ .DS_Store