b123d-recognisers 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 (99) hide show
  1. b123d_recognisers-0.1.0/.github/workflows/ci.yml +35 -0
  2. b123d_recognisers-0.1.0/.github/workflows/publish.yml +121 -0
  3. b123d_recognisers-0.1.0/.gitignore +11 -0
  4. b123d_recognisers-0.1.0/CONTRIBUTING.md +25 -0
  5. b123d_recognisers-0.1.0/LICENSE +202 -0
  6. b123d_recognisers-0.1.0/NOTICE +8 -0
  7. b123d_recognisers-0.1.0/PKG-INFO +88 -0
  8. b123d_recognisers-0.1.0/README.md +61 -0
  9. b123d_recognisers-0.1.0/RELEASE_NOTES.md +28 -0
  10. b123d_recognisers-0.1.0/THIRD_PARTY_NOTICES.md +30 -0
  11. b123d_recognisers-0.1.0/docs/adr/0001-standalone-geometry-only-apache-library.md +39 -0
  12. b123d_recognisers-0.1.0/docs/adr/0002-uniform-deterministic-recogniser-contract.md +50 -0
  13. b123d_recognisers-0.1.0/docs/adr/0003-one-recognition-result-and-explicit-reconciliation.md +51 -0
  14. b123d_recognisers-0.1.0/docs/adr/0004-attributed-geometry-graph-and-residual-evidence.md +50 -0
  15. b123d_recognisers-0.1.0/docs/adr/README.md +17 -0
  16. b123d_recognisers-0.1.0/docs/releasing.md +30 -0
  17. b123d_recognisers-0.1.0/migration/PARITY.md +46 -0
  18. b123d_recognisers-0.1.0/migration/README.md +37 -0
  19. b123d_recognisers-0.1.0/migration/performance-baseline.json +26 -0
  20. b123d_recognisers-0.1.0/migration/source-baseline.json +43 -0
  21. b123d_recognisers-0.1.0/pyproject.toml +72 -0
  22. b123d_recognisers-0.1.0/src/b123d_recognisers/__init__.py +209 -0
  23. b123d_recognisers-0.1.0/src/b123d_recognisers/_features.py +1164 -0
  24. b123d_recognisers-0.1.0/src/b123d_recognisers/_geometry.py +112 -0
  25. b123d_recognisers-0.1.0/src/b123d_recognisers/_record.py +29 -0
  26. b123d_recognisers-0.1.0/src/b123d_recognisers/census.py +75 -0
  27. b123d_recognisers-0.1.0/src/b123d_recognisers/chamfers.py +198 -0
  28. b123d_recognisers-0.1.0/src/b123d_recognisers/countersinks.py +206 -0
  29. b123d_recognisers-0.1.0/src/b123d_recognisers/fillets.py +185 -0
  30. b123d_recognisers-0.1.0/src/b123d_recognisers/flats.py +277 -0
  31. b123d_recognisers-0.1.0/src/b123d_recognisers/grooves.py +147 -0
  32. b123d_recognisers-0.1.0/src/b123d_recognisers/levels.py +348 -0
  33. b123d_recognisers-0.1.0/src/b123d_recognisers/pads.py +150 -0
  34. b123d_recognisers-0.1.0/src/b123d_recognisers/plates.py +158 -0
  35. b123d_recognisers-0.1.0/src/b123d_recognisers/polygonal_bosses.py +344 -0
  36. b123d_recognisers-0.1.0/src/b123d_recognisers/profiled_bores.py +370 -0
  37. b123d_recognisers-0.1.0/src/b123d_recognisers/py.typed +1 -0
  38. b123d_recognisers-0.1.0/src/b123d_recognisers/repeating_profiles.py +395 -0
  39. b123d_recognisers-0.1.0/src/b123d_recognisers/result.py +295 -0
  40. b123d_recognisers-0.1.0/src/b123d_recognisers/slots.py +1473 -0
  41. b123d_recognisers-0.1.0/src/b123d_recognisers/turned.py +203 -0
  42. b123d_recognisers-0.1.0/tests/golden/__init__.py +1 -0
  43. b123d_recognisers-0.1.0/tests/golden/_common.py +43 -0
  44. b123d_recognisers-0.1.0/tests/golden/blind_pockets_and_pocket_patterns/expected.json +1157 -0
  45. b123d_recognisers-0.1.0/tests/golden/blind_pockets_and_pocket_patterns/fixture.py +13 -0
  46. b123d_recognisers-0.1.0/tests/golden/bolt_circle_and_rectangular_grid/expected.json +2478 -0
  47. b123d_recognisers-0.1.0/tests/golden/bolt_circle_and_rectangular_grid/fixture.py +18 -0
  48. b123d_recognisers-0.1.0/tests/golden/chamfers_fillets_and_flats/expected.json +848 -0
  49. b123d_recognisers-0.1.0/tests/golden/chamfers_fillets_and_flats/fixture.py +12 -0
  50. b123d_recognisers-0.1.0/tests/golden/counterbored_and_countersunk_holes/expected.json +661 -0
  51. b123d_recognisers-0.1.0/tests/golden/counterbored_and_countersunk_holes/fixture.py +14 -0
  52. b123d_recognisers-0.1.0/tests/golden/double_d_bore/expected.json +335 -0
  53. b123d_recognisers-0.1.0/tests/golden/double_d_bore/fixture.py +12 -0
  54. b123d_recognisers-0.1.0/tests/golden/interrupted_and_cross_bores/expected.json +499 -0
  55. b123d_recognisers-0.1.0/tests/golden/interrupted_and_cross_bores/fixture.py +9 -0
  56. b123d_recognisers-0.1.0/tests/golden/open_channels/expected.json +388 -0
  57. b123d_recognisers-0.1.0/tests/golden/open_channels/fixture.py +13 -0
  58. b123d_recognisers-0.1.0/tests/golden/plates_pads_levels_and_slanted_steps/expected.json +612 -0
  59. b123d_recognisers-0.1.0/tests/golden/plates_pads_levels_and_slanted_steps/fixture.py +13 -0
  60. b123d_recognisers-0.1.0/tests/golden/polygonal_boss/expected.json +458 -0
  61. b123d_recognisers-0.1.0/tests/golden/polygonal_boss/fixture.py +9 -0
  62. b123d_recognisers-0.1.0/tests/golden/polygonal_stock/expected.json +389 -0
  63. b123d_recognisers-0.1.0/tests/golden/polygonal_stock/fixture.py +9 -0
  64. b123d_recognisers-0.1.0/tests/golden/repeating_radial_profile/expected.json +461 -0
  65. b123d_recognisers-0.1.0/tests/golden/repeating_radial_profile/fixture.py +7 -0
  66. b123d_recognisers-0.1.0/tests/golden/simple_through_hole/expected.json +465 -0
  67. b123d_recognisers-0.1.0/tests/golden/simple_through_hole/fixture.py +9 -0
  68. b123d_recognisers-0.1.0/tests/golden/slanted_counterbore/expected.json +438 -0
  69. b123d_recognisers-0.1.0/tests/golden/slanted_counterbore/fixture.py +13 -0
  70. b123d_recognisers-0.1.0/tests/golden/slanted_steps/expected.json +599 -0
  71. b123d_recognisers-0.1.0/tests/golden/slanted_steps/fixture.py +20 -0
  72. b123d_recognisers-0.1.0/tests/golden/straight_and_obround_slots/expected.json +899 -0
  73. b123d_recognisers-0.1.0/tests/golden/straight_and_obround_slots/fixture.py +13 -0
  74. b123d_recognisers-0.1.0/tests/golden/traversal_order/expected.json +637 -0
  75. b123d_recognisers-0.1.0/tests/golden/traversal_order/fixture.py +22 -0
  76. b123d_recognisers-0.1.0/tests/golden/turned_steps_and_grooves/expected.json +717 -0
  77. b123d_recognisers-0.1.0/tests/golden/turned_steps_and_grooves/fixture.py +12 -0
  78. b123d_recognisers-0.1.0/tests/test_architecture.py +41 -0
  79. b123d_recognisers-0.1.0/tests/test_census.py +38 -0
  80. b123d_recognisers-0.1.0/tests/test_golden_data.py +91 -0
  81. b123d_recognisers-0.1.0/tests/test_golden_fixtures.py +60 -0
  82. b123d_recognisers-0.1.0/tests/test_golden_parity.py +54 -0
  83. b123d_recognisers-0.1.0/tests/test_golden_support.py +90 -0
  84. b123d_recognisers-0.1.0/tests/test_package.py +120 -0
  85. b123d_recognisers-0.1.0/tests/test_publish_workflow.py +74 -0
  86. b123d_recognisers-0.1.0/tests/test_recogniser_contract.py +396 -0
  87. b123d_recognisers-0.1.0/tests/test_recognition.py +858 -0
  88. b123d_recognisers-0.1.0/tests/test_recognition_edge_cases.py +152 -0
  89. b123d_recognisers-0.1.0/tests/test_recognition_result.py +155 -0
  90. b123d_recognisers-0.1.0/tests/test_source_baseline.py +80 -0
  91. b123d_recognisers-0.1.0/tests/test_turned_steps.py +118 -0
  92. b123d_recognisers-0.1.0/tests/test_verify_source_baseline.py +101 -0
  93. b123d_recognisers-0.1.0/tools/benchmark_recognition.py +97 -0
  94. b123d_recognisers-0.1.0/tools/capture_draftwright_goldens.py +103 -0
  95. b123d_recognisers-0.1.0/tools/golden_support.py +72 -0
  96. b123d_recognisers-0.1.0/tools/recognition_snapshot.py +70 -0
  97. b123d_recognisers-0.1.0/tools/verify_release_assets.py +92 -0
  98. b123d_recognisers-0.1.0/tools/verify_source_baseline.py +85 -0
  99. b123d_recognisers-0.1.0/uv.lock +1570 -0
