process-bigraph 1.9.1__tar.gz → 1.10.1__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 (84) hide show
  1. {process_bigraph-1.9.1/process_bigraph.egg-info → process_bigraph-1.10.1}/PKG-INFO +36 -20
  2. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/README.md +35 -19
  3. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/__init__.py +39 -1
  4. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/composite.py +244 -127
  5. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/composite_discovery.py +10 -2
  6. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/composite_generator.py +37 -51
  7. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/composite_spec.py +26 -9
  8. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/draft_process.py +52 -0
  9. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/experiments/minimal_gillespie.py +1 -54
  10. process_bigraph-1.10.1/process_bigraph/holes.py +168 -0
  11. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/nextflow.py +0 -37
  12. process_bigraph-1.10.1/process_bigraph/orchestration.py +127 -0
  13. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/processes/examples.py +0 -28
  14. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/protocols/ray.py +20 -1
  15. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/scheduling.py +208 -21
  16. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/templates.py +14 -8
  17. {process_bigraph-1.9.1 → process_bigraph-1.10.1/process_bigraph.egg-info}/PKG-INFO +36 -20
  18. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph.egg-info/SOURCES.txt +4 -1
  19. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/pyproject.toml +1 -1
  20. process_bigraph-1.10.1/tests/test_global_time_precision_default.py +63 -0
  21. process_bigraph-1.10.1/tests/test_initial_state_precedence.py +51 -0
  22. process_bigraph-1.9.1/process_bigraph/run.py +0 -29
  23. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/AUTHORS.md +0 -0
  24. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/LICENSE +0 -0
  25. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/artifacts.py +0 -0
  26. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/audit_contracts.py +0 -0
  27. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/bundle.py +0 -0
  28. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/composite_audit.py +0 -0
  29. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/config_helpers.py +0 -0
  30. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/contract_drift.py +0 -0
  31. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/contract_strict.py +0 -0
  32. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/core_introspection.py +0 -0
  33. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/emitter.py +0 -0
  34. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/events.py +0 -0
  35. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/experiments/__init__.py +0 -0
  36. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/nextflow_deploy.py +0 -0
  37. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/plumbing.py +0 -0
  38. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/processes/__init__.py +0 -0
  39. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/processes/bigraphical_reactive_system.py +0 -0
  40. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/processes/cached.py +0 -0
  41. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/processes/dynamic_structure.py +0 -0
  42. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/processes/growth_division.py +0 -0
  43. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/processes/parameter_scan.py +0 -0
  44. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/processes/reaction.py +0 -0
  45. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/processes/simulation.py +0 -0
  46. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/protocols/__init__.py +0 -0
  47. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/protocols/_git_worker.py +0 -0
  48. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/protocols/clusters/__init__.py +0 -0
  49. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/protocols/clusters/ec2_ssm.py +0 -0
  50. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/protocols/git.py +0 -0
  51. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/protocols/parallel.py +0 -0
  52. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/protocols/pool.py +0 -0
  53. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/protocols/rest.py +0 -0
  54. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/protocols/session.py +0 -0
  55. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/run_composite.py +0 -0
  56. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/run_step.py +0 -0
  57. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/server/__init__.py +0 -0
  58. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/server/rest.py +0 -0
  59. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/server/start.py +0 -0
  60. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/types/__init__.py +0 -0
  61. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/types/process.py +0 -0
  62. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/visualization.py +0 -0
  63. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/visualizations/__init__.py +0 -0
  64. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/visualizations/distribution.py +0 -0
  65. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/visualizations/heatmap.py +0 -0
  66. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/visualizations/param_vs_observable.py +0 -0
  67. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/visualizations/phase_space.py +0 -0
  68. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/visualizations/time_series.py +0 -0
  69. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/visualizations/timeseries_from_observables.py +0 -0
  70. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/wiring_translator.py +0 -0
  71. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/workflow/__init__.py +0 -0
  72. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/workflow/backend.py +0 -0
  73. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/workflow/provision.py +0 -0
  74. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/workflow/recipe.py +0 -0
  75. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph/workflow/tasks.py +0 -0
  76. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph.egg-info/dependency_links.txt +0 -0
  77. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph.egg-info/requires.txt +0 -0
  78. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/process_bigraph.egg-info/top_level.txt +0 -0
  79. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/setup.cfg +0 -0
  80. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/tests/test_composite_generator_analyses.py +0 -0
  81. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/tests/test_multirate_scheduling.py +0 -0
  82. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/tests/test_process_decorator.py +0 -0
  83. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/tests/test_reaction_step.py +0 -0
  84. {process_bigraph-1.9.1 → process_bigraph-1.10.1}/tests/test_units.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: process-bigraph
