brepax 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 (179) hide show
  1. brepax-0.1.0/.devcontainer/Dockerfile +5 -0
  2. brepax-0.1.0/.devcontainer/devcontainer.json +24 -0
  3. brepax-0.1.0/.editorconfig +18 -0
  4. brepax-0.1.0/.gitattributes +17 -0
  5. brepax-0.1.0/.github/CODEOWNERS +1 -0
  6. brepax-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yaml +46 -0
  7. brepax-0.1.0/.github/ISSUE_TEMPLATE/config.yaml +1 -0
  8. brepax-0.1.0/.github/ISSUE_TEMPLATE/feature_request.yaml +23 -0
  9. brepax-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +28 -0
  10. brepax-0.1.0/.github/dependabot.yml +19 -0
  11. brepax-0.1.0/.github/workflows/ci.yaml +55 -0
  12. brepax-0.1.0/.github/workflows/docs.yaml +26 -0
  13. brepax-0.1.0/.github/workflows/publish-test.yaml +29 -0
  14. brepax-0.1.0/.github/workflows/publish.yaml +24 -0
  15. brepax-0.1.0/.github/workflows/release-please.yaml +22 -0
  16. brepax-0.1.0/.gitignore +51 -0
  17. brepax-0.1.0/.lefthook.yml +20 -0
  18. brepax-0.1.0/.mise.toml +42 -0
  19. brepax-0.1.0/.python-version +1 -0
  20. brepax-0.1.0/.release-please-manifest.json +3 -0
  21. brepax-0.1.0/CHANGELOG.md +6 -0
  22. brepax-0.1.0/CITATION.cff +16 -0
  23. brepax-0.1.0/CLAUDE.md +155 -0
  24. brepax-0.1.0/CODE_OF_CONDUCT.md +34 -0
  25. brepax-0.1.0/CONTRIBUTING.md +77 -0
  26. brepax-0.1.0/LICENSE +190 -0
  27. brepax-0.1.0/PKG-INFO +133 -0
  28. brepax-0.1.0/README.md +51 -0
  29. brepax-0.1.0/SECURITY.md +17 -0
  30. brepax-0.1.0/docs/architecture/3d-extension-roadmap.md +52 -0
  31. brepax-0.1.0/docs/architecture/adr/0001-jax-native-rationale.md +27 -0
  32. brepax-0.1.0/docs/architecture/adr/0002-equinox-pytree-pattern.md +24 -0
  33. brepax-0.1.0/docs/architecture/adr/0003-stratum-label-encoding.md +49 -0
  34. brepax-0.1.0/docs/architecture/adr/0004-custom-vjp-at-boundaries.md +105 -0
  35. brepax-0.1.0/docs/architecture/adr/0005-half-edge-padding-strategy.md +24 -0
  36. brepax-0.1.0/docs/architecture/adr/0006-license-apache-2-rationale.md +26 -0
  37. brepax-0.1.0/docs/architecture/adr/0007-ocp-binding-choice.md +39 -0
  38. brepax-0.1.0/docs/architecture/adr/0008-occt-abstraction-layer.md +27 -0
  39. brepax-0.1.0/docs/architecture/adr/0009-method-b-deferred.md +47 -0
  40. brepax-0.1.0/docs/architecture/adr/0010-design-validation-split.md +41 -0
  41. brepax-0.1.0/docs/architecture/adr/0011-hybrid-strategy.md +49 -0
  42. brepax-0.1.0/docs/architecture/adr/0012-generic-stratum-detection.md +43 -0
  43. brepax-0.1.0/docs/architecture/adr/0013-mold-direction-demonstrator.md +77 -0
  44. brepax-0.1.0/docs/architecture/adr/template.md +17 -0
  45. brepax-0.1.0/docs/architecture/index.md +14 -0
  46. brepax-0.1.0/docs/explanation/3d_extension_evaluation.md +138 -0
  47. brepax-0.1.0/docs/explanation/concept_proof_evaluation.md +130 -0
  48. brepax-0.1.0/docs/explanation/contact_dynamics_analogy.md +3 -0
  49. brepax-0.1.0/docs/explanation/design_thesis.md +3 -0
  50. brepax-0.1.0/docs/explanation/hybrid_optimization_strategy.md +49 -0
  51. brepax-0.1.0/docs/explanation/jax_where_gradient_pitfall.md +46 -0
  52. brepax-0.1.0/docs/explanation/license_strategy.md +25 -0
  53. brepax-0.1.0/docs/explanation/pseudo_sdf_problem.md +3 -0
  54. brepax-0.1.0/docs/explanation/stratification_theory.md +3 -0
  55. brepax-0.1.0/docs/explanation/toi_derivation.md +188 -0
  56. brepax-0.1.0/docs/explanation/why_brep.md +33 -0
  57. brepax-0.1.0/docs/how-to/batch_with_vmap.md +3 -0
  58. brepax-0.1.0/docs/how-to/compose_primitives.md +3 -0
  59. brepax-0.1.0/docs/how-to/custom_loss.md +3 -0
  60. brepax-0.1.0/docs/how-to/interop_pythonocc.md +3 -0
  61. brepax-0.1.0/docs/index.md +13 -0
  62. brepax-0.1.0/docs/reference/index.md +3 -0
  63. brepax-0.1.0/docs/stylesheets/extra.css +1 -0
  64. brepax-0.1.0/docs/tutorials/01_quickstart.md +3 -0
  65. brepax-0.1.0/docs/tutorials/02_first_optimization.md +3 -0
  66. brepax-0.1.0/docs/tutorials/03_stratum_tracking.md +3 -0
  67. brepax-0.1.0/examples/01_hello_world.ipynb +153 -0
  68. brepax-0.1.0/examples/01_hello_world.py +91 -0
  69. brepax-0.1.0/examples/02_disk_union_2d.ipynb +204 -0
  70. brepax-0.1.0/examples/02_disk_union_2d.py +129 -0
  71. brepax-0.1.0/examples/03_3d_primitives.ipynb +167 -0
  72. brepax-0.1.0/examples/03_3d_primitives.py +117 -0
  73. brepax-0.1.0/examples/04_boolean_operations.ipynb +207 -0
  74. brepax-0.1.0/examples/04_boolean_operations.py +143 -0
  75. brepax-0.1.0/examples/05_stratum_tracking.ipynb +184 -0
  76. brepax-0.1.0/examples/05_stratum_tracking.py +134 -0
  77. brepax-0.1.0/examples/06_drilling_demo.ipynb +216 -0
  78. brepax-0.1.0/examples/06_drilling_demo.py +154 -0
  79. brepax-0.1.0/examples/07_mold_direction_demo.ipynb +239 -0
  80. brepax-0.1.0/examples/07_mold_direction_demo.py +165 -0
  81. brepax-0.1.0/mkdocs.yml +93 -0
  82. brepax-0.1.0/noxfile.py +57 -0
  83. brepax-0.1.0/pyproject.toml +127 -0
  84. brepax-0.1.0/release-please-config.json +12 -0
  85. brepax-0.1.0/ruff.toml +33 -0
  86. brepax-0.1.0/src/brepax/__init__.py +5 -0
  87. brepax-0.1.0/src/brepax/_internal/__init__.py +1 -0
  88. brepax-0.1.0/src/brepax/_internal/jax_utils.py +1 -0
  89. brepax-0.1.0/src/brepax/_internal/linalg.py +1 -0
  90. brepax-0.1.0/src/brepax/_occt/__init__.py +5 -0
  91. brepax-0.1.0/src/brepax/_occt/backend.py +6 -0
  92. brepax-0.1.0/src/brepax/_occt/types.py +5 -0
  93. brepax-0.1.0/src/brepax/_version.py +24 -0
  94. brepax-0.1.0/src/brepax/analytical/__init__.py +1 -0
  95. brepax-0.1.0/src/brepax/analytical/disk_disk.py +115 -0
  96. brepax-0.1.0/src/brepax/analytical/sphere_sphere.py +111 -0
  97. brepax-0.1.0/src/brepax/boolean/__init__.py +88 -0
  98. brepax-0.1.0/src/brepax/boolean/closest_point.py +1 -0
  99. brepax-0.1.0/src/brepax/boolean/smoothing.py +128 -0
  100. brepax-0.1.0/src/brepax/boolean/stratum.py +424 -0
  101. brepax-0.1.0/src/brepax/boolean/toi.py +11 -0
  102. brepax-0.1.0/src/brepax/boolean/unified.py +1 -0
  103. brepax-0.1.0/src/brepax/brep/__init__.py +1 -0
  104. brepax-0.1.0/src/brepax/brep/convert.py +1 -0
  105. brepax-0.1.0/src/brepax/brep/topology.py +1 -0
  106. brepax-0.1.0/src/brepax/experimental/__init__.py +1 -0
  107. brepax-0.1.0/src/brepax/experimental/applications/__init__.py +17 -0
  108. brepax-0.1.0/src/brepax/experimental/applications/mold_direction.py +205 -0
  109. brepax-0.1.0/src/brepax/experimental/optimizers/__init__.py +102 -0
  110. brepax-0.1.0/src/brepax/io/__init__.py +1 -0
  111. brepax-0.1.0/src/brepax/io/mesh.py +1 -0
  112. brepax-0.1.0/src/brepax/io/step.py +1 -0
  113. brepax-0.1.0/src/brepax/persistence/__init__.py +1 -0
  114. brepax-0.1.0/src/brepax/persistence/critical.py +1 -0
  115. brepax-0.1.0/src/brepax/persistence/diagram.py +1 -0
  116. brepax-0.1.0/src/brepax/persistence/filtration.py +1 -0
  117. brepax-0.1.0/src/brepax/persistence/losses.py +1 -0
  118. brepax-0.1.0/src/brepax/primitives/__init__.py +23 -0
  119. brepax-0.1.0/src/brepax/primitives/_base.py +37 -0
  120. brepax-0.1.0/src/brepax/primitives/box.py +35 -0
  121. brepax-0.1.0/src/brepax/primitives/cone.py +43 -0
  122. brepax-0.1.0/src/brepax/primitives/cylinder.py +42 -0
  123. brepax-0.1.0/src/brepax/primitives/disk.py +30 -0
  124. brepax-0.1.0/src/brepax/primitives/finite_cylinder.py +61 -0
  125. brepax-0.1.0/src/brepax/primitives/plane.py +29 -0
  126. brepax-0.1.0/src/brepax/primitives/sphere.py +30 -0
  127. brepax-0.1.0/src/brepax/primitives/torus.py +46 -0
  128. brepax-0.1.0/src/brepax/py.typed +0 -0
  129. brepax-0.1.0/src/brepax/stratification/__init__.py +1 -0
  130. brepax-0.1.0/src/brepax/stratification/cerf.py +1 -0
  131. brepax-0.1.0/src/brepax/stratification/detector.py +1 -0
  132. brepax-0.1.0/src/brepax/stratification/label.py +1 -0
  133. brepax-0.1.0/src/brepax/stratification/transition.py +1 -0
  134. brepax-0.1.0/src/brepax/topology/__init__.py +1 -0
  135. brepax-0.1.0/src/brepax/topology/extract.py +1 -0
  136. brepax-0.1.0/src/brepax/topology/halfedge.py +1 -0
  137. brepax-0.1.0/src/brepax/topology/invariants.py +1 -0
  138. brepax-0.1.0/src/brepax/viz/__init__.py +1 -0
  139. brepax-0.1.0/src/brepax/viz/plot2d.py +1 -0
  140. brepax-0.1.0/src/brepax/viz/plot3d.py +1 -0
  141. brepax-0.1.0/tests/benchmarks/conftest.py +10 -0
  142. brepax-0.1.0/tests/benchmarks/test_gradient_accuracy.py +256 -0
  143. brepax-0.1.0/tests/benchmarks/test_optimization_trajectory.py +180 -0
  144. brepax-0.1.0/tests/benchmarks/test_vmap_scaling.py +140 -0
  145. brepax-0.1.0/tests/conftest.py +25 -0
  146. brepax-0.1.0/tests/integration/__init__.py +0 -0
  147. brepax-0.1.0/tests/integration/test_compositions.py +1 -0
  148. brepax-0.1.0/tests/integration/test_grad.py +1 -0
  149. brepax-0.1.0/tests/integration/test_jit.py +1 -0
  150. brepax-0.1.0/tests/integration/test_vmap.py +1 -0
  151. brepax-0.1.0/tests/property/__init__.py +0 -0
  152. brepax-0.1.0/tests/property/test_boolean_algebra.py +1 -0
  153. brepax-0.1.0/tests/property/test_gradient_consistency.py +1 -0
  154. brepax-0.1.0/tests/property/test_sdf_invariants.py +1 -0
  155. brepax-0.1.0/tests/unit/__init__.py +0 -0
  156. brepax-0.1.0/tests/unit/analytical/__init__.py +0 -0
  157. brepax-0.1.0/tests/unit/analytical/test_disk_disk.py +100 -0
  158. brepax-0.1.0/tests/unit/analytical/test_sphere_sphere.py +124 -0
  159. brepax-0.1.0/tests/unit/boolean/__init__.py +0 -0
  160. brepax-0.1.0/tests/unit/boolean/test_drilling.py +137 -0
  161. brepax-0.1.0/tests/unit/boolean/test_heterogeneous.py +88 -0
  162. brepax-0.1.0/tests/unit/boolean/test_smoothing.py +168 -0
  163. brepax-0.1.0/tests/unit/boolean/test_stratum.py +156 -0
  164. brepax-0.1.0/tests/unit/boolean/test_stratum_3d.py +53 -0
  165. brepax-0.1.0/tests/unit/experimental/__init__.py +0 -0
  166. brepax-0.1.0/tests/unit/experimental/test_mold_direction.py +166 -0
  167. brepax-0.1.0/tests/unit/persistence/__init__.py +0 -0
  168. brepax-0.1.0/tests/unit/primitives/__init__.py +0 -0
  169. brepax-0.1.0/tests/unit/primitives/test_box.py +82 -0
  170. brepax-0.1.0/tests/unit/primitives/test_cone.py +68 -0
  171. brepax-0.1.0/tests/unit/primitives/test_cylinder.py +86 -0
  172. brepax-0.1.0/tests/unit/primitives/test_disk.py +55 -0
  173. brepax-0.1.0/tests/unit/primitives/test_finite_cylinder.py +76 -0
  174. brepax-0.1.0/tests/unit/primitives/test_plane.py +80 -0
  175. brepax-0.1.0/tests/unit/primitives/test_sphere.py +60 -0
  176. brepax-0.1.0/tests/unit/primitives/test_torus.py +73 -0
  177. brepax-0.1.0/tests/unit/stratification/__init__.py +0 -0
  178. brepax-0.1.0/tests/unit/topology/__init__.py +0 -0
  179. brepax-0.1.0/uv.lock +3159 -0
