newlife 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. newlife-0.1.0/.gitignore +8 -0
  2. newlife-0.1.0/LICENSE +202 -0
  3. newlife-0.1.0/PKG-INFO +96 -0
  4. newlife-0.1.0/README.md +73 -0
  5. newlife-0.1.0/pyproject.toml +48 -0
  6. newlife-0.1.0/src/newlife/__init__.py +11 -0
  7. newlife-0.1.0/src/newlife/adapters/__init__.py +1 -0
  8. newlife-0.1.0/src/newlife/adapters/process_bigraph/__init__.py +1 -0
  9. newlife-0.1.0/src/newlife/adapters/process_bigraph/bare_control.py +144 -0
  10. newlife-0.1.0/src/newlife/adapters/process_bigraph/cases.py +1129 -0
  11. newlife-0.1.0/src/newlife/adapters/process_bigraph/derive.py +195 -0
  12. newlife-0.1.0/src/newlife/adapters/process_bigraph/discovery.py +58 -0
  13. newlife-0.1.0/src/newlife/adapters/process_bigraph/foreign.py +222 -0
  14. newlife-0.1.0/src/newlife/adapters/process_bigraph/lowering.py +203 -0
  15. newlife-0.1.0/src/newlife/adapters/process_bigraph/public_api_audit.py +123 -0
  16. newlife-0.1.0/src/newlife/adapters/process_bigraph/staging.py +381 -0
  17. newlife-0.1.0/src/newlife/adapters/process_bigraph/world_runtime.py +144 -0
  18. newlife-0.1.0/src/newlife/adapters/process_bigraph/wrapper.py +381 -0
  19. newlife-0.1.0/src/newlife/adapters/reference_kernel/__init__.py +1 -0
  20. newlife-0.1.0/src/newlife/adapters/reference_kernel/cases.py +709 -0
  21. newlife-0.1.0/src/newlife/adapters/reference_kernel/kernel.py +393 -0
  22. newlife-0.1.0/src/newlife/adapters/reference_kernel/lowering.py +169 -0
  23. newlife-0.1.0/src/newlife/adapters/reference_kernel/world_runtime.py +31 -0
  24. newlife-0.1.0/src/newlife/cli.py +170 -0
  25. newlife-0.1.0/src/newlife/conform/__init__.py +1 -0
  26. newlife-0.1.0/src/newlife/conform/contract/__init__.py +1 -0
  27. newlife-0.1.0/src/newlife/conform/contract/canonical_ruler.py +42 -0
  28. newlife-0.1.0/src/newlife/conform/cross_runtime_verdict.py +186 -0
  29. newlife-0.1.0/src/newlife/conform/dep_declaration.py +166 -0
  30. newlife-0.1.0/src/newlife/conform/derive_authority_verdict.py +266 -0
  31. newlife-0.1.0/src/newlife/conform/eighth_world_verdict.py +136 -0
  32. newlife-0.1.0/src/newlife/conform/external_package_verdict.py +198 -0
  33. newlife-0.1.0/src/newlife/conform/fifth_world_verdict.py +80 -0
  34. newlife-0.1.0/src/newlife/conform/fixtures/expected/continuous_next_event.json +92 -0
  35. newlife-0.1.0/src/newlife/conform/fixtures/expected/coupled_mechanics_division.json +121 -0
  36. newlife-0.1.0/src/newlife/conform/fixtures/expected/effect_algebra_transfer.json +44 -0
  37. newlife-0.1.0/src/newlife/conform/fixtures/expected/execution_budget.json +127 -0
  38. newlife-0.1.0/src/newlife/conform/fixtures/expected/hook_authority.json +95 -0
  39. newlife-0.1.0/src/newlife/conform/fixtures.py +56 -0
  40. newlife-0.1.0/src/newlife/conform/foreign_process_verdict.py +188 -0
  41. newlife-0.1.0/src/newlife/conform/fourth_world_verdict.py +214 -0
  42. newlife-0.1.0/src/newlife/conform/host/__init__.py +1 -0
  43. newlife-0.1.0/src/newlife/conform/judgment.py +155 -0
  44. newlife-0.1.0/src/newlife/conform/manifest.py +118 -0
  45. newlife-0.1.0/src/newlife/conform/ninth_world_verdict.py +103 -0
  46. newlife-0.1.0/src/newlife/conform/probes.py +186 -0
  47. newlife-0.1.0/src/newlife/conform/second_world_verdict.py +325 -0
  48. newlife-0.1.0/src/newlife/conform/seventh_world_verdict.py +137 -0
  49. newlife-0.1.0/src/newlife/conform/sixth_world_verdict.py +145 -0
  50. newlife-0.1.0/src/newlife/conform/solver_backed_verdict.py +201 -0
  51. newlife-0.1.0/src/newlife/conform/tenth_verdict.py +140 -0
  52. newlife-0.1.0/src/newlife/conform/third_world_verdict.py +183 -0
  53. newlife-0.1.0/src/newlife/conform/verdict.py +444 -0
  54. newlife-0.1.0/src/newlife/conform/verdict_rot.py +315 -0
  55. newlife-0.1.0/src/newlife/conform/yield_verdict.py +221 -0
  56. newlife-0.1.0/src/newlife/core/__init__.py +1 -0
  57. newlife-0.1.0/src/newlife/core/compare.py +167 -0
  58. newlife-0.1.0/src/newlife/core/contracts.py +224 -0
  59. newlife-0.1.0/src/newlife/core/errors.py +73 -0
  60. newlife-0.1.0/src/newlife/core/harness.py +253 -0
  61. newlife-0.1.0/src/newlife/core/lowering_contract.py +99 -0
  62. newlife-0.1.0/src/newlife/core/runtime.py +47 -0
  63. newlife-0.1.0/src/newlife/core/verdict_seam.py +90 -0
  64. newlife-0.1.0/src/newlife/gates/__init__.py +5 -0
  65. newlife-0.1.0/src/newlife/gates/silent_degradation_scan.py +499 -0
  66. newlife-0.1.0/src/newlife/gates/unit_alignment.py +207 -0
  67. newlife-0.1.0/src/newlife/gates/vacuous_criterion_scan.py +161 -0
  68. newlife-0.1.0/src/newlife/mechanisms/__init__.py +1 -0
  69. newlife-0.1.0/src/newlife/mechanisms/foreign_dfba/__init__.py +0 -0
  70. newlife-0.1.0/src/newlife/mechanisms/foreign_dfba/declaration.py +66 -0
  71. newlife-0.1.0/src/newlife/mechanisms/foreign_growth/__init__.py +0 -0
  72. newlife-0.1.0/src/newlife/mechanisms/foreign_growth/declaration.py +48 -0
  73. newlife-0.1.0/src/newlife/mechanisms/foreign_monod/__init__.py +0 -0
  74. newlife-0.1.0/src/newlife/mechanisms/foreign_monod/declaration.py +61 -0
  75. newlife-0.1.0/src/newlife/mechanisms/fourth_world/__init__.py +0 -0
  76. newlife-0.1.0/src/newlife/mechanisms/fourth_world/genealogy.py +103 -0
  77. newlife-0.1.0/src/newlife/mechanisms/fourth_world/spec.py +62 -0
  78. newlife-0.1.0/src/newlife/mechanisms/fourth_world/world.py +68 -0
  79. newlife-0.1.0/src/newlife/mechanisms/resource_foraging/__init__.py +1 -0
  80. newlife-0.1.0/src/newlife/mechanisms/resource_foraging/__main__.py +34 -0
  81. newlife-0.1.0/src/newlife/mechanisms/resource_foraging/assay.py +169 -0
  82. newlife-0.1.0/src/newlife/mechanisms/resource_foraging/calibration.py +171 -0
  83. newlife-0.1.0/src/newlife/mechanisms/resource_foraging/injection.py +201 -0
  84. newlife-0.1.0/src/newlife/mechanisms/resource_foraging/mechanisms.py +721 -0
  85. newlife-0.1.0/src/newlife/mechanisms/resource_foraging/model.py +256 -0
  86. newlife-0.1.0/src/newlife/mechanisms/resource_foraging/spec.py +49 -0
  87. newlife-0.1.0/src/newlife/mechanisms/resource_foraging/world.py +689 -0
  88. newlife-0.1.0/src/newlife/mechanisms/second_world/__init__.py +2 -0
  89. newlife-0.1.0/src/newlife/mechanisms/second_world/mechanisms.py +120 -0
  90. newlife-0.1.0/src/newlife/mechanisms/second_world/ms_binary.py +101 -0
  91. newlife-0.1.0/src/newlife/mechanisms/second_world/ms_coalescent.py +250 -0
  92. newlife-0.1.0/src/newlife/mechanisms/second_world/rng_mapping.py +36 -0
  93. newlife-0.1.0/src/newlife/mechanisms/second_world/world.py +107 -0
  94. newlife-0.1.0/src/newlife/mechanisms/third_world/__init__.py +0 -0
  95. newlife-0.1.0/src/newlife/mechanisms/third_world/moran.py +100 -0
  96. newlife-0.1.0/src/newlife/provenance.py +119 -0
  97. newlife-0.1.0/src/newlife/scaffold/__init__.py +145 -0
  98. newlife-0.1.0/src/newlife/scaffold/prereg.sh +362 -0
  99. newlife-0.1.0/src/newlife/scaffold/templates/gitignore +4 -0
  100. newlife-0.1.0/src/newlife/scaffold/templates/prereg.md +59 -0
  101. newlife-0.1.0/src/newlife/scaffold/templates/verdict.py.template +134 -0
  102. newlife-0.1.0/src/newlife/skills/decidable-question/SKILL.md +263 -0
  103. newlife-0.1.0/src/newlife/skills/preregister-verdict/SKILL.md +146 -0
  104. newlife-0.1.0/tests/core/test_compare.py +259 -0
  105. newlife-0.1.0/tests/fourth_world/test_reuse.py +161 -0
  106. newlife-0.1.0/tests/resource_foraging/test_calibration.py +70 -0
  107. newlife-0.1.0/tests/resource_foraging/test_world.py +262 -0
  108. newlife-0.1.0/tests/second_world/conftest.py +40 -0
  109. newlife-0.1.0/tests/second_world/test_mechanism_registry.py +63 -0
  110. newlife-0.1.0/tests/second_world/test_ms_grid.py +63 -0
  111. newlife-0.1.0/tests/second_world/test_rng_mapping.py +58 -0
  112. newlife-0.1.0/tests/second_world/test_second_world_verdict.py +70 -0
  113. newlife-0.1.0/tests/test_bypass_negatives.py +162 -0
  114. newlife-0.1.0/tests/test_cli_skills_blocks.py +74 -0
  115. newlife-0.1.0/tests/test_contracts.py +144 -0
  116. newlife-0.1.0/tests/test_foreign_process.py +42 -0
  117. newlife-0.1.0/tests/test_gates.py +55 -0
  118. newlife-0.1.0/tests/test_lowering_contract.py +121 -0
  119. newlife-0.1.0/tests/test_lowering_controls.py +119 -0
  120. newlife-0.1.0/tests/test_ms_vendor.py +32 -0
  121. newlife-0.1.0/tests/test_pb_lowering_dispatch.py +154 -0
  122. newlife-0.1.0/tests/test_public_english.py +65 -0
  123. newlife-0.1.0/tests/test_reference_cases.py +153 -0
  124. newlife-0.1.0/tests/test_ruler.py +102 -0
  125. newlife-0.1.0/tests/test_safety_line_dedup.py +55 -0
  126. newlife-0.1.0/tests/test_scaffold.py +183 -0
  127. newlife-0.1.0/tests/test_staging_cases.py +151 -0
  128. newlife-0.1.0/tests/test_staging_derivation.py +178 -0
  129. newlife-0.1.0/tests/test_staging_validation.py +113 -0
  130. newlife-0.1.0/tests/test_verdict.py +69 -0
  131. newlife-0.1.0/tests/test_vivarium_cases.py +53 -0
  132. newlife-0.1.0/tests/test_vivarium_profile.py +210 -0
  133. newlife-0.1.0/tests/third_world/test_oracle_conformance.py +254 -0