3
- Version: 1.9.1
3
+ Version: 1.10.1
4
4
  Summary: protocol and execution for compositional systems biology
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -128,28 +128,44 @@ print(gather_emitter_results(composite))
128
128
  # {('emitter',): [{'level': 1.0, 'time': 0.0}, {'level': 1.5, ...}, ... {'level': 7.59, 'time': 5.0}]}
129
129
  ```
130
130
 
131
- **2. A draft process — a present-but-inert placeholder node.** It declares a contract
132
- (ports + description) but has no `update`, so a composite containing it still runs; the
133
- draft just no-ops. Complementary to a *site* (step 3): a draft is a node that is *there
134
- but inert*, a site is an empty *hole*.
131
+ **2. A draft — an open hole whose sort is a contract.** A not-yet-implemented
132
+ process-slot is a *hole*: an open **site** (step 3) whose `_sort` names a
133
+ `ProcessContract` (its typed face + conditions). You design and review the topology
134
+ with the hole in place, then fill it with any process the contract *admits*.
135
+ `Composite` refuses to build while a required hole is open, and reports **which** hole,
136
+ **what** contract it requires, and **which** registered processes would fill it.
135
137
 
136
138
  ```python
137
- from process_bigraph import DraftProcess, draft_process
138
-
139
- @draft_process(name="PTH secretion",
140
- inputs={'ca_sense': 'float'}, outputs={'pth_out': 'float'},
141
- contract={'summary': 'senses serum Ca, secretes PTH', 'senses': 'calcium', 'makes': 'PTH'})
142
- class PTHSecretion(DraftProcess):
143
- pass
144
-
145
- core.register_link('PTHSecretion', PTHSecretion)
146
- print(PTHSecretion({}, core=core).describe())
147
- # DRAFT — senses serum Ca, secretes PTH · makes: PTH · senses: calcium · status: draft - no update dynamics yet
139
+ from bigraph_schema.contract import ProcessContract
140
+ from process_bigraph import find_candidates, UnfilledHoleError
141
+
142
+ # register the intended interface as a named contract …
143
+ core.register_contract('PTHSecretion', ProcessContract(
144
+ summary='senses serum Ca, secretes PTH',
145
+ face={'inputs': {'ca_sense': 'float'}, 'outputs': {'pth_out': 'float'}}))
146
+
147
+ # … and leave the slot as a hole sorted by it
148
+ template = core.access({'parathyroid': {'ca': 2.5, 'pth': 0.0,
149
+ 'secretion': {'_type': 'site', '_sort': 'PTHSecretion'}}})
150
+
151
+ # Composite(..., unfilled) → UnfilledHoleError, not an opaque KeyError:
152
+ # not ground — required site(s) left unfilled: 'parathyroid/secretion'
153
+ # • parathyroid/secretion
154
+ # requires:
155
+ # inputs: ca_sense: float
156
+ # outputs: pth_out: float
157
+ # candidates:
158
+ # ✓ <any registered process whose contract admits the hole>
148
159
  ```
149
160
 
150
- A module-scope draft auto-registers, so it appears in the vivarium-workbench dashboard
151
- (Modules → Processes) marked **DRAFT** with its ports and contract — no code change
152
- needed. Replace it with a real `Process` once the mechanism is committed.
161
+ Fill it (step 3) with a process `find_candidates(core, site)` reports as admissible,
162
+ and build. The full design → inspect → fill → build lifecycle — and the rejection
163
+ report in full — is in
164
+ [docs/concepts/designing-with-holes.md](docs/concepts/designing-with-holes.md).
165
+
166
+ > **Deprecated:** `@draft_process` / `DraftProcess` (an inert placeholder *node*) still
167
+ > work but now emit `DraftProcessDeprecationWarning` — model a draft as a hole instead.
168
+ > `draft_to_contract(cls)` bridges an existing draft's interface to a `ProcessContract`.
153
169
 
154
170
  **3. A template — a composite with an open site (hole).** A template is a document that
155
171
  isn't *ground*: it has open **sites** (`{"_type": "site"}`). `Composite` refuses to run
@@ -184,7 +200,7 @@ def model(rate): # any conforming composite
184
200
  sim = Composite({'state': template_document(core, template, {'study/model': model(0.5)})}, core=core)
185
201
  sim.run(4.0)
186
202
  print(sim.state['study']['verdict']) # pass (a slower model → fail)
187
- # template_document(core, template, {}) → ValueError: not ground — required site 'study/model'
203
+ # template_document(core, template, {}) → UnfilledHoleError: not ground — required site 'study/model'
188
204
  ```
