morphtree 2.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 (149) hide show
  1. morphtree-2.1.0/.gitattributes +4 -0
  2. morphtree-2.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +50 -0
  3. morphtree-2.1.0/.github/ISSUE_TEMPLATE/feature_request.yml +31 -0
  4. morphtree-2.1.0/.github/PULL_REQUEST_TEMPLATE.md +21 -0
  5. morphtree-2.1.0/.github/workflows/publish-pypi.yml +198 -0
  6. morphtree-2.1.0/.github/workflows/publish.yml +195 -0
  7. morphtree-2.1.0/.github/workflows/test.yml +86 -0
  8. morphtree-2.1.0/.gitignore +10 -0
  9. morphtree-2.1.0/AGENTS.md +11 -0
  10. morphtree-2.1.0/BENCHMARKS.md +17 -0
  11. morphtree-2.1.0/CHANGELOG.md +131 -0
  12. morphtree-2.1.0/CODE_OF_CONDUCT.md +14 -0
  13. morphtree-2.1.0/CONTRIBUTING.md +9 -0
  14. morphtree-2.1.0/DEPENDENCIES.md +15 -0
  15. morphtree-2.1.0/LICENSE +21 -0
  16. morphtree-2.1.0/PKG-INFO +212 -0
  17. morphtree-2.1.0/PUBLISHING.md +152 -0
  18. morphtree-2.1.0/README.md +199 -0
  19. morphtree-2.1.0/RELEASE_CHECKLIST.md +25 -0
  20. morphtree-2.1.0/ROADMAP.md +7 -0
  21. morphtree-2.1.0/SECURITY.md +24 -0
  22. morphtree-2.1.0/SOURCE_MANIFEST.json +152 -0
  23. morphtree-2.1.0/VERSIONING.md +21 -0
  24. morphtree-2.1.0/docs/API.md +120 -0
  25. morphtree-2.1.0/docs/API_REFERENCE_1_0.md +30 -0
  26. morphtree-2.1.0/docs/ARCHITECTURE.md +67 -0
  27. morphtree-2.1.0/docs/ARCHITECTURE_1_0.md +58 -0
  28. morphtree-2.1.0/docs/CAPACITY.md +59 -0
  29. morphtree-2.1.0/docs/COMPARISON.md +17 -0
  30. morphtree-2.1.0/docs/INSTALLATION.md +102 -0
  31. morphtree-2.1.0/docs/LINUX_WHEEL_AUDIT.json +17 -0
  32. morphtree-2.1.0/docs/LOCAL_HANDOFF.md +35 -0
  33. morphtree-2.1.0/docs/MIGRATION.md +16 -0
  34. morphtree-2.1.0/docs/NATIVE_MEASUREMENTS.json +692 -0
  35. morphtree-2.1.0/docs/PUBLIC_API_LIMITS.md +54 -0
  36. morphtree-2.1.0/docs/PYPI_PUBLISHING.md +151 -0
  37. morphtree-2.1.0/docs/PYPI_RUNTIME_REFERENCE.json +99 -0
  38. morphtree-2.1.0/docs/QUALIFICATION.md +136 -0
  39. morphtree-2.1.0/docs/RC_TRAINING_SUMMARY.json +269 -0
  40. morphtree-2.1.0/docs/README_REVIEW.md +57 -0
  41. morphtree-2.1.0/docs/RELEASE_STATUS.json +51 -0
  42. morphtree-2.1.0/docs/Relazione_MorphTree.txt +1079 -0
  43. morphtree-2.1.0/docs/TRAINING_SUMMARY210.json +278 -0
  44. morphtree-2.1.0/examples/binary.py +6 -0
  45. morphtree-2.1.0/examples/capacity8.py +22 -0
  46. morphtree-2.1.0/examples/minimal.ipynb +71 -0
  47. morphtree-2.1.0/examples/multiclass.py +6 -0
  48. morphtree-2.1.0/examples/regression.py +6 -0
  49. morphtree-2.1.0/examples/scalable_notebook.ipynb +84 -0
  50. morphtree-2.1.0/examples/scalable_workflow.py +35 -0
  51. morphtree-2.1.0/hatch_build.py +19 -0
  52. morphtree-2.1.0/pyproject.toml +34 -0
  53. morphtree-2.1.0/python/SOURCE_MANIFEST.json +87 -0
  54. morphtree-2.1.0/python/morphtree/__init__.py +28 -0
  55. morphtree-2.1.0/python/morphtree/__main__.py +3 -0
  56. morphtree-2.1.0/python/morphtree/_experimental/__init__.py +1 -0
  57. morphtree-2.1.0/python/morphtree/_experimental/admission.py +364 -0
  58. morphtree-2.1.0/python/morphtree/_experimental/base.py +215 -0
  59. morphtree-2.1.0/python/morphtree/_experimental/component_cache_v2.py +263 -0
  60. morphtree-2.1.0/python/morphtree/_experimental/evolution_report.py +307 -0
  61. morphtree-2.1.0/python/morphtree/_experimental/execution_v2.py +697 -0
  62. morphtree-2.1.0/python/morphtree/_experimental/facade.py +289 -0
  63. morphtree-2.1.0/python/morphtree/_experimental/integrated.py +748 -0
  64. morphtree-2.1.0/python/morphtree/_experimental/learning.py +418 -0
  65. morphtree-2.1.0/python/morphtree/_experimental/manifest.json +203 -0
  66. morphtree-2.1.0/python/morphtree/_experimental/numeric_fixture.py +21 -0
  67. morphtree-2.1.0/python/morphtree/_experimental/parameter_contract.py +38 -0
  68. morphtree-2.1.0/python/morphtree/_experimental/postfit.py +51 -0
  69. morphtree-2.1.0/python/morphtree/_experimental/preprocessing.py +133 -0
  70. morphtree-2.1.0/python/morphtree/_experimental/processes.py +191 -0
  71. morphtree-2.1.0/python/morphtree/_experimental/producer.py +542 -0
  72. morphtree-2.1.0/python/morphtree/_experimental/product.py +156 -0
  73. morphtree-2.1.0/python/morphtree/_experimental/product_cli.py +43 -0
  74. morphtree-2.1.0/python/morphtree/_experimental/roundtrip_v3.py +311 -0
  75. morphtree-2.1.0/python/morphtree/_experimental/runtime_io.py +65 -0
  76. morphtree-2.1.0/python/morphtree/_experimental/sampling.py +26 -0
  77. morphtree-2.1.0/python/morphtree/_experimental/support.py +281 -0
  78. morphtree-2.1.0/python/morphtree/_experimental/target.py +59 -0
  79. morphtree-2.1.0/python/morphtree/_experimental/training.py +53 -0
  80. morphtree-2.1.0/python/morphtree/_experimental/worker.py +682 -0
  81. morphtree-2.1.0/python/morphtree/_installed.py +17 -0
  82. morphtree-2.1.0/python/morphtree/_native/__init__.py +1 -0
  83. morphtree-2.1.0/python/morphtree/_native/buffers.py +82 -0
  84. morphtree-2.1.0/python/morphtree/_native/loader.py +39 -0
  85. morphtree-2.1.0/python/morphtree/_native/manifest.json +29 -0
  86. morphtree-2.1.0/python/morphtree/_native/runtime.py +48 -0
  87. morphtree-2.1.0/python/morphtree/_native/src/histogram.c +61 -0
  88. morphtree-2.1.0/python/morphtree/_native/src/traversal.c +51 -0
  89. morphtree-2.1.0/python/morphtree/api.py +388 -0
  90. morphtree-2.1.0/python/morphtree/api_compat.py +65 -0
  91. morphtree-2.1.0/python/morphtree/backend.py +162 -0
  92. morphtree-2.1.0/python/morphtree/booster.py +252 -0
  93. morphtree-2.1.0/python/morphtree/cli.py +52 -0
  94. morphtree-2.1.0/python/morphtree/config.py +262 -0
  95. morphtree-2.1.0/python/morphtree/control.py +20 -0
  96. morphtree-2.1.0/python/morphtree/data.py +300 -0
  97. morphtree-2.1.0/python/morphtree/diagnostics.py +158 -0
  98. morphtree-2.1.0/python/morphtree/estimators.py +156 -0
  99. morphtree-2.1.0/python/morphtree/examples.py +25 -0
  100. morphtree-2.1.0/python/morphtree/exporting.py +224 -0
  101. morphtree-2.1.0/python/morphtree/legacy_artifacts.py +32 -0
  102. morphtree-2.1.0/python/morphtree/metrics.py +156 -0
  103. morphtree-2.1.0/python/morphtree/model.py +1010 -0
  104. morphtree-2.1.0/python/morphtree/mutations.py +205 -0
  105. morphtree-2.1.0/python/morphtree/native_lab_backend.py +79 -0
  106. morphtree-2.1.0/python/morphtree/numpy_backend.py +180 -0
  107. morphtree-2.1.0/python/morphtree/optuna_tuner.py +154 -0
  108. morphtree-2.1.0/python/morphtree/persistence.py +414 -0
  109. morphtree-2.1.0/python/morphtree/prediction_output.py +35 -0
  110. morphtree-2.1.0/python/morphtree/prepared_bins.py +82 -0
  111. morphtree-2.1.0/python/morphtree/public.py +106 -0
  112. morphtree-2.1.0/python/morphtree/resource_plan.py +170 -0
  113. morphtree-2.1.0/python/morphtree/scalable.py +781 -0
  114. morphtree-2.1.0/python/morphtree/scalable_backend.py +74 -0
  115. morphtree-2.1.0/python/morphtree/scalable_checkpoint.py +129 -0
  116. morphtree-2.1.0/python/morphtree/scalable_data.py +255 -0
  117. morphtree-2.1.0/python/morphtree/scalable_receipts.py +92 -0
  118. morphtree-2.1.0/python/morphtree/scalable_target.py +68 -0
  119. morphtree-2.1.0/python/morphtree/scalable_variants.py +133 -0
  120. morphtree-2.1.0/python/morphtree/sklearn_view.py +79 -0
  121. morphtree-2.1.0/python/morphtree/source_markers.py +25 -0
  122. morphtree-2.1.0/python/morphtree/species.py +47 -0
  123. morphtree-2.1.0/python/morphtree/temporary.py +65 -0
  124. morphtree-2.1.0/python/morphtree/training_fragment.py +130 -0
  125. morphtree-2.1.0/python/morphtree/tree.py +231 -0
  126. morphtree-2.1.0/python/morphtree/tuning.py +150 -0
  127. morphtree-2.1.0/python/tests/product/test_compatibility.py +51 -0
  128. morphtree-2.1.0/python/tests/product/test_objective_math.py +77 -0
  129. morphtree-2.1.0/python/tests/product/test_scalable_product.py +105 -0
  130. morphtree-2.1.0/python/tests/product/test_split_kernel.py +58 -0
  131. morphtree-2.1.0/research/README.md +1 -0
  132. morphtree-2.1.0/tests/test_integrated_native.py +103 -0
  133. morphtree-2.1.0/tests/test_native_pinning.py +156 -0
  134. morphtree-2.1.0/tests/test_prediction_arrays.py +88 -0
  135. morphtree-2.1.0/tests/test_public_admission.py +37 -0
  136. morphtree-2.1.0/tests/test_public_description.py +23 -0
  137. morphtree-2.1.0/tests/test_release_metadata.py +46 -0
  138. morphtree-2.1.0/tests/test_threads.py +21 -0
  139. morphtree-2.1.0/tools/audit_linux_wheel.py +44 -0
  140. morphtree-2.1.0/tools/build_artifacts.py +35 -0
  141. morphtree-2.1.0/tools/build_native.py +71 -0
  142. morphtree-2.1.0/tools/check_distribution.py +45 -0
  143. morphtree-2.1.0/tools/check_installed.py +52 -0
  144. morphtree-2.1.0/tools/check_repository.py +23 -0
  145. morphtree-2.1.0/tools/publish_pypi_reviewed.py +103 -0
  146. morphtree-2.1.0/tools/publish_reviewed.py +179 -0
  147. morphtree-2.1.0/tools/tests/test_publishing.py +223 -0
  148. morphtree-2.1.0/tools/tests/test_pypi_publication.py +144 -0
  149. morphtree-2.1.0/tools/write_build_provenance.py +22 -0