@@ -0,0 +1,8 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .pytest_cache/
8
+ .DS_Store
newlife-0.1.0/LICENSE ADDED
@@ -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.
newlife-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,96 @@
1
+ Metadata-Version: 2.5
2
+ Name: newlife
3
+ Version: 0.1.0
4
+ Summary: Preregistration harness for simulation: freeze what would count as an answer in git, compute the verdict mechanically, and prove from commit ancestry that the outputs post-date the freeze.
5
+ Project-URL: Homepage, https://github.com/hzshen88/newlife
6
+ Project-URL: Repository, https://github.com/hzshen88/newlife
7
+ Author: hzshen88
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: preregistration,provenance,reproducibility,scientific-workflow,simulation,systems-biology
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Natural Language :: English
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
16
+ Requires-Python: >=3.12
17
+ Requires-Dist: proofroot<0.2,>=0.1
18
+ Provides-Extra: process-bigraph
19
+ Requires-Dist: process-bigraph==1.8.3; extra == 'process-bigraph'
20
+ Provides-Extra: spatio-flux
21
+ Requires-Dist: spatio-flux==1.4.0; extra == 'spatio-flux'
22
+ Description-Content-Type: text/markdown
23
+
24
+ # newlife
25
+
26
+ **A preregistration harness for simulation.** Freeze what would count as an answer
27
+ *before* you run anything; let the machine — not your judgement after the fact —
28
+ decide whether the criteria were met.
29
+
30
+ ## Install
31
+
32
+ Requires Python 3.12 or newer and `git`.
33
+
34
+ ```bash
35
+ python -m pip install newlife
36
+ # Optional simulation backends:
37
+ python -m pip install "newlife[process-bigraph]"
38
+ python -m pip install "newlife[spatio-flux]"
39
+ ```
40
+
41
+ Start in your own repository:
42
+
43
+ ```bash
44
+ mkdir my-research && cd my-research
45
+ git init
46
+ git config user.name "Your Name"
47
+ git config user.email "you@example.com"
48
+ newlife init 2026-09-05-my-question # scaffold a question folder; commits it,
49
+ # deliberately leaving prereg.md uncommitted
50
+ $EDITOR questions/2026-09-05-my-question/prereg.md
51
+ newlife freeze questions/2026-09-05-my-question
52
+ $EDITOR questions/2026-09-05-my-question/verdict.py
53
+ newlife run questions/2026-09-05-my-question
54
+ newlife check questions/2026-09-05-my-question
55
+ git add questions/2026-09-05-my-question/results
56
+ git commit -m "record verdict"
57
+ newlife audit questions/2026-09-05-my-question
58
+ ```
59
+
60
+ `audit` proves, from commit ancestry rather than forgeable dates: the registration has a
61
+ freeze commit, the stamped hash matches it, the content was never edited afterwards, and
62
+ **every committed output post-dates the freeze**. Questions are siblings, not a chain:
63
+ a question's verdict never runs another question's runner.
64
+
65
+ ## What the contract layer does
66
+
67
+ `BiologicalProfile` enforces four contracts — `StateClaim`, `MechanismSpec`, `Effect`,
68
+ `Resolver`. A mechanism declares which paths it owns and which effects it may emit;
69
+ writing anywhere else raises `newlife.core.errors.CommitAuthorityError` **from the
70
+ contract layer, not from your solver**. That distinction is load-bearing: "an exception
71
+ was raised" is not the same as "the contract stopped it", and a negative control that
72
+ conflates them proves nothing.
73
+
74
+ Third-party simulation processes are admitted unmodified. Verified against
75
+ `process-bigraph`'s own processes, `spatio-flux` (Monod kinetics, dynamic FBA behind a
76
+ GLPK solver), and a hand-wrapped `tellurium` ODE model — trajectories byte-identical to
77
+ running the same code without newlife.
78
+
79
+ ## Gates that ship with it
80
+
81
+ `newlife check` runs three checks against your files: criteria that are **true by
82
+ construction** (a comprehension iterating a named constant while discarding the loop
83
+ variable is a repetition, not a sweep); parse failures that **silently fall back to a
84
+ convenient default**; and whether the units your registration declares are exactly the
85
+ units your runner computes. Each of the three was written after that exact defect shipped
86
+ undetected — the third one caught a real misalignment the first time it ran.
87
+
88
+ Also included: `newlife skills install` puts two AI skills (shaping a question into a
89
+ decidable one; writing a registration that will not veto itself) where your assistant
90
+ reads them.
91
+
92
+ `proofroot` is installed transitively and supplies RNG stream derivation, canonical
93
+ serialization, and the evidence-tier vocabulary.
94
+
95
+ Source, design rationale, and the record of every milestone judged so far:
96
+ <https://github.com/hzshen88/newlife>
@@ -0,0 +1,73 @@
1
+ # newlife
2
+
3
+ **A preregistration harness for simulation.** Freeze what would count as an answer
4
+ *before* you run anything; let the machine — not your judgement after the fact —
5
+ decide whether the criteria were met.
6
+
7
+ ## Install
8
+
9
+ Requires Python 3.12 or newer and `git`.
10
+
11
+ ```bash
12
+ python -m pip install newlife
13
+ # Optional simulation backends:
14
+ python -m pip install "newlife[process-bigraph]"
15
+ python -m pip install "newlife[spatio-flux]"
16
+ ```
17
+
18
+ Start in your own repository:
19
+
20
+ ```bash
21
+ mkdir my-research && cd my-research
22
+ git init
23
+ git config user.name "Your Name"
24
+ git config user.email "you@example.com"
25
+ newlife init 2026-09-05-my-question # scaffold a question folder; commits it,
26
+ # deliberately leaving prereg.md uncommitted
27
+ $EDITOR questions/2026-09-05-my-question/prereg.md
28
+ newlife freeze questions/2026-09-05-my-question
29
+ $EDITOR questions/2026-09-05-my-question/verdict.py
30
+ newlife run questions/2026-09-05-my-question
31
+ newlife check questions/2026-09-05-my-question
32
+ git add questions/2026-09-05-my-question/results
33
+ git commit -m "record verdict"
34
+ newlife audit questions/2026-09-05-my-question
35
+ ```
36
+
37
+ `audit` proves, from commit ancestry rather than forgeable dates: the registration has a
38
+ freeze commit, the stamped hash matches it, the content was never edited afterwards, and
39
+ **every committed output post-dates the freeze**. Questions are siblings, not a chain:
40
+ a question's verdict never runs another question's runner.
41
+
42
+ ## What the contract layer does
43
+
44
+ `BiologicalProfile` enforces four contracts — `StateClaim`, `MechanismSpec`, `Effect`,
45
+ `Resolver`. A mechanism declares which paths it owns and which effects it may emit;
46
+ writing anywhere else raises `newlife.core.errors.CommitAuthorityError` **from the
47
+ contract layer, not from your solver**. That distinction is load-bearing: "an exception
48
+ was raised" is not the same as "the contract stopped it", and a negative control that
49
+ conflates them proves nothing.
50
+
51
+ Third-party simulation processes are admitted unmodified. Verified against
52
+ `process-bigraph`'s own processes, `spatio-flux` (Monod kinetics, dynamic FBA behind a
53
+ GLPK solver), and a hand-wrapped `tellurium` ODE model — trajectories byte-identical to
54
+ running the same code without newlife.
55
+
56
+ ## Gates that ship with it
57
+
58
+ `newlife check` runs three checks against your files: criteria that are **true by
59
+ construction** (a comprehension iterating a named constant while discarding the loop
60
+ variable is a repetition, not a sweep); parse failures that **silently fall back to a
61
+ convenient default**; and whether the units your registration declares are exactly the
62
+ units your runner computes. Each of the three was written after that exact defect shipped
63
+ undetected — the third one caught a real misalignment the first time it ran.
64
+
65
+ Also included: `newlife skills install` puts two AI skills (shaping a question into a
66
+ decidable one; writing a registration that will not veto itself) where your assistant
67
+ reads them.
68
+
69
+ `proofroot` is installed transitively and supplies RNG stream derivation, canonical
70
+ serialization, and the evidence-tier vocabulary.
71
+
72
+ Source, design rationale, and the record of every milestone judged so far:
73
+ <https://github.com/hzshen88/newlife>
@@ -0,0 +1,48 @@
1
+ [project]
2
+ name = "newlife"
3
+ version = "0.1.0"
4
+ description = "Preregistration harness for simulation: freeze what would count as an answer in git, compute the verdict mechanically, and prove from commit ancestry that the outputs post-date the freeze."
5
+ readme = "README.md"
6
+ requires-python = ">=3.12"
7
+ license = "Apache-2.0"
8
+ license-files = ["LICENSE"]
9
+ authors = [{ name = "hzshen88" }]
10
+ keywords = ["preregistration", "reproducibility", "simulation", "provenance",
11
+ "systems-biology", "scientific-workflow"]
12
+ classifiers = [
13
+ "Development Status :: 3 - Alpha",
14
+ "Intended Audience :: Science/Research",
15
+ "Natural Language :: English",
16
+ "Programming Language :: Python :: 3.12",
17
+ "Topic :: Scientific/Engineering :: Bio-Informatics",
18
+ ]
19
+ dependencies = ["proofroot>=0.1,<0.2"]
20
+
21
+ [project.optional-dependencies]
22
+ process-bigraph = ["process-bigraph==1.8.3"]
23
+ # 第十六个里程碑:一个真正独立的第三方包。走 optional extra,不进主依赖面
24
+ spatio-flux = ["spatio-flux==1.4.0"]
25
+
26
+ [project.scripts]
27
+ newlife = "newlife.cli:main"
28
+
29
+ [build-system]
30
+ requires = ["hatchling"]
31
+ build-backend = "hatchling.build"
32
+
33
+ [tool.uv.sources]
34
+ proofroot = { workspace = true }
35
+
36
+ [tool.hatch.build.targets.wheel]
37
+ packages = ["src/newlife"]
38
+ # 模板与 vendored 的 prereg.sh 不是 .py,必须显式带进 wheel——
39
+ # 「冻结工具不随库发布」是用户拿不到时间证明的直接原因。
40
+ artifacts = ["src/newlife/scaffold/prereg.sh", "src/newlife/scaffold/templates/*",
41
+ "src/newlife/skills/*/SKILL.md"]
42
+
43
+ [dependency-groups]
44
+ dev = ["pytest>=8"]
45
+
46
+ [project.urls]
47
+ Homepage = "https://github.com/hzshen88/newlife"
48
+ Repository = "https://github.com/hzshen88/newlife"
@@ -0,0 +1,11 @@
1
+ """newlife — a verifiable profile layer for composable biological simulation.
2
+
3
+ Owns the scientific semantics the bare runtime does not provide (proposal
4
+ v0.6, §3): StateClaim / MechanismSpec / Effect / Resolver contracts, path
5
+ authority, read-only alias protection, single-path lowering (the only write
6
+ path into any runtime), and canonical evidence traces.
7
+
8
+ Vendor types (Process, Composite, ...) never leak past the adapter layer;
9
+ `process-bigraph` is an optional extra and may only be imported inside
10
+ `newlife.adapters.process_bigraph`.
11
+ """
@@ -0,0 +1 @@
1
+ """adapters subpackage (skeleton — filled per v0.1 schedule; no lowering code before preregistration freeze)."""
@@ -0,0 +1 @@
1
+ """adapters/process_bigraph subpackage (skeleton — filled per v0.1 schedule; no lowering code before preregistration freeze)."""
@@ -0,0 +1,144 @@
1
+ """Bare process-bigraph controls that deliberately bypass newlife."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+ from process_bigraph import Composite, allocate_core
8
+ from process_bigraph.processes.growth_division import Grow
9
+
10
+
11
+ def bare_trajectory(*, initial_mass: float, rate: float, steps: int) -> list[float]:
12
+ """Run ``Grow`` on bare process-bigraph and return the mass trajectory."""
13
+ core = _core()
14
+ state: dict[str, Any] = {
15
+ "mass": initial_mass,
16
+ "grow": {
17
+ "_type": "process",
18
+ "address": "local:Grow",
19
+ "config": {"rate": rate},
20
+ "inputs": {"mass": ["mass"]},
21
+ "outputs": {"mass": ["mass"]},
22
+ "interval": 1.0,
23
+ },
24
+ }
25
+ composite = Composite({"state": state}, core=core)
26
+ trajectory = [float(composite.state["mass"])]
27
+ for _ in range(steps):
28
+ composite.run(1.0)
29
+ trajectory.append(float(composite.state["mass"]))
30
+ return trajectory
31
+
32
+
33
+ def _core():
34
+ core = allocate_core()
35
+ core.register_link("Grow", Grow)
36
+ return core
37
+
38
+
39
+ # --- 第十六个里程碑:一个真正独立的第三方包(spatio-flux 1.4.0)---
40
+
41
+
42
+ def monod_trajectory(
43
+ *, initial_mass: float, glucose: float, steps: int
44
+ ) -> list[tuple[float, dict[str, float]]]:
45
+ """Run ``MonodKinetics`` on bare process-bigraph and return its trajectory."""
46
+ try:
47
+ import spatio_flux
48
+ from spatio_flux.processes.monod_kinetics import MonodKinetics
49
+ except ImportError as exc:
50
+ raise SystemExit(
51
+ "spatio-flux is not installed; this is an environment error, not a verdict. "
52
+ "Install with: uv sync --package newlife --extra process-bigraph "
53
+ f"--extra spatio-flux. Original error: {exc}"
54
+ ) from exc
55
+
56
+ core = allocate_core()
57
+ spatio_flux.register_types(core) # 第三方交付的类型词表
58
+ core.register_link("MonodKinetics", MonodKinetics)
59
+
60
+ state: dict[str, Any] = {
61
+ "mass": initial_mass,
62
+ "local": {"glucose": glucose},
63
+ "exchange": {"glucose": 0.0},
64
+ "kin": {
65
+ "_type": "process",
66
+ "address": "local:MonodKinetics",
67
+ "config": {},
68
+ "inputs": {"biomass": ["mass"], "substrates": ["local"]},
69
+ "outputs": {"biomass": ["mass"], "substrates": ["exchange"]},
70
+ "interval": 1.0,
71
+ },
72
+ }
73
+ composite = Composite({"state": state}, core=core)
74
+ out = [(float(composite.state["mass"]), dict(composite.state["exchange"]))]
75
+ for _ in range(steps):
76
+ composite.run(1.0)
77
+ out.append((float(composite.state["mass"]), dict(composite.state["exchange"])))
78
+ return out
79
+
80
+
81
+ # --- 第十七个里程碑:一个求解器背后的第三方 process(spatio-flux 的 dFBA)---
82
+
83
+ FIELDS = ("glucose", "acetate", "biomass")
84
+
85
+
86
+ def dfba_trajectory(
87
+ *, glucose: float, acetate: float, biomass: float, steps: int
88
+ ) -> list[dict[str, float]]:
89
+ """Run ``DynamicFBA`` on bare process-bigraph with its bundled E. coli model."""
90
+ try:
91
+ import spatio_flux
92
+ from spatio_flux.processes.dfba import MODEL_REGISTRY_DFBA, DynamicFBA
93
+ except ImportError as exc:
94
+ raise SystemExit(
95
+ "spatio-flux or cobra is not installed; this is an environment error, "
96
+ "not a verdict. Install with: uv sync --package newlife "
97
+ f"--extra process-bigraph --extra spatio-flux. Original error: {exc}"
98
+ ) from exc
99
+
100
+ core = allocate_core()
101
+ spatio_flux.register_types(core)
102
+ core.register_link("DynamicFBA", DynamicFBA)
103
+
104
+ state: dict[str, Any] = {
105
+ "fields": {"glucose": glucose, "acetate": acetate, "biomass": biomass},
106
+ "fba": {
107
+ "_type": "process",
108
+ "address": "local:DynamicFBA",
109
+ "config": dict(MODEL_REGISTRY_DFBA["ecoli core"]),
110
+ "inputs": {
111
+ "substrates": {"glucose": ["fields", "glucose"],
112
+ "acetate": ["fields", "acetate"]},
113
+ "biomass": ["fields", "biomass"],
114
+ },
115
+ "outputs": {
116
+ "substrates": {"glucose": ["fields", "glucose"],
117
+ "acetate": ["fields", "acetate"]},
118
+ "biomass": ["fields", "biomass"],
119
+ },
120
+ "interval": 1.0,
121
+ },
122
+ }
123
+ composite = Composite({"state": state}, core=core)
124
+ out = [normalise_fields(composite.state["fields"])]
125
+ for _ in range(steps):
126
+ composite.run(1.0)
127
+ out.append(normalise_fields(composite.state["fields"]))
128
+ return out
129
+
130
+
131
+ def normalise_fields(fields: Any) -> dict[str, float]:
132
+ """Normalize third-party numeric scalar values to Python ``float``."""
133
+ return {k: float(fields[k]) for k in FIELDS}
134
+
135
+
136
+ def solver_identity() -> dict[str, str]:
137
+ """Return the optimization interface and solver version used by dFBA."""
138
+ from cobra.io import load_model
139
+ import swiglpk
140
+
141
+ return {
142
+ "optlang_interface": load_model("textbook").solver.interface.__name__,
143
+ "glpk_version": str(swiglpk.glp_version()),
144
+ }