process-bigraph 1.2.3__tar.gz → 1.3.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 (35) hide show
  1. {process_bigraph-1.2.3/process_bigraph.egg-info → process_bigraph-1.3.1}/PKG-INFO +1 -1
  2. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/composite.py +28 -6
  3. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/processes/parameter_scan.py +1 -1
  4. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/types/process.py +8 -4
  5. {process_bigraph-1.2.3 → process_bigraph-1.3.1/process_bigraph.egg-info}/PKG-INFO +1 -1
  6. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/pyproject.toml +1 -1
  7. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/AUTHORS.md +0 -0
  8. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/LICENSE +0 -0
  9. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/README.md +0 -0
  10. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/__init__.py +0 -0
  11. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/bundle.py +0 -0
  12. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/emitter.py +0 -0
  13. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/experiments/__init__.py +0 -0
  14. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/experiments/minimal_gillespie.py +0 -0
  15. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/nextflow.py +0 -0
  16. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/plumbing.py +0 -0
  17. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/processes/__init__.py +0 -0
  18. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/processes/dynamic_structure.py +0 -0
  19. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/processes/examples.py +0 -0
  20. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/processes/growth_division.py +0 -0
  21. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/processes/math_expression.py +0 -0
  22. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/processes/reaction.py +0 -0
  23. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/protocols/__init__.py +0 -0
  24. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/protocols/parallel.py +0 -0
  25. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/protocols/rest.py +0 -0
  26. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/protocols/socket.py +0 -0
  27. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/run.py +0 -0
  28. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/run_step.py +0 -0
  29. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/types/__init__.py +0 -0
  30. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph/units.py +0 -0
  31. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph.egg-info/SOURCES.txt +0 -0
  32. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph.egg-info/dependency_links.txt +0 -0
  33. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph.egg-info/requires.txt +0 -0
  34. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/process_bigraph.egg-info/top_level.txt +0 -0
  35. {process_bigraph-1.2.3 → process_bigraph-1.3.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: process-bigraph
3
- Version: 1.2.3
3
+ Version: 1.3.1
4
4
  Summary: protocol and execution for compositional systems biology
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -1328,7 +1328,8 @@ class Composite(Process):
1328
1328
  initial_state['global_time'] = 0.0
1329
1329
 
1330
1330
  # Generate internal schema and state structures using the core engine.
1331
- self.schema, self.state = self.core.realize(
1331
+ # Top-level realize: realize_root defaults to () so no merges escape.
1332
+ self.schema, self.state, _ = self.core.realize(
1332
1333
  initial_schema,
1333
1334
  initial_state)
1334
1335
 
@@ -1442,7 +1443,7 @@ class Composite(Process):
1442
1443
  with open(path) as data:
1443
1444
  document = json.load(data)
1444
1445
  return cls(document, core=core)
1445
-
1446
+
1446
1447
  def clean_front(self, state):
1447
1448
  self.find_instance_paths(state)
1448
1449
 
@@ -1497,8 +1498,18 @@ class Composite(Process):
1497
1498
  continue
1498
1499
  if sub_schema is None:
1499
1500
  continue
1500
- new_sub_schema, new_sub_state = self.core.realize(
1501
+ # realize_root defaults to ``path`` so port_merges produced
1502
+ # inside the subtree get applied locally with the prefix
1503
+ # stripped. Merges that escape the subtree (via ``..``
1504
+ # wires) come back as ``escape_merges`` and need to land
1505
+ # in ``self.schema`` at their absolute paths.
1506
+ new_sub_schema, new_sub_state, escape_merges = self.core.realize(
1501
1507
  sub_schema, sub_state, path=tuple(path))
1508
+ if escape_merges:
1509
+ escape_merge_schema = self.core.resolve_merges(
1510
+ {}, escape_merges)
1511
+ self.schema = self.core.resolve(
1512
+ self.schema, escape_merge_schema)
1502
1513
  if not path:
1503
1514
  self.state = new_sub_state
1504
1515
  continue
@@ -1546,8 +1557,19 @@ class Composite(Process):
1546
1557
  continue
1547
1558
  if sub_schema is None:
1548
1559
  continue
1549
- new_sub_schema, new_sub_state = self.core.realize(
1560
+ # realize_root defaults to ``path`` so port_merges produced
1561
+ # inside the new subtree are applied with the prefix
1562
+ # stripped (correct for the local sub_schema). Merges that
1563
+ # escape (e.g. ``..`` wires writing to global fields) come
1564
+ # back as ``escape_merges`` and must land on ``self.schema``
1565
+ # at their absolute paths.
1566
+ new_sub_schema, new_sub_state, escape_merges = self.core.realize(
1550
1567
  sub_schema, sub_state, path=tuple(path))
1568
+ if escape_merges:
1569
+ escape_merge_schema = self.core.resolve_merges(
1570
+ {}, escape_merges)
1571
+ self.schema = self.core.resolve(
1572
+ self.schema, escape_merge_schema)
1551
1573
  # Splice the realized state back at its path. The parent
1552
1574
  # container is a mutable dict (Map keys are dict-keyed at
1553
1575
  # state level), so we rewrite the leaf entry. Schema dicts
@@ -2747,7 +2769,7 @@ class Composite(Process):
2747
2769
  self._merge_paths_pending = []
2748
2770
  else:
2749
2771
  # Fallback: no path info available — full realize.
2750
- self.schema, self.state = self.core.realize(
2772
+ self.schema, self.state, _ = self.core.realize(
2751
2773
  self.schema, self.state)
2752
2774
  self._build_view_project_cache()
2753
2775
 
@@ -2766,7 +2788,7 @@ class Composite(Process):
2766
2788
  # detected an in-process update with no _add/_remove/
2767
2789
  # _divide sentinel). Full realize + rescan is correct
2768
2790
  # here — we don't know which subtrees changed.
2769
- self.schema, self.state = self.core.realize(
2791
+ self.schema, self.state, _ = self.core.realize(
2770
2792
  self.schema, self.state)
2771
2793
  self.find_instance_paths(self.state)
2772
2794
  self._build_view_project_cache()
@@ -78,7 +78,7 @@ class RunProcess(Step):
78
78
  'inputs': {},
79
79
  'outputs': {}}
80
80
 
81
- self.process_schema, self.process = self.core.realize(
81
+ self.process_schema, self.process, _ = self.core.realize(
82
82
  'process', process_state)
83
83
  self.process_instance = self.process['instance']
84
84
 
@@ -315,7 +315,7 @@ def realize(core, schema: SharedProcess, state, path=()):
315
315
  # fields (Quantity, Function, custom types) get reconstructed.
316
316
  config_schema = getattr(cls, 'config_schema', None)
317
317
  if config_schema:
318
- _, config = core.realize(config_schema, config)
318
+ _, config, _ = core.realize(config_schema, config)
319
319
 
320
320
  instance = cls(config)
321
321
 
@@ -323,10 +323,14 @@ def realize(core, schema: SharedProcess, state, path=()):
323
323
  if not hasattr(instance, 'core') or instance.core is None:
324
324
  instance.core = core
325
325
 
326
- # Restore process-internal RandomState if a checkpoint captured one.
326
+ # Restore process-internal RandomState if a checkpoint captured
327
+ # one. Cross-gen daughter loads should strip ``rng_state`` from
328
+ # the saved bundle before construction (so the daughter starts
329
+ # fresh from a freshly-seeded process); mid-tick checkpoints
330
+ # leave it in for bit-for-bit continuation.
327
331
  rng_state = state.get('rng_state')
328
- if rng_state and hasattr(instance, 'random_state') and isinstance(
329
- instance.random_state, np.random.RandomState):
332
+ if (rng_state and hasattr(instance, 'random_state')
333
+ and isinstance(instance.random_state, np.random.RandomState)):
330
334
  try:
331
335
  instance.random_state.set_state((
332
336
  rng_state['alg'],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: process-bigraph
3
- Version: 1.2.3
3
+ Version: 1.3.1
4
4
  Summary: protocol and execution for compositional systems biology
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "process-bigraph"
7
- version = "1.2.3"
7
+ version = "1.3.1"
8
8
  description = "protocol and execution for compositional systems biology"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
File without changes