@@ -0,0 +1,4 @@
1
+ # Preserve the exact qualified snapshot,including historical research hashes.
2
+ # No automatic LF/CRLF conversion during a future Git add/checkout.
3
+ # New source should use LF deliberately;review/update manifests after edits.
4
+ * -text
@@ -0,0 +1,50 @@
1
+ name: Bug report
2
+ description: Report a reproducible MorphTree issue.
3
+ title: "[Bug]: "
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: >-
8
+ Use invented or public data only. Remove credentials, usernames and
9
+ private file paths from tracebacks. Report security issues privately
10
+ using the guidance in SECURITY.md rather than a public issue.
11
+ - type: input
12
+ id: version
13
+ attributes:
14
+ label: MorphTree version
15
+ placeholder: "2.1.0"
16
+ validations:
17
+ required: true
18
+ - type: textarea
19
+ id: environment
20
+ attributes:
21
+ label: Environment
22
+ description: Python version, Windows/Linux variant, architecture, and installation type (wheel or sdist). No local identifiers.
23
+ validations:
24
+ required: true
25
+ - type: textarea
26
+ id: reproduction
27
+ attributes:
28
+ label: Minimal synthetic reproduction
29
+ description: Include imports, sample rows, labels, random_state and estimator settings. Keep it small; do not upload private models.
30
+ validations:
31
+ required: true
32
+ - type: textarea
33
+ id: traceback
34
+ attributes:
35
+ label: Error or diagnostic output (redacted)
36
+ description: Include a traceback if there is one, or write "No exception".
37
+ validations:
38
+ required: true
39
+ - type: textarea
40
+ id: expected
41
+ attributes:
42
+ label: Expected behavior
43
+ validations:
44
+ required: true
45
+ - type: textarea
46
+ id: actual
47
+ attributes:
48
+ label: Actual behavior
49
+ validations:
50
+ required: true
@@ -0,0 +1,31 @@
1
+ name: Feature request
2
+ description: Suggest an API, usability, or research improvement.
3
+ title: "[Feature]: "
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: >-
8
+ Do not share private datasets, credentials, paths, or unpublished
9
+ research evidence. Structural learning changes require a separate,
10
+ preregistered experimental protocol and maintainer approval.
11
+ - type: textarea
12
+ id: problem
13
+ attributes:
14
+ label: Problem and use case
15
+ validations:
16
+ required: true
17
+ - type: textarea
18
+ id: proposal
19
+ attributes:
20
+ label: Suggested change
21
+ validations:
22
+ required: true
23
+ - type: textarea
24
+ id: compatibility
25
+ attributes:
26
+ label: Public API, persistence and evolution impact
27
+ - type: textarea
28
+ id: evidence
29
+ attributes:
30
+ label: Reproduction or proposed evaluation
31
+ description: Comparisons should include the static-parent control where relevant; do not claim unmeasured improvements.
@@ -0,0 +1,21 @@
1
+ ## Change summary
2
+
3
+ Explain the problem and the smallest justified correction.
4
+
5
+ ## Compatibility and scientific behavior
6
+
7
+ Describe effects on public API, saved models, learning program, structural mutation
8
+ history, acceptance/rollback, numerical outcomes, native ABI, dependencies and
9
+ supported platforms. Write "none" where applicable.
10
+
11
+ ## Verification
12
+
13
+ - [ ] `python -I -B tools/check_repository.py` passes **after regenerating the inventory** for this reviewed change.
14
+ - [ ] Relevant zero-fit tests and repeat-run tests pass.
15
+ - [ ] Native changes include bounds/ABI tests and appropriate build evidence.
16
+ - [ ] Algorithm or performance changes include a preregistered comparison, budget and maintainer approval before LIVE fits.
17
+ - [ ] User-visible changes update README, CHANGELOG and API/qualification docs as necessary.
18
+ - [ ] No credentials, personal paths, private results, `.git`, compiled scratch files or datasets are included.
19
+ - [ ] Wheel/sdist and installed-package qualification are repeated when release content changes.
20
+
21
+ Git history, merges, versioning and all publication actions remain owner-controlled.
@@ -0,0 +1,198 @@
1
+ name: MorphTree official PyPI - reviewed OIDC publication
2
+ on:
3
+ workflow_dispatch:
4
+ inputs:
5
+ expected_version:
6
+ description: Approved version (2.1.0 only)
7
+ required: true
8
+ default: '2.1.0'
9
+ type: string
10
+ reviewed_commit:
11
+ description: Full SHA of this exact main-branch commit and its successful CI run
12
+ required: true
13
+ type: string
14
+ reviewed_build_run:
15
+ description: Successful manual test.yml run ID from that commit
16
+ required: true
17
+ type: string
18
+ reviewed_build_attempt:
19
+ description: Reviewed CI run attempt (use a fresh complete run)
20
+ required: true
21
+ default: '1'
22
+ type: string
23
+ windows_manifest_sha256:
24
+ description: Owner-reviewed SHA-256 of Windows 3.12 BUILD_PROVENANCE.json
25
+ required: true
26
+ type: string
27
+ linux_manifest_sha256:
28
+ description: Owner-reviewed SHA-256 of Linux 3.12 BUILD_PROVENANCE.json
29
+ required: true
30
+ type: string
31
+ publish_pypi:
32
+ description: Explicitly request upload AFTER preflight and environment approval
33
+ required: true
34
+ default: false
35
+ type: boolean
36
+ approval:
37
+ description: For upload enter exactly PUBLISH morphtree 2.1.0 TO PYPI
38
+ required: false
39
+ default: ''
40
+ type: string
41
+ permissions:
42
+ contents: read
43
+ concurrency:
44
+ group: morphtree-pypi-2.1.0
45
+ cancel-in-progress: false
46
+ env:
47
+ PYTHONDONTWRITEBYTECODE: '1'
48
+ jobs:
49
+ preflight:
50
+ if: ${{ github.repository == 'lucalullo/morph-tree' && github.ref == 'refs/heads/main' }}
51
+ runs-on: ubuntu-24.04
52
+ timeout-minutes: 10
53
+ permissions:
54
+ contents: read
55
+ actions: read
56
+ outputs:
57
+ bundle_manifest_sha256: ${{ steps.review.outputs.bundle_manifest_sha256 }}
58
+ steps:
59
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
60
+ with:
61
+ ref: ${{ github.sha }}
62
+ persist-credentials: false
63
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
64
+ with:
65
+ python-version: '3.12'
66
+ - name: Validate explicit intent
67
+ env:
68
+ REQUESTED: ${{ inputs.publish_pypi }}
69
+ APPROVAL: ${{ inputs.approval }}
70
+ shell: python
71
+ run: |
72
+ import os
73
+ assert os.environ['REQUESTED'] == 'false' or os.environ['APPROVAL'] == 'PUBLISH morphtree 2.1.0 TO PYPI'
74
+ - run: python -I -B tools/check_repository.py
75
+ - name: Verify CI commit, six jobs, artifacts and environment protection
76
+ env:
77
+ GH_TOKEN: ${{ github.token }}
78
+ VERSION: ${{ inputs.expected_version }}
79
+ COMMIT: ${{ inputs.reviewed_commit }}
80
+ BUILD_RUN: ${{ inputs.reviewed_build_run }}
81
+ BUILD_ATTEMPT: ${{ inputs.reviewed_build_attempt }}
82
+ shell: python
83
+ run: |
84
+ import os, subprocess, sys
85
+ subprocess.run([sys.executable, '-I', '-B', 'tools/publish_pypi_reviewed.py',
86
+ '--stage', 'origin', '--expected-version', os.environ['VERSION'],
87
+ '--reviewed-commit', os.environ['COMMIT'], '--build-run', os.environ['BUILD_RUN'],
88
+ '--build-attempt', os.environ['BUILD_ATTEMPT'], '--output', 'review-origin.json'], check=True)
89
+ - uses: actions/download-artifact@v4
90
+ with:
91
+ name: morphtree-windows-latest-3.12
92
+ run-id: ${{ inputs.reviewed_build_run }}
93
+ github-token: ${{ github.token }}
94
+ path: downloaded/windows
95
+ - uses: actions/download-artifact@v4
96
+ with:
97
+ name: morphtree-ubuntu-24.04-3.12
98
+ run-id: ${{ inputs.reviewed_build_run }}
99
+ github-token: ${{ github.token }}
100
+ path: downloaded/linux
101
+ - name: Install metadata validator only
102
+ run: python -m pip --isolated install twine==6.2.0
103
+ - name: Verify approved hashes, source, metadata and PyPI availability
104
+ id: review
105
+ env:
106
+ VERSION: ${{ inputs.expected_version }}
107
+ COMMIT: ${{ inputs.reviewed_commit }}
108
+ BUILD_RUN: ${{ inputs.reviewed_build_run }}
109
+ BUILD_ATTEMPT: ${{ inputs.reviewed_build_attempt }}
110
+ WINDOWS_SHA: ${{ inputs.windows_manifest_sha256 }}
111
+ LINUX_SHA: ${{ inputs.linux_manifest_sha256 }}
112
+ shell: python
113
+ run: |
114
+ import os, subprocess, sys
115
+ subprocess.run([sys.executable, '-I', '-B', 'tools/publish_pypi_reviewed.py',
116
+ '--stage', 'preflight', '--expected-version', os.environ['VERSION'],
117
+ '--reviewed-commit', os.environ['COMMIT'], '--build-run', os.environ['BUILD_RUN'],
118
+ '--build-attempt', os.environ['BUILD_ATTEMPT'], '--origin', 'review-origin.json',
119
+ '--windows', 'downloaded/windows', '--linux', 'downloaded/linux',
120
+ '--windows-manifest-sha256', os.environ['WINDOWS_SHA'],
121
+ '--linux-manifest-sha256', os.environ['LINUX_SHA'], '--output', 'approved-bundle'], check=True)
122
+ - name: Preserve verified bytes for the isolated publication job
123
+ uses: actions/upload-artifact@v4
124
+ with:
125
+ name: pypi-approved-${{ github.run_id }}-${{ github.run_attempt }}
126
+ path: approved-bundle/
127
+ if-no-files-found: error
128
+ retention-days: 7
129
+ publish-pypi:
130
+ needs: preflight
131
+ if: ${{ inputs.publish_pypi && inputs.approval == 'PUBLISH morphtree 2.1.0 TO PYPI' && needs.preflight.result == 'success' }}
132
+ runs-on: ubuntu-24.04
133
+ timeout-minutes: 10
134
+ environment:
135
+ name: pypi
136
+ url: https://pypi.org/project/morphtree/
137
+ permissions:
138
+ contents: read
139
+ id-token: write
140
+ steps:
141
+ - uses: actions/download-artifact@v4
142
+ with:
143
+ name: pypi-approved-${{ github.run_id }}-${{ github.run_attempt }}
144
+ path: reviewed
145
+ # No checkout, repository code, build or package installation in this OIDC job.
146
+ - name: Recheck exact bundle and index immediately before OIDC upload
147
+ env:
148
+ APPROVED_MANIFEST_SHA256: ${{ needs.preflight.outputs.bundle_manifest_sha256 }}
149
+ REVIEWED_COMMIT: ${{ inputs.reviewed_commit }}
150
+ REVIEWED_RUN: ${{ inputs.reviewed_build_run }}
151
+ REVIEWED_ATTEMPT: ${{ inputs.reviewed_build_attempt }}
152
+ REQUESTED: ${{ inputs.publish_pypi }}
153
+ APPROVAL: ${{ inputs.approval }}
154
+ shell: python
155
+ run: |
156
+ import hashlib, json, os, pathlib, re, urllib.error, urllib.request
157
+ def require(condition, message):
158
+ if not condition: raise RuntimeError(message)
159
+ require(os.environ['REQUESTED'] == 'true' and os.environ['APPROVAL'] == 'PUBLISH morphtree 2.1.0 TO PYPI', 'Explicit upload approval missing')
160
+ path = pathlib.Path('reviewed/APPROVED.json')
161
+ require(path.is_file() and not path.is_symlink(), 'Missing or unsafe approval receipt')
162
+ require(re.fullmatch('[0-9a-f]{64}', os.environ['APPROVED_MANIFEST_SHA256']), 'Invalid approval SHA-256')
163
+ require(hashlib.sha256(path.read_bytes()).hexdigest() == os.environ['APPROVED_MANIFEST_SHA256'], 'Approval receipt hash mismatch')
164
+ value = json.loads(path.read_text('utf8'))
165
+ require(value['schema'] == 'MORPHTREE_PYPI_APPROVAL_1', 'Wrong receipt schema')
166
+ require(value['repository'] == os.environ['GITHUB_REPOSITORY'] == 'lucalullo/morph-tree', 'Wrong repository')
167
+ require(re.fullmatch('[0-9a-f]{40}', value['commit']) and value['commit'] == os.environ['GITHUB_SHA'] == os.environ['REVIEWED_COMMIT'], 'Wrong commit')
168
+ require(str(value['build_run_id']) == os.environ['REVIEWED_RUN'] and str(value['build_run_attempt']) == os.environ['REVIEWED_ATTEMPT'], 'Wrong reviewed CI run or attempt')
169
+ require(value['target'] == 'pypi' and value['version'] == '2.1.0', 'Only PyPI version 2.1.0 allowed')
170
+ require(value['repository_url'] == 'https://upload.pypi.org/legacy/', 'Wrong official PyPI endpoint')
171
+ require(value.get('testpypi_release_verified') is True, 'TestPyPI release evidence missing')
172
+ require(value.get('publication_workflow') == '.github/workflows/publish-pypi.yml', 'Wrong publication workflow')
173
+ require(os.environ['GITHUB_WORKFLOW_REF'] == 'lucalullo/morph-tree/.github/workflows/publish-pypi.yml@refs/heads/main' and os.environ['GITHUB_REF'] == 'refs/heads/main' and os.environ['GITHUB_EVENT_NAME'] == 'workflow_dispatch', 'Dedicated manual main-branch workflow required')
174
+ root = pathlib.Path('reviewed/packages')
175
+ require(root.is_dir() and not root.is_symlink(), 'Unsafe package directory')
176
+ require({p.name for p in root.iterdir()} == set(value['files']) and len(value['files']) == 3, 'Unexpected package membership')
177
+ require(sum(name.endswith('.whl') for name in value['files']) == 2 and 'morphtree-2.1.0.tar.gz' in value['files'], 'Expected two wheels and one source archive')
178
+ for name, pin in value['files'].items():
179
+ require(pathlib.Path(name).name == name and '\\' not in name, 'Unsafe filename')
180
+ artifact = root / name
181
+ require(artifact.is_file() and not artifact.is_symlink(), 'Missing or unsafe package')
182
+ require(hashlib.sha256(artifact.read_bytes()).hexdigest() == pin, 'Package hash mismatch')
183
+ class NoRedirect(urllib.request.HTTPRedirectHandler):
184
+ def redirect_request(self, *args, **kwargs):
185
+ raise RuntimeError('Unexpected index redirect')
186
+ try:
187
+ urllib.request.build_opener(NoRedirect).open('https://pypi.org/pypi/morphtree/2.1.0/json', timeout=20).close()
188
+ except urllib.error.HTTPError as error:
189
+ require(error.code == 404, 'Index availability not verified')
190
+ else:
191
+ raise RuntimeError('Version already present on PyPI; no retry or overwrite')
192
+ - name: Publish approved artifacts to PyPI using OIDC
193
+ uses: pypa/gh-action-pypi-publish@release/v1
194
+ with:
195
+ repository-url: https://upload.pypi.org/legacy/
196
+ packages-dir: reviewed/packages/
197
+ skip-existing: false
198
+ attestations: true
@@ -0,0 +1,195 @@
1
+ name: MorphTree TestPyPI - reviewed OIDC publication
2
+ on:
3
+ workflow_dispatch:
4
+ inputs:
5
+ expected_version:
6
+ description: Approved version (2.1.0 only)
7
+ required: true
8
+ default: '2.1.0'
9
+ type: string
10
+ reviewed_commit:
11
+ description: Full SHA of this exact main-branch commit and its successful CI run
12
+ required: true
13
+ type: string
14
+ reviewed_build_run:
15
+ description: Successful manual test.yml run ID from that commit
16
+ required: true
17
+ type: string
18
+ reviewed_build_attempt:
19
+ description: Reviewed CI run attempt (use a fresh complete run)
20
+ required: true
21
+ default: '1'
22
+ type: string
23
+ windows_manifest_sha256:
24
+ description: Owner-reviewed SHA-256 of Windows 3.12 BUILD_PROVENANCE.json
25
+ required: true
26
+ type: string
27
+ linux_manifest_sha256:
28
+ description: Owner-reviewed SHA-256 of Linux 3.12 BUILD_PROVENANCE.json
29
+ required: true
30
+ type: string
31
+ publish_testpypi:
32
+ description: Explicitly request upload AFTER preflight and environment approval
33
+ required: true
34
+ default: false
35
+ type: boolean
36
+ approval:
37
+ description: For upload enter exactly PUBLISH morphtree 2.1.0 TO TESTPYPI
38
+ required: false
39
+ default: ''
40
+ type: string
41
+ permissions:
42
+ contents: read
43
+ concurrency:
44
+ group: morphtree-testpypi-2.1.0
45
+ cancel-in-progress: false
46
+ env:
47
+ PYTHONDONTWRITEBYTECODE: '1'
48
+ jobs:
49
+ preflight:
50
+ if: ${{ github.repository == 'lucalullo/morph-tree' && github.ref == 'refs/heads/main' }}
51
+ runs-on: ubuntu-24.04
52
+ timeout-minutes: 10
53
+ permissions:
54
+ contents: read
55
+ actions: read
56
+ outputs:
57
+ bundle_manifest_sha256: ${{ steps.review.outputs.bundle_manifest_sha256 }}
58
+ steps:
59
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
60
+ with:
61
+ ref: ${{ github.sha }}
62
+ persist-credentials: false
63
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
64
+ with:
65
+ python-version: '3.12'
66
+ - name: Validate explicit intent
67
+ env:
68
+ REQUESTED: ${{ inputs.publish_testpypi }}
69
+ APPROVAL: ${{ inputs.approval }}
70
+ shell: python
71
+ run: |
72
+ import os
73
+ assert os.environ['REQUESTED'] == 'false' or os.environ['APPROVAL'] == 'PUBLISH morphtree 2.1.0 TO TESTPYPI'
74
+ - run: python -I -B tools/check_repository.py
75
+ - name: Verify CI commit, six jobs, artifacts and environment protection
76
+ env:
77
+ GH_TOKEN: ${{ github.token }}
78
+ VERSION: ${{ inputs.expected_version }}
79
+ COMMIT: ${{ inputs.reviewed_commit }}
80
+ BUILD_RUN: ${{ inputs.reviewed_build_run }}
81
+ BUILD_ATTEMPT: ${{ inputs.reviewed_build_attempt }}
82
+ shell: python
83
+ run: |
84
+ import os, subprocess, sys
85
+ subprocess.run([sys.executable, '-I', '-B', 'tools/publish_reviewed.py',
86
+ '--stage', 'origin', '--target', 'testpypi', '--expected-version', os.environ['VERSION'],
87
+ '--reviewed-commit', os.environ['COMMIT'], '--build-run', os.environ['BUILD_RUN'],
88
+ '--build-attempt', os.environ['BUILD_ATTEMPT'], '--output', 'review-origin.json'], check=True)
89
+ - uses: actions/download-artifact@v4
90
+ with:
91
+ name: morphtree-windows-latest-3.12
92
+ run-id: ${{ inputs.reviewed_build_run }}
93
+ github-token: ${{ github.token }}
94
+ path: downloaded/windows
95
+ - uses: actions/download-artifact@v4
96
+ with:
97
+ name: morphtree-ubuntu-24.04-3.12
98
+ run-id: ${{ inputs.reviewed_build_run }}
99
+ github-token: ${{ github.token }}
100
+ path: downloaded/linux
101
+ - name: Install metadata validator only
102
+ run: python -m pip --isolated install twine==6.2.0
103
+ - name: Verify approved hashes, source, metadata and TestPyPI availability
104
+ id: review
105
+ env:
106
+ VERSION: ${{ inputs.expected_version }}
107
+ COMMIT: ${{ inputs.reviewed_commit }}
108
+ BUILD_RUN: ${{ inputs.reviewed_build_run }}
109
+ BUILD_ATTEMPT: ${{ inputs.reviewed_build_attempt }}
110
+ WINDOWS_SHA: ${{ inputs.windows_manifest_sha256 }}
111
+ LINUX_SHA: ${{ inputs.linux_manifest_sha256 }}
112
+ shell: python
113
+ run: |
114
+ import os, subprocess, sys
115
+ subprocess.run([sys.executable, '-I', '-B', 'tools/publish_reviewed.py',
116
+ '--stage', 'preflight', '--target', 'testpypi', '--expected-version', os.environ['VERSION'],
117
+ '--reviewed-commit', os.environ['COMMIT'], '--build-run', os.environ['BUILD_RUN'],
118
+ '--build-attempt', os.environ['BUILD_ATTEMPT'], '--origin', 'review-origin.json',
119
+ '--windows', 'downloaded/windows', '--linux', 'downloaded/linux',
120
+ '--windows-manifest-sha256', os.environ['WINDOWS_SHA'],
121
+ '--linux-manifest-sha256', os.environ['LINUX_SHA'], '--output', 'approved-bundle'], check=True)
122
+ - name: Preserve verified bytes for the isolated publication job
123
+ uses: actions/upload-artifact@v4
124
+ with:
125
+ name: testpypi-approved-${{ github.run_id }}-${{ github.run_attempt }}
126
+ path: approved-bundle/
127
+ if-no-files-found: error
128
+ retention-days: 7
129
+ publish-testpypi:
130
+ needs: preflight
131
+ if: ${{ inputs.publish_testpypi && inputs.approval == 'PUBLISH morphtree 2.1.0 TO TESTPYPI' && needs.preflight.result == 'success' }}
132
+ runs-on: ubuntu-24.04
133
+ timeout-minutes: 10
134
+ environment:
135
+ name: testpypi
136
+ url: https://test.pypi.org/project/morphtree/
137
+ permissions:
138
+ contents: read
139
+ id-token: write
140
+ steps:
141
+ - uses: actions/download-artifact@v4
142
+ with:
143
+ name: testpypi-approved-${{ github.run_id }}-${{ github.run_attempt }}
144
+ path: reviewed
145
+ # No checkout, repository code, build or package installation in this OIDC job.
146
+ - name: Recheck exact bundle and index immediately before OIDC upload
147
+ env:
148
+ APPROVED_MANIFEST_SHA256: ${{ needs.preflight.outputs.bundle_manifest_sha256 }}
149
+ REVIEWED_COMMIT: ${{ inputs.reviewed_commit }}
150
+ REVIEWED_RUN: ${{ inputs.reviewed_build_run }}
151
+ REVIEWED_ATTEMPT: ${{ inputs.reviewed_build_attempt }}
152
+ REQUESTED: ${{ inputs.publish_testpypi }}
153
+ APPROVAL: ${{ inputs.approval }}
154
+ shell: python
155
+ run: |
156
+ import hashlib, json, os, pathlib, re, urllib.error, urllib.request
157
+ def require(condition, message):
158
+ if not condition: raise RuntimeError(message)
159
+ require(os.environ['REQUESTED'] == 'true' and os.environ['APPROVAL'] == 'PUBLISH morphtree 2.1.0 TO TESTPYPI', 'Explicit upload approval missing')
160
+ path = pathlib.Path('reviewed/APPROVED.json')
161
+ require(path.is_file() and not path.is_symlink(), 'Missing or unsafe approval receipt')
162
+ require(re.fullmatch('[0-9a-f]{64}', os.environ['APPROVED_MANIFEST_SHA256']), 'Invalid approval SHA-256')
163
+ require(hashlib.sha256(path.read_bytes()).hexdigest() == os.environ['APPROVED_MANIFEST_SHA256'], 'Approval receipt hash mismatch')
164
+ value = json.loads(path.read_text('utf8'))
165
+ require(value['schema'] == 'MORPHTREE_TESTPYPI_APPROVAL_1', 'Wrong receipt schema')
166
+ require(value['repository'] == os.environ['GITHUB_REPOSITORY'] == 'lucalullo/morph-tree', 'Wrong repository')
167
+ require(re.fullmatch('[0-9a-f]{40}', value['commit']) and value['commit'] == os.environ['GITHUB_SHA'] == os.environ['REVIEWED_COMMIT'], 'Wrong commit')
168
+ require(str(value['build_run_id']) == os.environ['REVIEWED_RUN'] and str(value['build_run_attempt']) == os.environ['REVIEWED_ATTEMPT'], 'Wrong reviewed CI run or attempt')
169
+ require(value['target'] == 'testpypi' and value['version'] == '2.1.0', 'Only TestPyPI version 2.1.0 allowed')
170
+ require(value['repository_url'] == 'https://test.pypi.org/legacy/', 'Official PyPI is blocked')
171
+ root = pathlib.Path('reviewed/packages')
172
+ require(root.is_dir() and not root.is_symlink(), 'Unsafe package directory')
173
+ require({p.name for p in root.iterdir()} == set(value['files']) and len(value['files']) == 3, 'Unexpected package membership')
174
+ require(sum(name.endswith('.whl') for name in value['files']) == 2 and 'morphtree-2.1.0.tar.gz' in value['files'], 'Expected two wheels and one source archive')
175
+ for name, pin in value['files'].items():
176
+ require(pathlib.Path(name).name == name and '\\' not in name, 'Unsafe filename')
177
+ artifact = root / name
178
+ require(artifact.is_file() and not artifact.is_symlink(), 'Missing or unsafe package')
179
+ require(hashlib.sha256(artifact.read_bytes()).hexdigest() == pin, 'Package hash mismatch')
180
+ class NoRedirect(urllib.request.HTTPRedirectHandler):
181
+ def redirect_request(self, *args, **kwargs):
182
+ raise RuntimeError('Unexpected index redirect')
183
+ try:
184
+ urllib.request.build_opener(NoRedirect).open('https://test.pypi.org/pypi/morphtree/2.1.0/json', timeout=20).close()
185
+ except urllib.error.HTTPError as error:
186
+ require(error.code == 404, 'Index availability not verified')
187
+ else:
188
+ raise RuntimeError('Version already present on TestPyPI; no retry or overwrite')
189
+ - name: Publish approved artifacts to TestPyPI using OIDC
190
+ uses: pypa/gh-action-pypi-publish@release/v1
191
+ with:
192
+ repository-url: https://test.pypi.org/legacy/
193
+ packages-dir: reviewed/packages/
194
+ skip-existing: false
195
+ attestations: true
@@ -0,0 +1,86 @@
1
+ name: MorphTree native candidate - manual zero-fit build
2
+ on:
3
+ workflow_dispatch:
4
+ inputs:
5
+ confirm_zero_fit_scope:
6
+ description: Build and test six installed profiles without training or publication
7
+ required: true
8
+ type: boolean
9
+ default: false
10
+ permissions:
11
+ contents: read
12
+ concurrency:
13
+ group: morphtree-native-qualification
14
+ cancel-in-progress: false
15
+ env:
16
+ PYTHONDONTWRITEBYTECODE: '1'
17
+ PYTHONUTF8: '1'
18
+ SOURCE_DATE_EPOCH: '1792022400'
19
+ PIP_NO_INPUT: '1'
20
+ jobs:
21
+ scoped-zero-fit:
22
+ name: zero-fit-${{ matrix.os }}-${{ matrix.python }}
23
+ if: ${{ inputs.confirm_zero_fit_scope }}
24
+ strategy:
25
+ fail-fast: false
26
+ max-parallel: 1
27
+ matrix:
28
+ os: [windows-latest, ubuntu-24.04]
29
+ python: ['3.12', '3.13', '3.14']
30
+ runs-on: ${{ matrix.os }}
31
+ timeout-minutes: 20
32
+ steps:
33
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
34
+ with:
35
+ persist-credentials: false
36
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
37
+ with:
38
+ python-version: ${{ matrix.python }}
39
+ - name: Verify reviewed sources
40
+ run: python -I -B tools/check_repository.py
41
+ - name: Install isolated build tools
42
+ run: python -m pip --isolated install build==1.3.0 hatchling==1.27.0 twine==6.2.0 PyYAML==6.0.3
43
+ - name: Verify publication protocol without network or upload
44
+ run: python -I -B -m unittest discover -s tools/tests -v
45
+ - name: Install Linux audit tools in the CI environment
46
+ if: runner.os == 'Linux'
47
+ run: python -m pip --isolated install auditwheel==6.8.2 pyelftools==0.33 packaging==26.3 patchelf==0.19.1.0
48
+ - name: Build in separate source copy
49
+ if: runner.os == 'Windows'
50
+ run: python -I -B tools/build_artifacts.py
51
+ - name: Build and audit Linux wheel without changing native payload
52
+ if: runner.os == 'Linux'
53
+ run: python -I -B tools/build_artifacts.py --manylinux
54
+ - name: Check wheel and sdist installations
55
+ shell: python
56
+ run: |
57
+ import os,pathlib,subprocess,sys
58
+ root=pathlib.Path.cwd()
59
+ for artifact in sorted((root/'dist').iterdir()):
60
+ kind='wheel' if artifact.suffix=='.whl' else 'sdist'
61
+ prefix=pathlib.Path(os.environ['RUNNER_TEMP'])/('morphtree-'+kind)
62
+ assert not prefix.exists()
63
+ def run(args):
64
+ subprocess.run(list(map(str,args)),check=True,timeout=240,cwd=os.environ['RUNNER_TEMP'])
65
+ run([sys.executable,'-I','-B','-m','venv',prefix])
66
+ py=prefix/('Scripts/python.exe' if os.name=='nt' else 'bin/python')
67
+ run([py,'-I','-B','-m','pip','--isolated','install',artifact])
68
+ run([py,'-I','-B','-m','pip','check'])
69
+ run([py,'-I','-B',root/'tools/check_installed.py'])
70
+ - name: Verify approved README in distribution metadata
71
+ run: python -I -B tools/check_distribution.py dist
72
+ - name: Validate distributions with Twine
73
+ shell: python
74
+ run: |
75
+ import pathlib,subprocess,sys
76
+ artifacts=sorted(pathlib.Path('dist').glob('*.whl'))+sorted(pathlib.Path('dist').glob('*.tar.gz'))
77
+ assert artifacts
78
+ subprocess.run([sys.executable,'-I','-B','-m','twine','check','--strict',*map(str,artifacts)],check=True,timeout=120)
79
+ - name: Record exact commit and distribution SHA-256 after all checks pass
80
+ run: python -I -B tools/write_build_provenance.py
81
+ - name: Preserve verified build artifacts
82
+ uses: actions/upload-artifact@v4
83
+ with:
84
+ name: morphtree-${{ matrix.os }}-${{ matrix.python }}
85
+ path: dist/*
86
+ if-no-files-found: error
@@ -0,0 +1,10 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ env/
5
+ dist/
6
+ build/
7
+ .native-builds/
8
+ python/morphtree/_native/bin/
9
+ *.egg-info/
10
+ .pytest_cache/
@@ -0,0 +1,11 @@
1
+ # Contributor contract
2
+ Preserve Python API, model compatibility and mathematical/evolutionary behavior.
3
+ C accelerates verified primitives; Python retains mutable learning rules. No
4
+ vendor learner, silent sampling, forced acceptance or disabled default Optuna.
5
+ Capacity8 is explicit; do not change the default without separate qualification.
6
+ Read docs/QUALIFICATION.md and docs/ARCHITECTURE.md before making support claims.
7
+ New training requires a finite approved scope; historical budgets are closed.
8
+ No accounts, remote actions, Git writes, hosted workflow or publication by the
9
+ agent. The owner handles transfer and release. Preserve opaque .git and backups.
10
+
11
+ Owner directive30October2026:the agent must not access github.com or GitHub APIs,including read-only requests.No further online checks.Remote tag/release/commit/CI/publication steps belong exclusively to the owner;links/workflow files are instructions for that owner,not execution authority.
@@ -0,0 +1,17 @@
1
+ # Measured comparisons and limits
2
+ The scalar-conversion engineering change in the frozen native engine produced
3
+ 1.55–2.23× inference speedups in recorded profiles. This is not a universal
4
+ training or inference speedup. Historical native whole-fit comparisons remain
5
+ scoped to their datasets/environments; no new RC timing is implied by a rebuild.
6
+
7
+ Stellar VALIDATION:2round BA0.879211;8round BA0.920422,log-loss0.144333,
8
+ STARrecall85.03%,STARinM48.11%. Equal-capacity static/evolutionary packets were
9
+ identical; all four proposals rolled back. HGB reference BA0.947921,log-loss
10
+ 0.289208. Metrics rank models differently. More capacity is not a mutation gain;
11
+ no general competitiveness claim or fresh independent realTEST confirmation.
12
+
13
+ OBSERVATION112:two OOFfits/48trees,exact old per-row loss,21.609/21.344s fit;
14
+ worker peakWS496.96MiB. This isolated acquisition is not a whole-fit benchmark.
15
+ STARmean probability inM matches prevalence closely despite poor recall; this
16
+ does not prove full calibration or irreducibility. Feature interactions remain
17
+ hypotheses; diagnostic/planner/local mutation prototypes are not distributed.