@@ -0,0 +1,35 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ lint:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
15
+ - uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
16
+ with:
17
+ enable-cache: true
18
+ - run: uv sync --dev
19
+ - run: uv run ruff check .
20
+
21
+ test:
22
+ strategy:
23
+ fail-fast: false
24
+ matrix:
25
+ os: [ubuntu-latest, macos-latest, windows-latest]
26
+ python: ["3.10", "3.12", "3.14"]
27
+ runs-on: ${{ matrix.os }}
28
+ steps:
29
+ - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
30
+ - uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
31
+ with:
32
+ enable-cache: true
33
+ python-version: ${{ matrix.python }}
34
+ - run: uv sync --dev
35
+ - run: uv run pytest
@@ -0,0 +1,121 @@
1
+ name: Publish distributions
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+ inputs:
8
+ tag:
9
+ description: Existing GitHub release tag whose assets will be promoted
10
+ required: true
11
+ type: string
12
+ target:
13
+ description: Stop after TestPyPI, or promote the same artifact to both indexes
14
+ required: true
15
+ default: testpypi
16
+ type: choice
17
+ options:
18
+ - testpypi
19
+ - both
20
+
21
+ concurrency:
22
+ group: publish-${{ github.event.release.tag_name || inputs.tag }}
23
+ cancel-in-progress: false
24
+
25
+ permissions: {}
26
+
27
+ jobs:
28
+ prepare:
29
+ name: Verify GitHub release assets
30
+ runs-on: ubuntu-latest
31
+ permissions:
32
+ contents: read
33
+ env:
34
+ RELEASE_TAG: ${{ github.event.release.tag_name || inputs.tag }}
35
+ steps:
36
+ - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
37
+ with:
38
+ persist-credentials: false
39
+ - name: Validate release tag
40
+ shell: bash
41
+ run: |
42
+ if [[ ! "$RELEASE_TAG" =~ ^v[0-9][0-9A-Za-z.!+-]*$ ]]; then
43
+ echo "invalid release tag: $RELEASE_TAG" >&2
44
+ exit 1
45
+ fi
46
+ - name: Download reviewed release distributions
47
+ env:
48
+ GH_TOKEN: ${{ github.token }}
49
+ run: gh release download "$RELEASE_TAG" --pattern "*.whl" --pattern "*.tar.gz" --dir dist
50
+ - name: Verify tag and artifact identity
51
+ run: python tools/verify_release_assets.py --dist dist --tag "$RELEASE_TAG"
52
+ - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
53
+ with:
54
+ name: python-package-distributions
55
+ path: dist/
56
+ if-no-files-found: error
57
+ retention-days: 7
58
+
59
+ publish-testpypi:
60
+ name: Publish to TestPyPI
61
+ needs: prepare
62
+ runs-on: ubuntu-latest
63
+ environment:
64
+ name: testpypi
65
+ url: https://test.pypi.org/p/b123d-recognisers
66
+ permissions:
67
+ id-token: write # Trusted Publishing exchanges OIDC for a short-lived index token.
68
+ steps:
69
+ - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
70
+ with:
71
+ name: python-package-distributions
72
+ path: dist/
73
+ - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1
74
+ with:
75
+ repository-url: https://test.pypi.org/legacy/
76
+ skip-existing: true
77
+
78
+ verify-testpypi:
79
+ name: Install from TestPyPI
80
+ needs: publish-testpypi
81
+ runs-on: ubuntu-latest
82
+ env:
83
+ RELEASE_TAG: ${{ github.event.release.tag_name || inputs.tag }}
84
+ steps:
85
+ - uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
86
+ with:
87
+ enable-cache: false
88
+ ignore-empty-workdir: true
89
+ - name: Install published wheel and import public API
90
+ shell: bash
91
+ run: |
92
+ version="${RELEASE_TAG#v}"
93
+ uv venv
94
+ uv pip install "build123d>=0.9,<0.12"
95
+ for attempt in {1..12}; do
96
+ if uv pip install --no-deps --index-url https://test.pypi.org/simple/ \
97
+ "b123d-recognisers==$version"; then
98
+ break
99
+ fi
100
+ if [[ "$attempt" == 12 ]]; then exit 1; fi
101
+ sleep 10
102
+ done
103
+ uv run --no-sync python -c \
104
+ "import b123d_recognisers as r; assert r.__version__ == '$version'; assert r.recognise_holes"
105
+
106
+ publish-pypi:
107
+ name: Publish to PyPI
108
+ if: github.event_name == 'release' || inputs.target == 'both'
109
+ needs: verify-testpypi
110
+ runs-on: ubuntu-latest
111
+ environment:
112
+ name: pypi
113
+ url: https://pypi.org/p/b123d-recognisers
114
+ permissions:
115
+ id-token: write # Trusted Publishing exchanges OIDC for a short-lived index token.
116
+ steps:
117
+ - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
118
+ with:
119
+ name: python-package-distributions
120
+ path: dist/
121
+ - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1
@@ -0,0 +1,11 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .coverage
5
+ .pytest_cache/
6
+ .ruff_cache/
7
+ .venv/
8
+ build/
9
+ dist/
10
+ htmlcov/
11
+
@@ -0,0 +1,25 @@
1
+ # Contributing
2
+
3
+ Contributions are welcome. By intentionally submitting a contribution for inclusion in this
4
+ project, you agree that it is provided under the Apache License 2.0, as described by section 5 of
5
+ that licence, unless you explicitly state otherwise in writing.
6
+
7
+ ## Architectural rules
8
+
9
+ - Recognition is geometry-only: no drawing, editing-session, CAM-operation or UI policy.
10
+ - Public results are immutable, typed and serialisable without leaking build123d/OCP objects.
11
+ - A base recogniser accepts `part` first and keyword-only tuning or injected dependencies.
12
+ - A derived recogniser is a pure function over already-recognised records.
13
+ - Recognisers do not rerun sibling recognisers; orchestration computes shared evidence once.
14
+ - Empty means confidently absent within supported topology. Ambiguous and unsupported cases are
15
+ explicit diagnostics.
16
+ - Changes to a load-bearing contract require an ADR update.
17
+
18
+ ## Local checks
19
+
20
+ ```bash
21
+ uv sync --dev
22
+ uv run ruff check .
23
+ uv run pytest
24
+ ```
25
+
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,8 @@
1
+ b123d-recognisers
2
+ Copyright 2024-2026 Paul Fremantle
3
+
4
+ The initial hole, boss, cylinder and pattern recognition implementation was
5
+ derived from build123d-drafting-helpers, an Apache-2.0 project copyright
6
+ Paul Fremantle, and was subsequently developed in Draftwright. It is released
7
+ here under Apache-2.0 by the copyright owner.
8
+
@@ -0,0 +1,88 @@
1
+ Metadata-Version: 2.5
2
+ Name: b123d-recognisers
3
+ Version: 0.1.0
4
+ Summary: Deterministic, geometry-only feature recognition for build123d solids
5
+ Project-URL: Repository, https://github.com/pzfreo/b123d-recognisers
6
+ Project-URL: Issues, https://github.com/pzfreo/b123d-recognisers/issues
7
+ Author-email: Paul Fremantle <pzfreo@gmail.com>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ License-File: NOTICE
11
+ License-File: THIRD_PARTY_NOTICES.md
12
+ Keywords: brep,build123d,cad,feature-recognition,step
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Manufacturing
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Classifier: Topic :: Scientific/Engineering
24
+ Requires-Python: <3.15,>=3.10
25
+ Requires-Dist: build123d<0.12,>=0.9
26
+ Description-Content-Type: text/markdown
27
+
28
+ # b123d-recognisers
29
+
30
+ Deterministic, geometry-only feature recognition for build123d solids and imported STEP models.
31
+
32
+ This is the standalone Apache-2.0 recognition layer extracted from
33
+ [Draftwright](https://github.com/pzfreo/draftwright). It reports immutable geometric records and
34
+ does not own drawing, manufacturing, editing, or consumer-cache policy.
35
+
36
+ ## Usage
37
+
38
+ Run the complete shared recognition orchestration when a consumer needs one consistent inventory:
39
+
40
+ ```python
41
+ from b123d_recognisers import build_recognition_result
42
+
43
+ result = build_recognition_result(part)
44
+ for hole in result.holes:
45
+ print(hole.diameter, hole.depth, hole.through)
46
+ ```
47
+
48
+ Individual recognisers remain public for focused consumers. Reusable evidence is explicitly
49
+ injected so it is not rediscovered:
50
+
51
+ ```python
52
+ from b123d_recognisers import analyse_cylinders, recognise_hole_patterns, recognise_holes
53
+
54
+ cylinders = analyse_cylinders(part)
55
+ holes = recognise_holes(part, cyls=cylinders)
56
+ patterns = recognise_hole_patterns(holes)
57
+ ```
58
+
59
+ Every `recognise_*` function returns a deterministic list of frozen dataclass records. Records
60
+ provide `to_dict()` projections containing only JSON-serialisable geometry values. See
61
+ [`docs/adr/0002-uniform-deterministic-recogniser-contract.md`](docs/adr/0002-uniform-deterministic-recogniser-contract.md)
62
+ for the complete contract.
63
+
64
+ ## Migrated behavior
65
+
66
+ The initial `0.1` release series preserves the recognition behavior of Draftwright commit
67
+ `3fe20b0f71a71deced06b310943dd44cc66e355e`. The migration includes every public recogniser,
68
+ shared cylinder/level substrates, the aggregate result, and `feature_census`. There are no feature
69
+ policy changes; one previously platform-dependent numerical axis tie is normalized to the pinned
70
+ baseline result. The checked-in semantic corpus records and continuously verifies the compatibility
71
+ boundary; see [`migration/PARITY.md`](migration/PARITY.md).
72
+
73
+ The dependency direction is:
74
+
75
+ ```text
76
+ consumer → b123d-recognisers → build123d/OCP
77
+ ```
78
+
79
+ The runtime package does not import Draftwright and does not return build123d or OCP objects in
80
+ public feature records.
81
+
82
+ Maintainers: see [the release guide](docs/releasing.md) for the TestPyPI-first, OIDC-only
83
+ publication process.
84
+
85
+ ## Licence
86
+
87
+ Apache License 2.0. See [`LICENSE`](LICENSE), [`NOTICE`](NOTICE), and
88
+ [`THIRD_PARTY_NOTICES.md`](THIRD_PARTY_NOTICES.md).
@@ -0,0 +1,61 @@
1
+ # b123d-recognisers
2
+
3
+ Deterministic, geometry-only feature recognition for build123d solids and imported STEP models.
4
+
5
+ This is the standalone Apache-2.0 recognition layer extracted from
6
+ [Draftwright](https://github.com/pzfreo/draftwright). It reports immutable geometric records and
7
+ does not own drawing, manufacturing, editing, or consumer-cache policy.
8
+
9
+ ## Usage
10
+
11
+ Run the complete shared recognition orchestration when a consumer needs one consistent inventory:
12
+
13
+ ```python
14
+ from b123d_recognisers import build_recognition_result
15
+
16
+ result = build_recognition_result(part)
17
+ for hole in result.holes:
18
+ print(hole.diameter, hole.depth, hole.through)
19
+ ```
20
+
21
+ Individual recognisers remain public for focused consumers. Reusable evidence is explicitly
22
+ injected so it is not rediscovered:
23
+
24
+ ```python
25
+ from b123d_recognisers import analyse_cylinders, recognise_hole_patterns, recognise_holes
26
+
27
+ cylinders = analyse_cylinders(part)
28
+ holes = recognise_holes(part, cyls=cylinders)
29
+ patterns = recognise_hole_patterns(holes)
30
+ ```
31
+
32
+ Every `recognise_*` function returns a deterministic list of frozen dataclass records. Records
33
+ provide `to_dict()` projections containing only JSON-serialisable geometry values. See
34
+ [`docs/adr/0002-uniform-deterministic-recogniser-contract.md`](docs/adr/0002-uniform-deterministic-recogniser-contract.md)
35
+ for the complete contract.
36
+
37
+ ## Migrated behavior
38
+
39
+ The initial `0.1` release series preserves the recognition behavior of Draftwright commit
40
+ `3fe20b0f71a71deced06b310943dd44cc66e355e`. The migration includes every public recogniser,
41
+ shared cylinder/level substrates, the aggregate result, and `feature_census`. There are no feature
42
+ policy changes; one previously platform-dependent numerical axis tie is normalized to the pinned
43
+ baseline result. The checked-in semantic corpus records and continuously verifies the compatibility
44
+ boundary; see [`migration/PARITY.md`](migration/PARITY.md).
45
+
46
+ The dependency direction is:
47
+
48
+ ```text
49
+ consumer → b123d-recognisers → build123d/OCP
50
+ ```
51
+
52
+ The runtime package does not import Draftwright and does not return build123d or OCP objects in
53
+ public feature records.
54
+
55
+ Maintainers: see [the release guide](docs/releasing.md) for the TestPyPI-first, OIDC-only
56
+ publication process.
57
+
58
+ ## Licence
59
+
60
+ Apache License 2.0. See [`LICENSE`](LICENSE), [`NOTICE`](NOTICE), and
61
+ [`THIRD_PARTY_NOTICES.md`](THIRD_PARTY_NOTICES.md).
@@ -0,0 +1,28 @@
1
+ # Release notes
2
+
3
+ ## 0.1.0
4
+
5
+ First stable release of the standalone Apache-2.0 recognition package.
6
+
7
+ - Promotes `0.1.0a1` after the packaged cutover merged in Draftwright PR #1168
8
+ (`d659e7a6`), with the duplicate embedded recogniser implementation removed.
9
+ - Retains the 17 pinned semantic golden fixtures, public-inventory/serialization contracts, and
10
+ cross-platform Python 3.10/3.12/3.14 matrix; this release contains no new recognition behaviour.
11
+ - Uses the reviewed TestPyPI-first Trusted Publishing path to promote one exact wheel and sdist
12
+ to PyPI without rebuilding between indexes.
13
+
14
+ The complete migration, provenance, and performance evidence remains in
15
+ [`migration/PARITY.md`](migration/PARITY.md).
16
+
17
+ ## 0.1.0a1
18
+
19
+ First prerelease of the standalone Apache-2.0 recognition package extracted from Draftwright.
20
+
21
+ - Includes every recogniser, shared geometry substrate, aggregate result, and feature census from
22
+ Draftwright commit `3fe20b0f71a71deced06b310943dd44cc66e355e`.
23
+ - Matches all 17 pinned semantic golden fixtures and preserves the ADR 0002 public contract.
24
+ - Normalizes an exact dominant-axis numerical tie to the pinned result across Windows, macOS, and
25
+ Linux; no feature-policy changes are included.
26
+ - Ships typed Python sources plus `LICENSE`, `NOTICE`, and `THIRD_PARTY_NOTICES.md`.
27
+
28
+ The complete migration and performance evidence is in [`migration/PARITY.md`](migration/PARITY.md).
@@ -0,0 +1,30 @@
1
+ # Third-party notices
2
+
3
+ `b123d-recognisers` declares build123d as a runtime dependency; it does not vendor or redistribute
4
+ the dependency source or native binaries in its wheel.
5
+
6
+ ## build123d
7
+
8
+ - Project: <https://github.com/gumyr/build123d>
9
+ - Licence: Apache-2.0
10
+ - Copyright: the build123d contributors
11
+
12
+ build123d was originally derived from portions of CadQuery. Its distribution includes the
13
+ applicable Apache-2.0 notice.
14
+
15
+ ## CadQuery OCP bindings
16
+
17
+ - Project: <https://github.com/CadQuery/OCP>
18
+ - Licence: Apache-2.0
19
+
20
+ build123d uses the CadQuery OCP Python bindings to access Open CASCADE Technology.
21
+
22
+ ## Open CASCADE Technology
23
+
24
+ - Project: <https://github.com/Open-Cascade-SAS/OCCT>
25
+ - Licence: GNU LGPL version 2.1 with the Open CASCADE additional exception
26
+
27
+ OCCT remains under its own licence. Nothing in the Apache-2.0 licence for this project changes
28
+ the licence or redistribution conditions of OCCT or any other dependency. A distributor that
29
+ bundles dependency binaries must review and satisfy the corresponding binary-distribution terms.
30
+
@@ -0,0 +1,39 @@
1
+ # ADR 0001 — Standalone geometry-only Apache library
2
+
3
+ - **Status:** Accepted
4
+ - **Date:** 2026-08-15
5
+ - **Decider:** Paul Fremantle
6
+
7
+ ## Context
8
+
9
+ Draftwright and build123d-mcp both need to recover feature measurements from imported or otherwise
10
+ unattributed B-rep solids. Draftwright previously owned recognition to avoid coupling recognition
11
+ changes to its rendering dependency, but recognition itself is not drawing-specific. Keeping a
12
+ copy in each consumer causes algorithm and bug-fix drift.
13
+
14
+ Draftwright's ADRs 0007 and 0013 already selected a standalone package named
15
+ `b123d-recognisers`; the earlier deployment gate was organizational rather than architectural.
16
+ The copyright owner has now chosen to establish that package.
17
+
18
+ ## Decision
19
+
20
+ Create distribution `b123d-recognisers`, imported as `b123d_recognisers`, under Apache-2.0.
21
+
22
+ The library accepts build123d shapes, using OCP internally where necessary, and returns geometric
23
+ records, measurables, evidence and recognition diagnostics. It does not own:
24
+
25
+ - drawing requirements, dimensions, callouts, views, placement or lint severity;
26
+ - editing-session state, reconstruction commands or CAM operation selection;
27
+ - consumer caches tied to a drawing, document or server lifecycle.
28
+
29
+ Consumers adapt records into their own domain IR. The dependency direction is always
30
+ `consumer → b123d-recognisers → build123d/OCP`.
31
+
32
+ ## Consequences
33
+
34
+ - Recognition algorithms can be reused by Apache, proprietary and copyleft consumers.
35
+ - Cross-repository releases become necessary, so the public surface must remain small and stable.
36
+ - Draftwright's `RecognitionCache` stays in Draftwright because it implements build/lint lifecycle
37
+ policy; only immutable recognition values cross the boundary.
38
+ - Existing recognition code is deliberately relicensed during migration by its copyright owner.
39
+