189
205
 
190
206
  **4. An investigation — one site per member study; gating is *filling*.** Fill a
@@ -101,28 +101,44 @@ print(gather_emitter_results(composite))
101
101
  # {('emitter',): [{'level': 1.0, 'time': 0.0}, {'level': 1.5, ...}, ... {'level': 7.59, 'time': 5.0}]}
102
102
  ```
103
103
 
104
- **2. A draft process — a present-but-inert placeholder node.** It declares a contract
105
- (ports + description) but has no `update`, so a composite containing it still runs; the
106
- draft just no-ops. Complementary to a *site* (step 3): a draft is a node that is *there
107
- but inert*, a site is an empty *hole*.
104
+ **2. A draft — an open hole whose sort is a contract.** A not-yet-implemented
105
+ process-slot is a *hole*: an open **site** (step 3) whose `_sort` names a
106
+ `ProcessContract` (its typed face + conditions). You design and review the topology
107
+ with the hole in place, then fill it with any process the contract *admits*.
108
+ `Composite` refuses to build while a required hole is open, and reports **which** hole,
109
+ **what** contract it requires, and **which** registered processes would fill it.
108
110
 
109
111
  ```python
110
- from process_bigraph import DraftProcess, draft_process
111
-
112
- @draft_process(name="PTH secretion",
113
- inputs={'ca_sense': 'float'}, outputs={'pth_out': 'float'},
114
- contract={'summary': 'senses serum Ca, secretes PTH', 'senses': 'calcium', 'makes': 'PTH'})
115
- class PTHSecretion(DraftProcess):
116
- pass
117
-
118
- core.register_link('PTHSecretion', PTHSecretion)
119
- print(PTHSecretion({}, core=core).describe())
120
- # DRAFT — senses serum Ca, secretes PTH · makes: PTH · senses: calcium · status: draft - no update dynamics yet
112
+ from bigraph_schema.contract import ProcessContract
113
+ from process_bigraph import find_candidates, UnfilledHoleError
114
+
115
+ # register the intended interface as a named contract …
116
+ core.register_contract('PTHSecretion', ProcessContract(
117
+ summary='senses serum Ca, secretes PTH',
118
+ face={'inputs': {'ca_sense': 'float'}, 'outputs': {'pth_out': 'float'}}))
119
+
120
+ # … and leave the slot as a hole sorted by it
121
+ template = core.access({'parathyroid': {'ca': 2.5, 'pth': 0.0,
122
+ 'secretion': {'_type': 'site', '_sort': 'PTHSecretion'}}})
123
+
124
+ # Composite(..., unfilled) → UnfilledHoleError, not an opaque KeyError:
125
+ # not ground — required site(s) left unfilled: 'parathyroid/secretion'
126
+ # • parathyroid/secretion
127
+ # requires:
128
+ # inputs: ca_sense: float
129
+ # outputs: pth_out: float
130
+ # candidates:
131
+ # ✓ <any registered process whose contract admits the hole>
121
132
  ```
122
133
 
123
- A module-scope draft auto-registers, so it appears in the vivarium-workbench dashboard
124
- (Modules → Processes) marked **DRAFT** with its ports and contract — no code change
125
- needed. Replace it with a real `Process` once the mechanism is committed.
134
+ Fill it (step 3) with a process `find_candidates(core, site)` reports as admissible,
135
+ and build. The full design → inspect → fill → build lifecycle — and the rejection
136
+ report in full — is in
137
+ [docs/concepts/designing-with-holes.md](docs/concepts/designing-with-holes.md).
138
+
139
+ > **Deprecated:** `@draft_process` / `DraftProcess` (an inert placeholder *node*) still
140
+ > work but now emit `DraftProcessDeprecationWarning` — model a draft as a hole instead.
141
+ > `draft_to_contract(cls)` bridges an existing draft's interface to a `ProcessContract`.
126
142
 
127
143
  **3. A template — a composite with an open site (hole).** A template is a document that
128
144
  isn't *ground*: it has open **sites** (`{"_type": "site"}`). `Composite` refuses to run
@@ -157,7 +173,7 @@ def model(rate): # any conforming composite
157
173
  sim = Composite({'state': template_document(core, template, {'study/model': model(0.5)})}, core=core)
158
174
  sim.run(4.0)
159
175
  print(sim.state['study']['verdict']) # pass (a slower model → fail)
160
- # template_document(core, template, {}) → ValueError: not ground — required site 'study/model'
176
+ # template_document(core, template, {}) → UnfilledHoleError: not ground — required site 'study/model'
161
177
  ```
