process-bigraph 1.2.2__tar.gz → 1.3.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 (35) hide show
  1. {process_bigraph-1.2.2/process_bigraph.egg-info → process_bigraph-1.3.0}/PKG-INFO +1 -1
  2. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/composite.py +44 -17
  3. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/processes/parameter_scan.py +1 -1
  4. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/types/process.py +1 -1
  5. {process_bigraph-1.2.2 → process_bigraph-1.3.0/process_bigraph.egg-info}/PKG-INFO +1 -1
  6. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/pyproject.toml +1 -1
  7. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/AUTHORS.md +0 -0
  8. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/LICENSE +0 -0
  9. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/README.md +0 -0
  10. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/__init__.py +0 -0
  11. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/bundle.py +0 -0
  12. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/emitter.py +0 -0
  13. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/experiments/__init__.py +0 -0
  14. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/experiments/minimal_gillespie.py +0 -0
  15. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/nextflow.py +0 -0
  16. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/plumbing.py +0 -0
  17. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/processes/__init__.py +0 -0
  18. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/processes/dynamic_structure.py +0 -0
  19. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/processes/examples.py +0 -0
  20. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/processes/growth_division.py +0 -0
  21. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/processes/math_expression.py +0 -0
  22. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/processes/reaction.py +0 -0
  23. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/protocols/__init__.py +0 -0
  24. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/protocols/parallel.py +0 -0
  25. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/protocols/rest.py +0 -0
  26. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/protocols/socket.py +0 -0
  27. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/run.py +0 -0
  28. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/run_step.py +0 -0
  29. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/types/__init__.py +0 -0
  30. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph/units.py +0 -0
  31. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph.egg-info/SOURCES.txt +0 -0
  32. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph.egg-info/dependency_links.txt +0 -0
  33. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph.egg-info/requires.txt +0 -0
  34. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/process_bigraph.egg-info/top_level.txt +0 -0
  35. {process_bigraph-1.2.2 → process_bigraph-1.3.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: process-bigraph
3
- Version: 1.2.2
3
+ Version: 1.3.0
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
 
@@ -1454,11 +1455,11 @@ class Composite(Process):
1454
1455
  - self.process_paths
1455
1456
  - self.step_paths
1456
1457
  """
1457
- # Structural change incoming — drop the compiled-apply cache:
1458
+ # Structural change incoming — drop schema-derived caches:
1458
1459
  # ``apply(dict)`` mutates schemas in place for ``_divide``
1459
- # sentinels, so cached compiled functions may now reference
1460
- # stale schema layouts.
1461
- self.core.invalidate_compiled_apply()
1460
+ # sentinels, so the promote() memo may now key off stale
1461
+ # schema layouts.
1462
+ self.core.invalidate_caches()
1462
1463
  self.process_paths = find_instance_paths(state, 'process_bigraph.composite.Process')
1463
1464
  if hasattr(self, 'step_paths'):
1464
1465
  previous_step_paths = self.step_paths.keys()
@@ -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
@@ -1581,14 +1603,14 @@ class Composite(Process):
1581
1603
  - ``Divided``: drop the mother's entries, scan each daughter
1582
1604
  subtree.
1583
1605
 
1584
- The compiled-apply cache is invalidated unconditionally because
1606
+ Schema-derived caches are invalidated unconditionally because
1585
1607
  ``apply(dict)``'s ``_divide`` branch mutates schemas in place.
1586
1608
 
1587
1609
  Step network rebuild is conditional on step_paths actually
1588
1610
  changing — value-only structural events that don't add/remove
1589
1611
  any Step instances skip the rebuild.
1590
1612
  """
1591
- self.core.invalidate_compiled_apply()
1613
+ self.core.invalidate_caches()
1592
1614
 
1593
1615
  previous_step_paths = (set(self.step_paths.keys())
1594
1616
  if hasattr(self, 'step_paths') else set())
@@ -2695,12 +2717,17 @@ class Composite(Process):
2695
2717
  combined_update,
2696
2718
  update_has_structural=had_structural_sentinels,
2697
2719
  events=structural_events)
2698
- # For structural sentinels, apply may have mutated
2699
- # apply_schema in place (e.g. _divide pops/inserts
2700
- # keys in a dict schema). Propagate back to self.schema
2701
- # so downstream realize sees the split.
2720
+ # For structural sentinels, apply mutates the
2721
+ # access-normalized form of ``apply_schema`` in place
2722
+ # (e.g. ``_divide`` pops the mother key and inserts
2723
+ # daughter keys in a dict subschema). ``apply_schema``
2724
+ # itself is the un-normalized input — it does NOT see
2725
+ # those mutations. Pull the cached normalized form
2726
+ # via ``access`` (cache hit since ``core.apply`` just
2727
+ # populated it) so ``self.schema`` reflects the post-
2728
+ # divide structure for downstream consumers.
2702
2729
  if had_structural_sentinels:
2703
- self.schema = apply_schema
2730
+ self.schema = self.core.access(apply_schema)
2704
2731
 
2705
2732
  if merges:
2706
2733
  had_structural_changes = True
@@ -2742,7 +2769,7 @@ class Composite(Process):
2742
2769
  self._merge_paths_pending = []
2743
2770
  else:
2744
2771
  # Fallback: no path info available — full realize.
2745
- self.schema, self.state = self.core.realize(
2772
+ self.schema, self.state, _ = self.core.realize(
2746
2773
  self.schema, self.state)
2747
2774
  self._build_view_project_cache()
2748
2775
 
@@ -2761,7 +2788,7 @@ class Composite(Process):
2761
2788
  # detected an in-process update with no _add/_remove/
2762
2789
  # _divide sentinel). Full realize + rescan is correct
2763
2790
  # here — we don't know which subtrees changed.
2764
- self.schema, self.state = self.core.realize(
2791
+ self.schema, self.state, _ = self.core.realize(
2765
2792
  self.schema, self.state)
2766
2793
  self.find_instance_paths(self.state)
2767
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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: process-bigraph
3
- Version: 1.2.2
3
+ Version: 1.3.0
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.2"
7
+ version = "1.3.0"
8
8
  description = "protocol and execution for compositional systems biology"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
File without changes