erdify-studio 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.
Files changed (133) hide show
  1. erdify_studio-0.1.0/.github/copilot-instructions.md +45 -0
  2. erdify_studio-0.1.0/.github/dependabot.yml +50 -0
  3. erdify_studio-0.1.0/.github/instructions/python-lib.instructions.md +24 -0
  4. erdify_studio-0.1.0/.github/workflows/docs.yml +56 -0
  5. erdify_studio-0.1.0/.github/workflows/lint.yml +29 -0
  6. erdify_studio-0.1.0/.github/workflows/package.yml +62 -0
  7. erdify_studio-0.1.0/.github/workflows/publish-testpypi.yml +88 -0
  8. erdify_studio-0.1.0/.github/workflows/publish.yml +73 -0
  9. erdify_studio-0.1.0/.github/workflows/test.yml +170 -0
  10. erdify_studio-0.1.0/.gitignore +21 -0
  11. erdify_studio-0.1.0/.pre-commit-config.yaml +47 -0
  12. erdify_studio-0.1.0/.pre-commit-hooks.yaml +25 -0
  13. erdify_studio-0.1.0/.python-version +1 -0
  14. erdify_studio-0.1.0/AGENTS.md +1 -0
  15. erdify_studio-0.1.0/CHANGELOG.md +98 -0
  16. erdify_studio-0.1.0/CLAUDE.md +19 -0
  17. erdify_studio-0.1.0/CODE_OF_CONDUCT.md +38 -0
  18. erdify_studio-0.1.0/CONTRIBUTING.md +78 -0
  19. erdify_studio-0.1.0/LICENSE +21 -0
  20. erdify_studio-0.1.0/PKG-INFO +224 -0
  21. erdify_studio-0.1.0/README.md +195 -0
  22. erdify_studio-0.1.0/SECURITY.md +76 -0
  23. erdify_studio-0.1.0/code-coverage.datadog.yaml +28 -0
  24. erdify_studio-0.1.0/docs/assets/example-billing.svg +78 -0
  25. erdify_studio-0.1.0/docs/assets/example-overview.svg +97 -0
  26. erdify_studio-0.1.0/docs/changelog.md +1 -0
  27. erdify_studio-0.1.0/docs/configuration.md +26 -0
  28. erdify_studio-0.1.0/docs/design/2026-11-20-studio-canvas-plan.md +224 -0
  29. erdify_studio-0.1.0/docs/design/2026-11-20-studio-canvas.md +229 -0
  30. erdify_studio-0.1.0/docs/design/2026-11-23-group-diagrams-plan.md +192 -0
  31. erdify_studio-0.1.0/docs/design/2026-11-23-group-diagrams.md +197 -0
  32. erdify_studio-0.1.0/docs/design/2026-11-23-live-reload-plan.md +74 -0
  33. erdify_studio-0.1.0/docs/design/2026-11-23-live-reload.md +160 -0
  34. erdify_studio-0.1.0/docs/design/2026-11-23-svg-export-plan.md +88 -0
  35. erdify_studio-0.1.0/docs/design/2026-11-23-svg-export.md +208 -0
  36. erdify_studio-0.1.0/docs/index.md +26 -0
  37. erdify_studio-0.1.0/docs/installation.md +13 -0
  38. erdify_studio-0.1.0/docs/layout-file.md +31 -0
  39. erdify_studio-0.1.0/docs/quickstart.md +36 -0
  40. erdify_studio-0.1.0/docs/styleguide/python.md +176 -0
  41. erdify_studio-0.1.0/docs/stylesheets/extra.css +28 -0
  42. erdify_studio-0.1.0/docs/usage/canvas.md +41 -0
  43. erdify_studio-0.1.0/docs/usage/ci.md +55 -0
  44. erdify_studio-0.1.0/docs/usage/export.md +28 -0
  45. erdify_studio-0.1.0/docs/usage/place.md +20 -0
  46. erdify_studio-0.1.0/frontend/auto-imports.d.ts +26 -0
  47. erdify_studio-0.1.0/frontend/components.d.ts +24 -0
  48. erdify_studio-0.1.0/frontend/index.html +12 -0
  49. erdify_studio-0.1.0/frontend/licenses/@iconify-json__lucide.txt +46 -0
  50. erdify_studio-0.1.0/frontend/package-lock.json +5349 -0
  51. erdify_studio-0.1.0/frontend/package.json +29 -0
  52. erdify_studio-0.1.0/frontend/src/App.vue +408 -0
  53. erdify_studio-0.1.0/frontend/src/api.ts +228 -0
  54. erdify_studio-0.1.0/frontend/src/components/BoxNode.vue +172 -0
  55. erdify_studio-0.1.0/frontend/src/components/DiagramCanvas.vue +306 -0
  56. erdify_studio-0.1.0/frontend/src/components/DiagramList.vue +41 -0
  57. erdify_studio-0.1.0/frontend/src/components/EdgeLine.vue +75 -0
  58. erdify_studio-0.1.0/frontend/src/components/StudioToolbar.vue +30 -0
  59. erdify_studio-0.1.0/frontend/src/drawing.ts +15 -0
  60. erdify_studio-0.1.0/frontend/src/env.d.ts +1 -0
  61. erdify_studio-0.1.0/frontend/src/geometry.ts +145 -0
  62. erdify_studio-0.1.0/frontend/src/main.ts +7 -0
  63. erdify_studio-0.1.0/frontend/src/style.css +8 -0
  64. erdify_studio-0.1.0/frontend/tsconfig.json +15 -0
  65. erdify_studio-0.1.0/frontend/vite.config.ts +121 -0
  66. erdify_studio-0.1.0/mkdocs.yml +77 -0
  67. erdify_studio-0.1.0/pyproject.toml +116 -0
  68. erdify_studio-0.1.0/scripts/check_geometry.py +121 -0
  69. erdify_studio-0.1.0/scripts/check_instructions.py +411 -0
  70. erdify_studio-0.1.0/scripts/check_static.py +63 -0
  71. erdify_studio-0.1.0/scripts/check_wheel.py +54 -0
  72. erdify_studio-0.1.0/scripts/geometry_cases.json +41 -0
  73. erdify_studio-0.1.0/scripts/geometry_parity.mjs +30 -0
  74. erdify_studio-0.1.0/service.datadog.yaml +29 -0
  75. erdify_studio-0.1.0/src/erdify_studio/__init__.py +63 -0
  76. erdify_studio-0.1.0/src/erdify_studio/__main__.py +7 -0
  77. erdify_studio-0.1.0/src/erdify_studio/_check.py +215 -0
  78. erdify_studio-0.1.0/src/erdify_studio/_config.py +95 -0
  79. erdify_studio-0.1.0/src/erdify_studio/_diagrams.py +433 -0
  80. erdify_studio-0.1.0/src/erdify_studio/_entities.py +101 -0
  81. erdify_studio-0.1.0/src/erdify_studio/_errors.py +48 -0
  82. erdify_studio-0.1.0/src/erdify_studio/_export.py +353 -0
  83. erdify_studio-0.1.0/src/erdify_studio/_geometry.py +181 -0
  84. erdify_studio-0.1.0/src/erdify_studio/_layout.py +334 -0
  85. erdify_studio-0.1.0/src/erdify_studio/_place.py +351 -0
  86. erdify_studio-0.1.0/src/erdify_studio/_server.py +536 -0
  87. erdify_studio-0.1.0/src/erdify_studio/_static/THIRD_PARTY_LICENSES.txt +552 -0
  88. erdify_studio-0.1.0/src/erdify_studio/_static/assets/Toast-DKNikwgv.js +15 -0
  89. erdify_studio-0.1.0/src/erdify_studio/_static/assets/index-BwaNC2Tp.css +1 -0
  90. erdify_studio-0.1.0/src/erdify_studio/_static/assets/index-DCr6Tq0B.js +15 -0
  91. erdify_studio-0.1.0/src/erdify_studio/_static/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
  92. erdify_studio-0.1.0/src/erdify_studio/_static/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
  93. erdify_studio-0.1.0/src/erdify_studio/_static/assets/jetbrains-mono-cyrillic-700-normal-BWTpRfYl.woff2 +0 -0
  94. erdify_studio-0.1.0/src/erdify_studio/_static/assets/jetbrains-mono-cyrillic-700-normal-CEoEElIJ.woff +0 -0
  95. erdify_studio-0.1.0/src/erdify_studio/_static/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
  96. erdify_studio-0.1.0/src/erdify_studio/_static/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
  97. erdify_studio-0.1.0/src/erdify_studio/_static/assets/jetbrains-mono-greek-700-normal-C6CZE3T8.woff2 +0 -0
  98. erdify_studio-0.1.0/src/erdify_studio/_static/assets/jetbrains-mono-greek-700-normal-DEigVDxa.woff +0 -0
  99. erdify_studio-0.1.0/src/erdify_studio/_static/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
  100. erdify_studio-0.1.0/src/erdify_studio/_static/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  101. erdify_studio-0.1.0/src/erdify_studio/_static/assets/jetbrains-mono-latin-700-normal-BYuf6tUa.woff2 +0 -0
  102. erdify_studio-0.1.0/src/erdify_studio/_static/assets/jetbrains-mono-latin-700-normal-D3wTyLJW.woff +0 -0
  103. erdify_studio-0.1.0/src/erdify_studio/_static/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
  104. erdify_studio-0.1.0/src/erdify_studio/_static/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
  105. erdify_studio-0.1.0/src/erdify_studio/_static/assets/jetbrains-mono-latin-ext-700-normal-CZipNAKV.woff2 +0 -0
  106. erdify_studio-0.1.0/src/erdify_studio/_static/assets/jetbrains-mono-latin-ext-700-normal-CxPITLHs.woff +0 -0
  107. erdify_studio-0.1.0/src/erdify_studio/_static/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
  108. erdify_studio-0.1.0/src/erdify_studio/_static/assets/jetbrains-mono-vietnamese-700-normal-BDLVIk2r.woff +0 -0
  109. erdify_studio-0.1.0/src/erdify_studio/_static/index.html +13 -0
  110. erdify_studio-0.1.0/src/erdify_studio/_svg.py +250 -0
  111. erdify_studio-0.1.0/src/erdify_studio/cli.py +272 -0
  112. erdify_studio-0.1.0/src/erdify_studio/py.typed +0 -0
  113. erdify_studio-0.1.0/tests/__init__.py +0 -0
  114. erdify_studio-0.1.0/tests/fixtures/export/groups/billing.svg +78 -0
  115. erdify_studio-0.1.0/tests/fixtures/export/groups/core.svg +48 -0
  116. erdify_studio-0.1.0/tests/fixtures/export/overview.svg +97 -0
  117. erdify_studio-0.1.0/tests/test_check.py +550 -0
  118. erdify_studio-0.1.0/tests/test_check_static.py +104 -0
  119. erdify_studio-0.1.0/tests/test_check_wheel.py +77 -0
  120. erdify_studio-0.1.0/tests/test_cli.py +38 -0
  121. erdify_studio-0.1.0/tests/test_config.py +105 -0
  122. erdify_studio-0.1.0/tests/test_diagrams.py +763 -0
  123. erdify_studio-0.1.0/tests/test_entities.py +158 -0
  124. erdify_studio-0.1.0/tests/test_export.py +722 -0
  125. erdify_studio-0.1.0/tests/test_geometry.py +95 -0
  126. erdify_studio-0.1.0/tests/test_layout.py +381 -0
  127. erdify_studio-0.1.0/tests/test_open.py +169 -0
  128. erdify_studio-0.1.0/tests/test_place.py +519 -0
  129. erdify_studio-0.1.0/tests/test_project.py +59 -0
  130. erdify_studio-0.1.0/tests/test_server.py +788 -0
  131. erdify_studio-0.1.0/tests/test_smoke.py +6 -0
  132. erdify_studio-0.1.0/tests/test_svg.py +236 -0
  133. erdify_studio-0.1.0/uv.lock +1326 -0