@@ -0,0 +1,5 @@
1
+ FROM mcr.microsoft.com/devcontainers/python:1-3.12-bookworm
2
+
3
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
4
+
5
+ ENV UV_LINK_MODE=copy
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "BRepAX",
3
+ "build": {
4
+ "dockerfile": "Dockerfile"
5
+ },
6
+ "features": {
7
+ "ghcr.io/devcontainers/features/python:1": {
8
+ "version": "3.12"
9
+ }
10
+ },
11
+ "postCreateCommand": "curl -LsSf https://astral.sh/uv/install.sh | sh && uv sync --extra dev",
12
+ "customizations": {
13
+ "vscode": {
14
+ "extensions": [
15
+ "ms-python.python",
16
+ "charliermarsh.ruff",
17
+ "ms-python.mypy-type-checker"
18
+ ],
19
+ "settings": {
20
+ "python.defaultInterpreterPath": ".venv/bin/python"
21
+ }
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,18 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 4
6
+ end_of_line = lf
7
+ charset = utf-8
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
10
+
11
+ [*.{yaml,yml,toml,json}]
12
+ indent_size = 2
13
+
14
+ [*.md]
15
+ trim_trailing_whitespace = false
16
+
17
+ [Makefile]
18
+ indent_style = tab
@@ -0,0 +1,17 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
3
+
4
+ # Python
5
+ *.py text diff=python
6
+
7
+ # Lockfile — binary diff, always merge ours
8
+ uv.lock -diff merge=ours linguist-generated
9
+
10
+ # Documentation
11
+ *.md text diff=markdown
12
+
13
+ # Notebooks — stored as JSON, output stripped on commit
14
+ *.ipynb filter=nbstripout diff=json linguist-generated
15
+
16
+ # Benchmark results
17
+ benchmarks/gradient_accuracy/results/*.json linguist-generated
@@ -0,0 +1 @@
1
+ * @lv416e
@@ -0,0 +1,46 @@
1
+ name: Bug Report
2
+ description: Report a bug in BRepAX
3
+ labels: ["bug"]
4
+ body:
5
+ - type: textarea
6
+ id: description
7
+ attributes:
8
+ label: Description
9
+ description: A clear description of the bug.
10
+ validations:
11
+ required: true
12
+ - type: textarea
13
+ id: reproduction
14
+ attributes:
15
+ label: Steps to Reproduce
16
+ description: Minimal code to reproduce the issue.
17
+ render: python
18
+ validations:
19
+ required: true
20
+ - type: textarea
21
+ id: expected
22
+ attributes:
23
+ label: Expected Behavior
24
+ description: What you expected to happen.
25
+ validations:
26
+ required: true
27
+ - type: input
28
+ id: version
29
+ attributes:
30
+ label: BRepAX Version
31
+ placeholder: e.g., 0.1.0
32
+ validations:
33
+ required: true
34
+ - type: input
35
+ id: jax-version
36
+ attributes:
37
+ label: JAX Version
38
+ placeholder: e.g., 0.4.34
39
+ - type: dropdown
40
+ id: os
41
+ attributes:
42
+ label: Operating System
43
+ options:
44
+ - Linux
45
+ - macOS
46
+ - Windows
@@ -0,0 +1 @@
1
+ blank_issues_enabled: true
@@ -0,0 +1,23 @@
1
+ name: Feature Request
2
+ description: Suggest a new feature
3
+ labels: ["enhancement"]
4
+ body:
5
+ - type: textarea
6
+ id: description
7
+ attributes:
8
+ label: Description
9
+ description: A clear description of the feature you'd like.
10
+ validations:
11
+ required: true
12
+ - type: textarea
13
+ id: motivation
14
+ attributes:
15
+ label: Motivation
16
+ description: Why is this feature needed? What problem does it solve?
17
+ validations:
18
+ required: true
19
+ - type: textarea
20
+ id: alternatives
21
+ attributes:
22
+ label: Alternatives Considered
23
+ description: Any alternative solutions you've considered.
@@ -0,0 +1,28 @@
1
+ ## What changed
2
+
3
+ <!-- 1-3 sentences describing the essence of this change -->
4
+
5
+ ## Why
6
+
7
+ <!-- Motivation, link to spec section or ADR if applicable -->
8
+
9
+ ## How verified
10
+
11
+ - [ ] Tests pass (`uv run pytest`)
12
+ - [ ] Type checking passes (`uv run mypy src/`)
13
+ - [ ] Linting passes (`uv run ruff check src/ tests/`)
14
+
15
+ <!-- Benchmark results or unexpected behaviors, if applicable -->
16
+
17
+ ## Open questions
18
+
19
+ <!-- Unresolved points to address in follow-up PRs -->
20
+
21
+ ## Checklist
22
+
23
+ - [ ] Property tests added/updated
24
+ - [ ] Unit tests added/updated
25
+ - [ ] Type annotations complete
26
+ - [ ] Docstrings with Examples section
27
+ - [ ] ADR updated if architectural decision was made
28
+ - [ ] Commit messages follow Conventional Commits
@@ -0,0 +1,19 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: github-actions
4
+ directory: /
5
+ schedule:
6
+ interval: monthly
7
+ - package-ecosystem: pip
8
+ directory: /
9
+ schedule:
10
+ interval: weekly
11
+ groups:
12
+ jax:
13
+ patterns:
14
+ - "jax*"
15
+ testing:
16
+ patterns:
17
+ - "pytest*"
18
+ - "hypothesis"
19
+ - "chex"
@@ -0,0 +1,55 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ concurrency:
10
+ group: ${{ github.workflow }}-${{ github.ref }}
11
+ cancel-in-progress: true
12
+
13
+ jobs:
14
+ lint:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v6
18
+ - uses: astral-sh/setup-uv@v7
19
+ with:
20
+ enable-cache: true
21
+ - run: uv sync --extra dev
22
+ - run: uv run ruff check src/ tests/
23
+ - run: uv run ruff format --check src/ tests/
24
+
25
+ typecheck:
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@v6
29
+ - uses: astral-sh/setup-uv@v7
30
+ with:
31
+ enable-cache: true
32
+ - run: uv sync --extra dev
33
+ - run: uv run mypy src/
34
+
35
+ test:
36
+ needs: [lint, typecheck]
37
+ strategy:
38
+ fail-fast: false
39
+ matrix:
40
+ python-version: ["3.11", "3.12", "3.13"]
41
+ os: [ubuntu-latest, macos-latest]
42
+ runs-on: ${{ matrix.os }}
43
+ steps:
44
+ - uses: actions/checkout@v6
45
+ - uses: astral-sh/setup-uv@v7
46
+ with:
47
+ enable-cache: true
48
+ python-version: ${{ matrix.python-version }}
49
+ - run: uv sync --extra dev
50
+ - run: uv run pytest --cov=brepax --cov-report=xml -x -m "not slow"
51
+ - uses: codecov/codecov-action@v6
52
+ if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'
53
+ with:
54
+ file: coverage.xml
55
+ fail_ci_if_error: false
@@ -0,0 +1,26 @@
1
+ name: Documentation
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ permissions:
10
+ contents: write
11
+
12
+ jobs:
13
+ docs:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v6
17
+ with:
18
+ fetch-depth: 0
19
+ - uses: astral-sh/setup-uv@v7
20
+ with:
21
+ enable-cache: true
22
+ - run: uv sync --extra docs
23
+ - run: uv run mkdocs build --strict
24
+ - name: Deploy to GitHub Pages
25
+ if: github.ref == 'refs/heads/main' && github.event_name == 'push'
26
+ run: uv run mkdocs gh-deploy --force
@@ -0,0 +1,29 @@
1
+ name: Publish to TestPyPI
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ tags:
7
+ - "v*.*.*-rc*"
8
+ - "v*.*.*-beta*"
9
+
10
+ permissions:
11
+ id-token: write
12
+
13
+ jobs:
14
+ publish:
15
+ runs-on: ubuntu-latest
16
+ environment:
17
+ name: testpypi
18
+ url: https://test.pypi.org/project/brepax/
19
+ steps:
20
+ - uses: actions/checkout@v6
21
+ with:
22
+ fetch-depth: 0
23
+ - uses: astral-sh/setup-uv@v7
24
+ with:
25
+ enable-cache: true
26
+ - run: uv build
27
+ - uses: pypa/gh-action-pypi-publish@release/v1
28
+ with:
29
+ repository-url: https://test.pypi.org/legacy/
@@ -0,0 +1,24 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ id-token: write
9
+
10
+ jobs:
11
+ publish:
12
+ runs-on: ubuntu-latest
13
+ environment:
14
+ name: pypi
15
+ url: https://pypi.org/project/brepax/
16
+ steps:
17
+ - uses: actions/checkout@v6
18
+ with:
19
+ fetch-depth: 0
20
+ - uses: astral-sh/setup-uv@v7
21
+ with:
22
+ enable-cache: true
23
+ - run: uv build
24
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,22 @@
1
+ name: Release Please
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+
7
+ permissions:
8
+ contents: write
9
+ pull-requests: write
10
+
11
+ jobs:
12
+ release-please:
13
+ runs-on: ubuntu-latest
14
+ outputs:
15
+ release_created: ${{ steps.release.outputs.release_created }}
16
+ tag_name: ${{ steps.release.outputs.tag_name }}
17
+ steps:
18
+ - uses: googleapis/release-please-action@v4
19
+ id: release
20
+ with:
21
+ config-file: release-please-config.json
22
+ manifest-file: .release-please-manifest.json
@@ -0,0 +1,51 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.egg-info/
6
+ *.egg
7
+ dist/
8
+ build/
9
+ *.whl
10
+
11
+ # Virtual environments
12
+ .venv/
13
+ venv/
14
+
15
+ # IDE
16
+ .idea/
17
+ .vscode/
18
+ *.swp
19
+ *.swo
20
+ *~
21
+
22
+ # Testing
23
+ .coverage
24
+ htmlcov/
25
+ .pytest_cache/
26
+ .hypothesis/
27
+ .benchmarks/
28
+
29
+ # mypy
30
+ .mypy_cache/
31
+
32
+ # ruff
33
+ .ruff_cache/
34
+
35
+ # Documentation
36
+ site/
37
+
38
+ # Secrets and credentials
39
+ .env
40
+ .env.*
41
+ credentials.*
42
+
43
+ # OS
44
+ .DS_Store
45
+ Thumbs.db
46
+
47
+ # Jupyter
48
+ .ipynb_checkpoints/
49
+
50
+ # nox
51
+ .nox/
@@ -0,0 +1,20 @@
1
+ pre-commit:
2
+ parallel: false
3
+ commands:
4
+ ruff-format:
5
+ glob: "*.py"
6
+ run: uv run ruff format src/ tests/
7
+ ruff-check:
8
+ glob: "*.py"
9
+ run: uv run ruff check src/ tests/ --fix
10
+ stage_fixed: true
11
+ mypy:
12
+ glob: "*.py"
13
+ run: uv run mypy src/
14
+
15
+ commit-msg:
16
+ commands:
17
+ conventional-commit:
18
+ run: >
19
+ head -1 {1} | grep -qE '^(feat|fix|refactor|docs|test|perf|ci|chore|build|style|revert)(\(.+\))?!?: .+'
20
+ || (echo "Commit message must follow Conventional Commits: <type>(<scope>): <description>" && exit 1)
@@ -0,0 +1,42 @@
1
+ # BRepAX Development Environment
2
+ # Managed by mise (https://mise.jdx.dev)
3
+
4
+ [tools]
5
+ python = "3.12"
6
+ uv = "latest"
7
+ lefthook = "latest"
8
+
9
+ [tasks.sync]
10
+ description = "Sync dependencies"
11
+ run = "uv sync"
12
+
13
+ [tasks.test]
14
+ description = "Run tests"
15
+ run = "uv run pytest"
16
+
17
+ [tasks.lint]
18
+ description = "Run ruff linter"
19
+ run = "uv run ruff check src/ tests/"
20
+
21
+ [tasks.fmt]
22
+ description = "Format code"
23
+ run = ["uv run ruff format src/ tests/", "uv run ruff check --fix src/ tests/"]
24
+
25
+ [tasks.type-check]
26
+ description = "Run mypy type checker"
27
+ run = "uv run mypy src/"
28
+
29
+ [tasks.check]
30
+ description = "Run all checks (lint + type-check + test)"
31
+ depends = ["lint", "type-check", "test"]
32
+
33
+ [tasks.docs]
34
+ description = "Serve documentation locally"
35
+ run = "uv run mkdocs serve"
36
+
37
+ [tasks.bench]
38
+ description = "Run benchmarks"
39
+ run = "uv run pytest tests/benchmarks/ --benchmark-only"
40
+
41
+ [env]
42
+ UV_LINK_MODE = "copy"
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.0.0"
3
+ }
@@ -0,0 +1,6 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/).
@@ -0,0 +1,16 @@
1
+ cff-version: 1.2.0
2
+ title: BRepAX
3
+ message: "If you use this software, please cite it as below."
4
+ type: software
5
+ authors:
6
+ - given-names: lv416e
7
+ email: mary.lv416e@gmail.com
8
+ repository-code: https://github.com/lv416e/brepax
9
+ license: Apache-2.0
10
+ keywords:
11
+ - jax
12
+ - cad
13
+ - differentiable
14
+ - brep
15
+ - boolean-operations
16
+ - signed-distance-function
brepax-0.1.0/CLAUDE.md ADDED
@@ -0,0 +1,155 @@
1
+ <!-- markdownlint-disable MD013 -->
2
+ # Project Guidelines
3
+
4
+ ## Language and Style
5
+
6
+ **English** -- code, comments, docstrings, commit messages, log messages.
7
+ **Japanese** -- PR titles/bodies, issue titles/bodies, markdown documentation, user-facing communication.
8
+ No emojis in code, comments, or documentation.
9
+
10
+ ## Project Mission
11
+
12
+ BRepAX is a JAX-native library providing a differentiable rasterizer for CAD Boolean operations. It translates contact dynamics formulations from differentiable physics into the CAD domain, enabling gradient-based optimization through B-Rep topology changes. BRepAX is NOT a general CAD kernel, mesh library, or physics simulator.
13
+
14
+ ## Technical Thesis
15
+
16
+ The gradient discontinuities at topological boundaries in CAD Boolean operations (where edges/faces appear or disappear) are mathematically isomorphic to contact events in differentiable physics simulation. By mapping LCP/convex/compliant/PBD contact formulations to stratum tracking / boundary smoothing / event-based correction / penalty strategies, we build a differentiable B-Rep kernel without inventing new theory.
17
+
18
+ ## Comments
19
+
20
+ Comments explain **why**, not what or how. Keep them minimal and concise.
21
+
22
+ Prohibited:
23
+
24
+ - Development stage markers: "Phase 1", "Step 2", "TODO Phase 3", "WIP", "FIXME"
25
+ - Commented-out code or debug print statements
26
+ - Restated logic ("loop through users", "compute distance")
27
+ - Personal notes: "will fix later", "temp solution"
28
+
29
+ ## Repository Conventions
30
+
31
+ - **src layout**: All library code lives under `src/brepax/`
32
+ - **Diataxis documentation**: `docs/` follows tutorials / how-to / reference / explanation separation
33
+ - **ADR pattern**: All significant architectural decisions are recorded in `docs/architecture/adr/`
34
+ - **Test-first development**: New features must include property tests and unit tests simultaneously
35
+ - **Conventional Commits**: All commit messages follow the Conventional Commits specification
36
+
37
+ ## Development Workflow
38
+
39
+ ```bash
40
+ # Install dependencies
41
+ uv sync --extra dev
42
+
43
+ # Run tests
44
+ uv run pytest
45
+
46
+ # Run linter
47
+ uv run ruff check src/ tests/
48
+
49
+ # Format code
50
+ uv run ruff format src/ tests/
51
+
52
+ # Type checking
53
+ uv run mypy src/
54
+
55
+ # Run all checks via nox
56
+ uv run nox -s test
57
+ uv run nox -s lint
58
+ uv run nox -s typecheck
59
+
60
+ # Install git hooks (lefthook, managed via mise)
61
+ lefthook install
62
+
63
+ # Build documentation
64
+ uv run mkdocs serve
65
+ ```
66
+
67
+ ### PR Checklist
68
+
69
+ 1. All tests pass (`uv run pytest`)
70
+ 2. Type checking passes (`uv run mypy src/`)
71
+ 3. Linting passes (`uv run ruff check src/ tests/`)
72
+ 4. New public API has docstrings with Examples section
73
+ 5. Commit messages follow Conventional Commits
74
+ 6. ADR added if an architectural decision was made
75
+
76
+ ## Imports
77
+
78
+ Follow PEP 8 grouping (stdlib, third-party, local). All imports at the top of the file.
79
+
80
+ Local imports are allowed only for: circular import avoidance, lazy loading of heavy dependencies,
81
+ optional dependency isolation, or plugin/backend switching. Add a comment explaining which applies.
82
+
83
+ For type hints causing circular imports, use `TYPE_CHECKING` guard with string annotations.
84
+
85
+ ## JAX-Specific Patterns
86
+
87
+ - **Base class**: All geometric types inherit from `equinox.Module`
88
+ - **Type annotations**: All public APIs use `jaxtyping` annotations (`Float[Array, "..."]`)
89
+ - **Static shapes**: JAX requires static shapes for jit. Use padding + masking for variable-size structures (see ADR-0005)
90
+ - **Transformations**: Every public function must be compatible with `jit`, `vmap`, and `grad`. Verified by integration tests in `tests/integration/`
91
+ - **Custom differentiation**: Use `jax.custom_vjp` for boundary corrections, `jax.custom_jvp` for numerical stability. Prefer implicit differentiation via `optimistix` for root-finding operations
92
+ - **Runtime type checking**: `jaxtyping` + `beartype` are enabled during tests via pytest hook
93
+
94
+ ## Scope Boundaries
95
+
96
+ Implemented:
97
+
98
+ - 8 primitives: Disk (2D), Sphere, Cylinder, Plane, Cone, Torus, Box, FiniteCylinder
99
+ - Union, intersection, and subtract Boolean operations via Method (A) smoothing and Method (C) stratum-aware
100
+ - Stratum-dispatched gradients: analytical exact in 3/4 strata for bounded pairs
101
+ - Hybrid optimizer API skeleton in `experimental/optimizers/`
102
+ - Mold direction optimizer demonstrator in `experimental/applications/`
103
+ - 2D Disk analytical ground truth + 3D Sphere analytical ground truth
104
+ - 7 example notebooks, 13 ADRs
105
+
106
+ Not yet in scope (defer to future work):
107
+
108
+ - Method (B) TOI correction implementation (deferred to hybrid optimizer context, ADR-0009)
109
+ - STEP file read / analytical primitive conversion
110
+ - Topology data structures (half-edge mesh)
111
+ - Persistent homology integration
112
+ - B-Rep bridge layer (OCP-to-JAX conversion)
113
+ - C++ extensions
114
+
115
+ If scope expansion is needed, add an ADR documenting the decision. Do not expand scope without explicit approval.
116
+
117
+ ## Things to Avoid
118
+
119
+ - **No C++ extensions** until benchmarks show a specific bottleneck (pure JAX for now)
120
+ - **No code copying** from existing OSS (JAX-FEM, Manifold, etc.) -- reference only
121
+ - **No private API exposure** -- `_internal/` must never be imported from public modules
122
+ - **No dynamic shapes** without explicit justification -- use padding strategies instead
123
+ - **No backward compatibility code** -- this project is in alpha; prefer clean breaks
124
+ - **OCCT dependency is core identity** -- do not propose removing cadquery-ocp-novtk; changes to OCCT strategy require an ADR
125
+ - **No direct OCP imports** outside `brepax/_occt/` -- all OCCT access goes through `brepax._occt.backend` (see ADR-0008)
126
+
127
+ ## Development Philosophy
128
+
129
+ - **Understand before changing**: Read existing code and docs before modifying anything.
130
+ - **Research first**: Investigate modern best practices before implementing non-trivial decisions.
131
+ - **No over-abstraction**: Three similar lines are better than a premature abstraction.
132
+ - **No hardcoding**: Magic numbers and defaults must be defined in constants or configuration.
133
+
134
+ ## Code Quality Checks (mandatory before EVERY commit and push)
135
+
136
+ **NEVER commit or push without running ALL of these checks first.**
137
+ A CI failure after push means the check was skipped locally. No exceptions.
138
+
139
+ ```bash
140
+ uv run ruff format src/ tests/
141
+ uv run ruff check src/ tests/ --fix
142
+ uv run mypy src/
143
+ uv run pytest -m "not slow"
144
+ ```
145
+
146
+ All four must pass with zero errors before `git commit`. If any fails, fix it before committing.
147
+ Do not rely on CI to catch errors -- CI is a safety net, not the primary gate.
148
+
149
+ ## Reference Materials
150
+
151
+ - JAX documentation: https://docs.jax.dev
152
+ - Equinox documentation: https://docs.kidger.site/equinox
153
+ - jaxtyping documentation: https://docs.kidger.site/jaxtyping
154
+ - Diataxis framework: https://diataxis.fr
155
+ - ADR pattern: https://github.com/joelparkerhenderson/architecture-decision-record