162
178
 
163
179
  **4. An investigation — one site per member study; gating is *filling*.** Fill a
@@ -14,6 +14,35 @@ def allocate_core(*args, strict=False, **kwargs):
14
14
  """
15
15
  core = _allocate_core(*args, **kwargs)
16
16
  core.strict_config = bool(strict)
17
+ _register_builtin_emitters(core)
18
+ return core
19
+
20
+
21
+ def _register_builtin_emitters(core):
22
+ """Ensure process-bigraph's built-in emitters are registered under their
23
+ SHORT names (``RAMEmitter`` etc.), not only their fully-qualified names.
24
+
25
+ Discovery normally registers both, but when several emitter packages
26
+ co-register in an unlucky import order the short alias is silently dropped
27
+ (see ``process_bigraph.emitter._VIVA_REEXPORTS``) — leaving only the FQN
28
+ ``process_bigraph.emitter.RAMEmitter`` and breaking the framework's own
29
+ default sink ``local:RAMEmitter``. Registering the built-ins explicitly here
30
+ is order-independent and idempotent (we only fill a missing short alias).
31
+ """
32
+ try:
33
+ from process_bigraph.emitter import (
34
+ Emitter, ConsoleEmitter, RAMEmitter, JSONEmitter)
35
+ except Exception:
36
+ return
37
+ registry = getattr(core, 'link_registry', None)
38
+ for cls in (Emitter, ConsoleEmitter, RAMEmitter, JSONEmitter):
39
+ name = cls.__name__
40
+ if registry is not None and name in registry:
41
+ continue
42
+ try:
43
+ core.register_link(name, cls)
44
+ except Exception:
45
+ pass
17
46
  return core
18
47
 
19
48
  # The installed distribution's version, exposed so a run manifest can record
@@ -41,7 +70,16 @@ from process_bigraph.composite_spec import ( # noqa: F401
41
70
  normalize_type, CANONICAL_TYPES,
42
71
  )
43
72
  from process_bigraph.bundle import load_bundle # noqa: F401
44
- from process_bigraph.draft_process import DraftProcess, draft_process # noqa: F401
73
+ from process_bigraph.draft_process import ( # noqa: F401
74
+ DraftProcess, draft_process, draft_to_contract, DraftProcessDeprecationWarning,
75
+ )
76
+ # Holes-in-place: the public lifecycle for a process-slot left as a hole whose
77
+ # sort is a ProcessContract — design, inspect, see what fits, fill, build.
78
+ from process_bigraph.holes import UnfilledHoleError # noqa: F401
79
+ from process_bigraph.templates import ( # noqa: F401
80
+ open_sites, required_open_sites, is_ground_document, fill_template, template_document,
81
+ )
82
+ from bigraph_schema.matching import find_candidates # noqa: F401
45
83
  from process_bigraph.emitter import Emitter, gather_emitter_results, generate_emitter_state # noqa: F401
46
84
  from process_bigraph.types import StepLink, ProcessLink, CompositeLink # noqa: F401
47
85
  from process_bigraph import core_introspection # noqa: F401