@@ -0,0 +1,45 @@
1
+ # Agent Instructions — erdify-studio
2
+
3
+ Repo-wide agent instructions; `AGENTS.md` links to this file (a copy on Windows) and `CLAUDE.md` imports it.
4
+
5
+ ## Project
6
+
7
+ erdify-studio: arrange erdify ERDs by drag and drop, commit the layout, check it in CI.
8
+ A Python package (`src/` layout, Python >= 3.11, tests in `tests/`) plus a Vue 3 + Vite
9
+ frontend in `frontend/`, built into `src/erdify_studio/_static/` (gitignored) and shipped
10
+ in the wheel.
11
+
12
+ - **All logic is Python** (schema loading via erdify's public API, layout file, `check`,
13
+ `place --auto`, SVG export). The browser only displays and sends positions back.
14
+ - **Never re-implement erdify's parsing or edges** — use `erdify.load_project`,
15
+ `erdify.diagram_edges` and `EntityInfo`. Divergence from erdify's model is a bug.
16
+ - The server binds to 127.0.0.1 only; no outbound network, no CDN assets.
17
+
18
+ ## Tooling (non-negotiable)
19
+
20
+ - **Tests:** `uv run poe test` — never bare `pytest`.
21
+ - **Lint/format:** `uv run poe lint` (ruff + mypy strict) / `uv run poe format`, also run
22
+ by the pre-commit hooks. Coverage gate: 90 %.
23
+ - **Frontend:** `npm --prefix frontend run build` (vue-tsc + Vite); `uv run poe frontend`
24
+ installs and builds it.
25
+ - **Git hooks:** `pre-commit` (run `pre-commit install` once). No Husky.
26
+
27
+ ## Path-scoped instructions
28
+
29
+ Stack-specific rules live in `.github/instructions/*.instructions.md` — open the
30
+ matching file before working in the package. `CLAUDE.md` imports all of them.
31
+
32
+ | File | Applies to |
33
+ | ---- | ---------- |
34
+ | `.github/instructions/python-lib.instructions.md` | `src/`, `tests/` |
35
+
36
+ ## Conventions
37
+
38
+ - **English everywhere:** all code, comments, identifiers, docs, README, commit
39
+ messages, PR titles/descriptions and CHANGELOG entries are written in English.
40
+ - `docs/styleguide/python.md` is the authoritative, fuller reference. Prefer the
41
+ established patterns of the package.
42
+ - **Keep this file lean.** Copilot code review stops reviewing once the instructions
43
+ it loads for a PR exceed ~100,000 characters. Add a stack- or area-specific rule
44
+ to the matching `.github/instructions/*.instructions.md` file (or a new one with a
45
+ narrow `applyTo`, imported in `CLAUDE.md`); `scripts/check_instructions.py` enforces it.
@@ -0,0 +1,50 @@
1
+ # Same policy as erdify: weekly grouped minor/patch updates, majors separate,
2
+ # a 7-day cooldown before a fresh release is proposed (security updates bypass it).
3
+ version: 2
4
+ updates:
5
+ - package-ecosystem: "uv"
6
+ directory: "/"
7
+ schedule:
8
+ interval: "cron"
9
+ cronjob: "0 2 * * 3"
10
+ cooldown:
11
+ default-days: 7
12
+ groups:
13
+ version-updates:
14
+ applies-to: version-updates
15
+ patterns: ["*"]
16
+ update-types: ["minor", "patch"]
17
+ security-updates:
18
+ applies-to: security-updates
19
+ patterns: ["*"]
20
+ update-types: ["minor", "patch"]
21
+ # The frontend that is built into the wheel.
22
+ - package-ecosystem: "npm"
23
+ directory: "/frontend"
24
+ schedule:
25
+ interval: "cron"
26
+ cronjob: "0 2 * * 3"
27
+ cooldown:
28
+ default-days: 7
29
+ groups:
30
+ version-updates:
31
+ applies-to: version-updates
32
+ patterns: ["*"]
33
+ update-types: ["minor", "patch"]
34
+ security-updates:
35
+ applies-to: security-updates
36
+ patterns: ["*"]
37
+ update-types: ["minor", "patch"]
38
+ - package-ecosystem: "github-actions"
39
+ directory: "/"
40
+ schedule:
41
+ interval: "cron"
42
+ cronjob: "0 2 1 * *"
43
+ cooldown:
44
+ default-days: 7
45
+ groups:
46
+ version-updates:
47
+ applies-to: version-updates
48
+ patterns: ["*"]
49
+ # Majors grouped too: pinned action SHAs are reviewed as one PR.
50
+ update-types: ["major", "minor", "patch"]
@@ -0,0 +1,24 @@
1
+ ---
2
+ applyTo: "src/**,tests/**"
3
+ ---
4
+
5
+ # Python library
6
+
7
+ Path-scoped part of `.github/copilot-instructions.md` (loaded by Copilot for matching files;
8
+ imported into `CLAUDE.md`). `docs/styleguide/python.md` is authoritative for nuance.
9
+
10
+ - **Layout:** `src/` layout; modules named for what they contain (no `utils.py`); nothing
11
+ imports upward. Prefix internal modules and helpers with `_`.
12
+ - **Public API:** `__init__.py` with `__all__` is the contract. Renaming or removing anything
13
+ re-exported there is a major bump; keep the surface small.
14
+ - **Typing:** annotate every public function; accept the general type, return the concrete
15
+ one; `dataclass`/`TypedDict` over bare dicts across modules; narrow `Any` at the boundary.
16
+ - **Errors:** one package-level base exception, specific subclasses. Library code raises —
17
+ never prints, `sys.exit()`s or logs-and-returns-`None`; only the CLI entry point maps an
18
+ exception to a message and exit code. Never swallow exceptions; include the offending
19
+ value with `!r`.
20
+ - **Logging:** `logging.getLogger(__name__)`, no handlers or levels in library code
21
+ (`basicConfig` only in the CLI); f-string messages; `warning`/`error` alert, so expected
22
+ skips are `info`.
23
+ - **Tests:** `uv run poe test` — never bare `pytest`. Test through the public import path;
24
+ parametrize over inputs; cover the error paths.
@@ -0,0 +1,56 @@
1
+ name: Docs
2
+
3
+ concurrency:
4
+ group: "docs-${{ github.event_name == 'push' && github.sha || github.ref }}"
5
+ cancel-in-progress: true
6
+
7
+ on:
8
+ push: { branches: [main] }
9
+ pull_request: { branches: [main] }
10
+
11
+ # Deployed through the official GitHub Pages actions (artifact upload), as in erdify.
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ build:
17
+ name: Build the docs
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
21
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
22
+ with:
23
+ version: "latest-known"
24
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
25
+ with:
26
+ python-version-file: .python-version
27
+ # --strict: a broken internal link fails the PR.
28
+ - name: Build the site
29
+ run: uv run --frozen --group docs mkdocs build --strict
30
+ - name: Upload the Pages artifact
31
+ if: github.event_name == 'push' && !github.event.repository.private
32
+ uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
33
+ with:
34
+ path: site
35
+
36
+ deploy:
37
+ name: Deploy to GitHub Pages
38
+ # GitHub Pages needs a public repository on the Free plan: until then the site is
39
+ # only built (and checked); the deploy starts once the repository is public.
40
+ if: github.event_name == 'push' && !github.event.repository.private
41
+ needs: build
42
+ runs-on: ubuntu-latest
43
+ # One deploy at a time, in order: an older build must not overwrite a newer site.
44
+ concurrency:
45
+ group: pages
46
+ cancel-in-progress: false
47
+ permissions:
48
+ pages: write
49
+ id-token: write
50
+ environment:
51
+ name: github-pages
52
+ url: ${{ steps.deployment.outputs.page_url }}
53
+ steps:
54
+ - name: Deploy to GitHub Pages
55
+ id: deployment
56
+ uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
@@ -0,0 +1,29 @@
1
+ name: Linting
2
+
3
+ concurrency:
4
+ group: "linting-${{ github.event_name == 'push' && github.sha || github.ref }}"
5
+ cancel-in-progress: true
6
+
7
+ on:
8
+ push: { branches: [main] }
9
+ pull_request: { branches: [main] }
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ lint:
16
+ name: Lint
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
20
+ with:
21
+ fetch-depth: 0 # hatch-vcs derives the version from the latest tag
22
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
23
+ with:
24
+ version: "latest-known"
25
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
26
+ with:
27
+ python-version-file: .python-version
28
+ # pre-commit comes from uv.lock (the `hooks` group), like every other tool.
29
+ - run: uv run --frozen --group hooks pre-commit run --all-files
@@ -0,0 +1,62 @@
1
+ name: Packaging
2
+
3
+ concurrency:
4
+ group: "packaging-${{ github.event_name == 'push' && github.sha || github.ref }}"
5
+ cancel-in-progress: true
6
+
7
+ on:
8
+ push: { branches: [main] }
9
+ pull_request: { branches: [main] }
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ package:
16
+ name: Package
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
20
+ with:
21
+ fetch-depth: 0 # hatch-vcs derives the version from the latest tag
22
+ - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
23
+ with:
24
+ node-version: "24"
25
+ cache: npm
26
+ cache-dependency-path: frontend/package-lock.json
27
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
28
+ with:
29
+ version: "latest-known"
30
+ - name: Build the frontend (type-check + Vite)
31
+ working-directory: frontend
32
+ run: |
33
+ npm ci --ignore-scripts --no-audit --no-fund
34
+ npm run build
35
+ # The SVG export ports frontend/src/geometry.ts to Python; both must draw the same.
36
+ - name: Canvas and SVG export draw the same geometry
37
+ run: node scripts/geometry_parity.mjs | uv run --frozen python scripts/check_geometry.py
38
+ - name: The built frontend loads nothing from the network
39
+ run: uv run --frozen python scripts/check_static.py
40
+ - run: uv build
41
+ - run: uv run --frozen python scripts/check_wheel.py dist
42
+ - name: Install the wheel without Node and run the CLI
43
+ shell: bash
44
+ run: |
45
+ uv venv /tmp/wheel-env
46
+ VIRTUAL_ENV=/tmp/wheel-env uv pip install dist/*.whl
47
+ env PATH="/tmp/wheel-env/bin:/usr/bin:/bin" bash -c '
48
+ if command -v node; then echo "node must not be on PATH" >&2; exit 1; fi
49
+ erdify-studio --help
50
+ erdify-studio --version'
51
+ - name: The sql extra pulls in erdify[sql]
52
+ shell: bash
53
+ run: |
54
+ uv venv /tmp/sql-env
55
+ wheel=$(ls dist/*.whl)
56
+ VIRTUAL_ENV=/tmp/sql-env uv pip install "${wheel}[sql]"
57
+ /tmp/sql-env/bin/python -c "import sqlglot; print('sqlglot', sqlglot.__version__)"
58
+ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
59
+ with:
60
+ name: dist
61
+ path: dist/
62
+ retention-days: 7
@@ -0,0 +1,88 @@
1
+ name: Publish to TestPyPI
2
+
3
+ # Manual dry run of the release path (tests, frontend, wheel check, Trusted Publishing)
4
+ # against TestPyPI before a real release, as in erdify.
5
+ on:
6
+ workflow_dispatch:
7
+ inputs:
8
+ version:
9
+ # hatch-vcs derives the version from git tags; without a release tag it would be
10
+ # a local version (`0.1.dev42+g…`), which PyPI rejects. TestPyPI rejects
11
+ # duplicates too: bump for re-runs (0.1.0.dev1, 0.1.0.dev2, …).
12
+ description: "Version to publish, e.g. 0.1.0.dev1"
13
+ required: true
14
+ type: string
15
+
16
+ # Least privilege by default; the publish job adds only what it needs.
17
+ permissions:
18
+ contents: read
19
+
20
+ jobs:
21
+ # npm and Python build dependencies run here, without the OIDC token (as in publish.yml).
22
+ build:
23
+ name: Build the distributions
24
+ # Only `main` is published. The gate is the `testpypi` environment's deployment
25
+ # branch policy (`main` only); this `if` just turns an accidental dispatch from
26
+ # another branch into a no-op. Keep the build steps in sync with publish.yml.
27
+ if: github.ref == 'refs/heads/main'
28
+ runs-on: ubuntu-latest
29
+ env:
30
+ SETUPTOOLS_SCM_PRETEND_VERSION: ${{ inputs.version }}
31
+ steps:
32
+ - name: Refuse a version that is not PEP 440 without a local part
33
+ env:
34
+ VERSION: ${{ inputs.version }}
35
+ run: |
36
+ [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+((a|b|rc)[0-9]+)?(\.dev[0-9]+)?$ ]] \
37
+ || { echo "version '$VERSION' is not X.Y.Z[aN|bN|rcN][.devN]" >&2; exit 1; }
38
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
39
+ with:
40
+ fetch-depth: 0
41
+ - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
42
+ with:
43
+ node-version: "24"
44
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
45
+ with:
46
+ version: "latest-known"
47
+ enable-cache: false
48
+ - name: Run the tests
49
+ run: uv run --frozen poe test --cov-fail-under=90
50
+ - name: Build the frontend
51
+ working-directory: frontend
52
+ run: |
53
+ npm ci --ignore-scripts --no-audit --no-fund
54
+ npm run build
55
+ - run: uv build
56
+ - name: Refuse a wheel without the frontend
57
+ run: uv run --frozen python scripts/check_wheel.py dist
58
+ - name: The wheel carries the requested version
59
+ env:
60
+ VERSION: ${{ inputs.version }}
61
+ run: ls dist/*.whl | grep -qF "erdify_studio-${VERSION}-"
62
+ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
63
+ with:
64
+ name: dist
65
+ path: dist/
66
+ retention-days: 7
67
+
68
+ publish:
69
+ name: Publish to TestPyPI
70
+ needs: [build]
71
+ runs-on: ubuntu-latest
72
+ if: github.ref == 'refs/heads/main'
73
+ # Deployment branch policy: `main` only. Needs its own Trusted Publisher on
74
+ # test.pypi.org (workflow publish-testpypi.yml, environment testpypi).
75
+ environment: testpypi
76
+ permissions:
77
+ id-token: write
78
+ steps:
79
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
80
+ with:
81
+ name: dist
82
+ path: dist/
83
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
84
+ with:
85
+ version: "latest-known"
86
+ enable-cache: false
87
+ - name: Publish to TestPyPI
88
+ run: uv publish --trusted-publishing always --publish-url https://test.pypi.org/legacy/
@@ -0,0 +1,73 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ # Least privilege by default; the publish job adds only what it needs.
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ # npm and Python build dependencies run here, without the OIDC token, so a
13
+ # compromised build dependency cannot mint a PyPI credential.
14
+ build:
15
+ name: Build the distributions
16
+ # Keep in sync with publish-testpypi.yml (the dry run of this path).
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - name: Refuse a tag that is not vX.Y.Z
20
+ env:
21
+ TAG: ${{ github.ref_name }}
22
+ run: |
23
+ [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+((a|b|rc)[0-9]+)?$ ]] \
24
+ || { echo "release tag '$TAG' is not vX.Y.Z" >&2; exit 1; }
25
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
26
+ with:
27
+ fetch-depth: 0 # hatch-vcs takes the version from the release tag
28
+ # No caches in the release build: a cache written by another run must not
29
+ # end up in what is published.
30
+ - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
31
+ with:
32
+ node-version: "24"
33
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
34
+ with:
35
+ version: "latest-known"
36
+ enable-cache: false
37
+ - name: Run the tests
38
+ run: uv run --frozen poe test --cov-fail-under=90
39
+ - name: Build the frontend
40
+ working-directory: frontend
41
+ run: |
42
+ npm ci --ignore-scripts --no-audit --no-fund
43
+ npm run build
44
+ - run: uv build
45
+ - name: Refuse a wheel without the frontend
46
+ run: uv run --frozen python scripts/check_wheel.py dist
47
+ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
48
+ with:
49
+ name: dist
50
+ path: dist/
51
+ retention-days: 7
52
+
53
+ publish:
54
+ name: Publish to PyPI
55
+ needs: [build]
56
+ runs-on: ubuntu-latest
57
+ # Gated environment: required reviewers + tag-only deployment (v*), as in erdify.
58
+ environment: pypi
59
+ permissions:
60
+ # OIDC token for PyPI Trusted Publishing - no long-lived API token.
61
+ id-token: write
62
+ steps:
63
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
64
+ with:
65
+ name: dist
66
+ path: dist/
67
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
68
+ with:
69
+ version: "latest-known"
70
+ enable-cache: false
71
+ - name: Publish to PyPI
72
+ # No token: uv reads the OIDC credentials minted via id-token: write.
73
+ run: uv publish --trusted-publishing always
@@ -0,0 +1,170 @@
1
+ name: Testing
2
+
3
+ concurrency:
4
+ group: "testing-${{ github.event_name == 'push' && github.sha || github.ref }}"
5
+ cancel-in-progress: true
6
+
7
+ on:
8
+ push: { branches: [main] }
9
+ pull_request: { branches: [main] }
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ test:
16
+ name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
17
+ runs-on: ${{ matrix.os }}
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ # Full Python sweep on Linux; macOS/Windows smoke-test min + max (same as erdify).
22
+ os: [ubuntu-latest]
23
+ python-version: ["3.11", "3.12", "3.13", "3.14", "3.15"]
24
+ include:
25
+ - { os: macos-latest, python-version: "3.11" }
26
+ - { os: macos-latest, python-version: "3.15" }
27
+ - { os: windows-latest, python-version: "3.11" }
28
+ - { os: windows-latest, python-version: "3.15" }
29
+ steps:
30
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
31
+ with:
32
+ fetch-depth: 0 # hatch-vcs derives the version from the latest tag
33
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
34
+ with:
35
+ # Newest uv whose checksum ships with setup-uv: new uv versions only arrive
36
+ # through a reviewed Dependabot bump of this action.
37
+ version: "latest-known"
38
+ # Sets UV_PYTHON for later steps; otherwise uv would honour .python-version.
39
+ python-version: ${{ matrix.python-version }}
40
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
41
+ with:
42
+ python-version: ${{ matrix.python-version }}
43
+ - run: uv sync --frozen
44
+ - name: Assert the matrix Python is in use
45
+ env:
46
+ EXPECTED: ${{ matrix.python-version }}
47
+ shell: bash
48
+ run: uv run python -c "import os, sys; assert '%d.%d' % sys.version_info[:2] == os.environ['EXPECTED'], sys.version"
49
+ - run: uv run --frozen poe test --cov-fail-under=90 --cov-report=xml
50
+ # Uploaded from one leg only: every leg measures the same line coverage, so more
51
+ # uploads would only fragment the report in Datadog (same as erdify).
52
+ #
53
+ # Skipped for fork PRs (no secrets on `pull_request`; never switch to
54
+ # `pull_request_target`, it would expose the key to untrusted code) and for
55
+ # Dependabot (its runs get Dependabot secrets, so the key would be empty).
56
+ # Secrets can't be used in `if:` (a startup_failure), and a job-level env var
57
+ # would hand the key to every step, so the condition matches on the actor.
58
+ - name: Upload coverage to Datadog
59
+ if: >-
60
+ !cancelled()
61
+ && matrix.os == 'ubuntu-latest'
62
+ && matrix.python-version == '3.13'
63
+ && github.actor != 'dependabot[bot]'
64
+ && (github.event_name != 'pull_request'
65
+ || github.event.pull_request.head.repo.full_name == github.repository)
66
+ uses: DataDog/coverage-upload-github-action@d9548b1c3c4ab639d5d3ab29a1508af188975f77 # v1.0.5
67
+ with:
68
+ api_key: ${{ secrets.DATADOG_CODE_COVERAGE_KEY }}
69
+ site: datadoghq.eu
70
+ # The action is SHA-pinned, but its `version` input defaults to a floating
71
+ # datadog-ci major that runs with the API key — pin it too (bumped by hand;
72
+ # Dependabot only tracks the `uses` reference).
73
+ version: "v5.23.0"
74
+ flags: "type:unit-tests,language:python"
75
+ files: coverage.xml
76
+
77
+ # README coverage badge: a shields.io endpoint payload on the orphan `badges`
78
+ # branch (https://raw.githubusercontent.com/devsuit-berlin/erdify-studio/badges/coverage.json).
79
+ # Datadog has no public badge endpoint; the branch keeps the data in this repo with
80
+ # GITHUB_TOKEN as the only credential. A separate job because it needs
81
+ # `contents: write`, which the test matrix must not have; it re-measures coverage
82
+ # rather than passing an artifact (same as erdify).
83
+ badge:
84
+ name: Coverage badge
85
+ # Pushes to main only: a PR must not move what the default branch advertises.
86
+ if: github.event_name == 'push'
87
+ needs: [test]
88
+ runs-on: ubuntu-latest
89
+ # Push runs are grouped per commit above, so two merges can run in parallel;
90
+ # serialise the badge commits so the second push doesn't fail non-fast-forward.
91
+ concurrency:
92
+ group: coverage-badge
93
+ cancel-in-progress: false
94
+ permissions:
95
+ contents: write
96
+ steps:
97
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
98
+ with:
99
+ fetch-depth: 0 # hatch-vcs derives the version from the latest tag
100
+ - name: Checkout the badges branch
101
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
102
+ with:
103
+ ref: badges
104
+ path: .badges
105
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
106
+ with:
107
+ version: "latest-known"
108
+ python-version: "3.13"
109
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
110
+ with:
111
+ python-version: "3.13"
112
+ - run: uv sync --frozen
113
+ - run: uv run --frozen poe test --cov-report=xml
114
+ - name: Write the badge payload
115
+ run: |
116
+ python - <<'EOF' > .badges/coverage.json
117
+ import json
118
+ import xml.etree.ElementTree as ET
119
+
120
+ percentage = float(ET.parse("coverage.xml").getroot().get("line-rate")) * 100
121
+ # Below the 90 % gate the test job fails anyway, so the scale centres on
122
+ # the range that still carries information.
123
+ thresholds = ((95, "brightgreen"), (90, "green"), (85, "yellowgreen"), (70, "yellow"))
124
+ color = next((c for t, c in thresholds if percentage >= t), "red")
125
+ badge = {
126
+ "schemaVersion": 1,
127
+ "label": "coverage",
128
+ "message": f"{percentage:.2f}%",
129
+ "color": color,
130
+ }
131
+ print(json.dumps(badge, indent=2))
132
+ EOF
133
+ cat .badges/coverage.json
134
+ - name: Commit the badge payload
135
+ working-directory: .badges
136
+ run: |
137
+ if git diff --quiet -- coverage.json; then
138
+ echo "Coverage unchanged; nothing to commit."
139
+ exit 0
140
+ fi
141
+ git config user.name "github-actions[bot]"
142
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
143
+ git add coverage.json
144
+ git commit -m "chore(badge): coverage $(python -c "import json;print(json.load(open('coverage.json'))['message'])")"
145
+ git push
146
+
147
+ # Single aggregate check to require in the ruleset: green only when every matrix
148
+ # leg passed, so Python versions or OSes can change without editing the
149
+ # required-checks list (same as erdify).
150
+ gate:
151
+ name: Tests passed
152
+ if: always()
153
+ needs: [test]
154
+ runs-on: ubuntu-latest
155
+ steps:
156
+ # `badges` holds only bot-written badge payloads. A pull request from it would
157
+ # pass every test (it adds no code) while replacing main's whole tree. GitHub
158
+ # can't bar a branch from being a pull-request *source*, so failing the
159
+ # required check makes such a pull request unmergeable.
160
+ - name: Refuse pull requests from machine-written branches
161
+ env:
162
+ HEAD_REF: ${{ github.head_ref }}
163
+ run: |
164
+ if [[ "$HEAD_REF" == "badges" ]]; then
165
+ echo "::error::The badges branch is machine-written and must never be merged into main. Close this pull request."
166
+ exit 1
167
+ fi
168
+ - name: Fail if any matrix job failed
169
+ if: needs.test.result != 'success'
170
+ run: exit 1
@@ -0,0 +1,21 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ .pytest_cache/
5
+ .coverage
6
+ dist/
7
+ build/
8
+ .mypy_cache/
9
+ .ruff_cache/
10
+ coverage.xml
11
+
12
+ # Frontend: dependencies and the build that ships inside the wheel
13
+ frontend/node_modules/
14
+ src/erdify_studio/_static/
15
+ *.egg-info/
16
+
17
+ # Personal / local agent setup
18
+ .claude/
19
+ .mcp.json
20
+ CLAUDE.local.md
21
+ site/
@@ -0,0 +1,47 @@
1
+ default_language_version:
2
+ python: python3.13
3
+ repos:
4
+ - repo: https://github.com/pre-commit/pre-commit-hooks
5
+ rev: v6.0.0
6
+ hooks:
7
+ - id: end-of-file-fixer
8
+ - id: trailing-whitespace
9
+ - id: check-yaml
10
+ args: [--allow-multiple-documents]
11
+ - id: check-toml
12
+ - id: check-added-large-files
13
+ - repo: https://github.com/pre-commit/pre-commit
14
+ rev: v4.7.0
15
+ hooks:
16
+ # The hooks this repo ships to consumers (.pre-commit-hooks.yaml).
17
+ - id: validate_manifest
18
+ - repo: https://github.com/astral-sh/uv-pre-commit
19
+ rev: 0.11.21
20
+ hooks:
21
+ # Fail when uv.lock is out of sync with pyproject.toml.
22
+ - id: uv-lock
23
+ - repo: local
24
+ hooks:
25
+ - id: check-instructions
26
+ name: Check AI instruction files (CLAUDE.md imports, applyTo globs, size budget)
27
+ entry: python scripts/check_instructions.py
28
+ language: python
29
+ pass_filenames: false
30
+ # Globs depend on the tracked file list, so a rename anywhere can break it.
31
+ always_run: true
32
+ - id: ruff-check
33
+ name: Check code with ruff
34
+ entry: uv run ruff check --force-exclude --fix --exit-non-zero-on-fix
35
+ language: system
36
+ types: [python]
37
+ - id: ruff-format
38
+ name: Format code with ruff
39
+ entry: uv run ruff format --force-exclude --exit-non-zero-on-format
40
+ language: system
41
+ types: [python]
42
+ - id: mypy
43
+ name: Type check with mypy (strict)
44
+ entry: uv run mypy
45
+ language: system
46
+ types: [python]
47
+ pass_filenames: false