bigraph-schema 0.0.49__tar.gz → 0.0.50__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.

Potentially problematic release.


This version of bigraph-schema might be problematic. Click here for more details.

Files changed (21) hide show
  1. {bigraph-schema-0.0.49/bigraph_schema.egg-info → bigraph-schema-0.0.50}/PKG-INFO +5 -6
  2. {bigraph-schema-0.0.49 → bigraph-schema-0.0.50}/README.md +4 -5
  3. {bigraph-schema-0.0.49 → bigraph-schema-0.0.50}/bigraph_schema/edge.py +5 -0
  4. {bigraph-schema-0.0.49 → bigraph-schema-0.0.50}/bigraph_schema/type_functions.py +8 -4
  5. {bigraph-schema-0.0.49 → bigraph-schema-0.0.50}/bigraph_schema/type_system.py +28 -11
  6. {bigraph-schema-0.0.49 → bigraph-schema-0.0.50}/bigraph_schema/type_system_tests.py +20 -3
  7. {bigraph-schema-0.0.49 → bigraph-schema-0.0.50/bigraph_schema.egg-info}/PKG-INFO +5 -6
  8. {bigraph-schema-0.0.49 → bigraph-schema-0.0.50}/setup.py +1 -1
  9. {bigraph-schema-0.0.49 → bigraph-schema-0.0.50}/AUTHORS.md +0 -0
  10. {bigraph-schema-0.0.49 → bigraph-schema-0.0.50}/LICENSE +0 -0
  11. {bigraph-schema-0.0.49 → bigraph-schema-0.0.50}/bigraph_schema/__init__.py +0 -0
  12. {bigraph-schema-0.0.49 → bigraph-schema-0.0.50}/bigraph_schema/parse.py +0 -0
  13. {bigraph-schema-0.0.49 → bigraph-schema-0.0.50}/bigraph_schema/protocols.py +0 -0
  14. {bigraph-schema-0.0.49 → bigraph-schema-0.0.50}/bigraph_schema/registry.py +0 -0
  15. {bigraph-schema-0.0.49 → bigraph-schema-0.0.50}/bigraph_schema/units.py +0 -0
  16. {bigraph-schema-0.0.49 → bigraph-schema-0.0.50}/bigraph_schema/utilities.py +0 -0
  17. {bigraph-schema-0.0.49 → bigraph-schema-0.0.50}/bigraph_schema.egg-info/SOURCES.txt +0 -0
  18. {bigraph-schema-0.0.49 → bigraph-schema-0.0.50}/bigraph_schema.egg-info/dependency_links.txt +0 -0
  19. {bigraph-schema-0.0.49 → bigraph-schema-0.0.50}/bigraph_schema.egg-info/requires.txt +0 -0
  20. {bigraph-schema-0.0.49 → bigraph-schema-0.0.50}/bigraph_schema.egg-info/top_level.txt +0 -0
  21. {bigraph-schema-0.0.49 → bigraph-schema-0.0.50}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bigraph-schema
3
- Version: 0.0.49
3
+ Version: 0.0.50
4
4
  Summary: A serializable type schema for compositional systems biology
5
5
  Home-page: https://github.com/vivarium-collective/bigraph-schema
6
6
  Author: Eran Agmon, Ryan Spangler
@@ -27,12 +27,11 @@ License-File: AUTHORS.md
27
27
  [![PyPI version](https://img.shields.io/pypi/v/bigraph-schema.svg)](https://pypi.org/project/bigraph-schema/)
28
28
  [![Tutorial](https://img.shields.io/badge/GitHub%20Pages-Tutorial-brightgreen)](https://vivarium-collective.github.io/bigraph-schema/notebooks/demo.html)
29
29
 
30
- Welcome to `bigraph-schema` – a library providing a serializable type schema for compositional systems biology
31
- simulations. This library is an integral component of the broader Process Bigraph project, which seeks to create an
32
- innovative framework for representing, simulating, and analyzing complex biological systems.
30
+ Welcome to `bigraph-schema` – a library providing a serializable type schema for composite systems simulations.
31
+ This library provides the core of the broader Vivarium 2.0 project.
33
32
 
34
- The goal of `bigraph-schema` is to support interoperability and extensibility across compositional modeling,
35
- facilitating seamless integration with existing and future modeling platforms. This is achieved by establishing a
33
+ The goal of `bigraph-schema` is to support interoperability and extensibility across composite simulation formats,
34
+ facilitating integration with existing and future modeling platforms. This is achieved by establishing a
36
35
  standardized and serializable schema for the complex, hierarchical, and multiscale nature of biological systems.
37
36
 
38
37
  ## Installation
@@ -3,12 +3,11 @@
3
3
  [![PyPI version](https://img.shields.io/pypi/v/bigraph-schema.svg)](https://pypi.org/project/bigraph-schema/)
4
4
  [![Tutorial](https://img.shields.io/badge/GitHub%20Pages-Tutorial-brightgreen)](https://vivarium-collective.github.io/bigraph-schema/notebooks/demo.html)
5
5
 
6
- Welcome to `bigraph-schema` – a library providing a serializable type schema for compositional systems biology
7
- simulations. This library is an integral component of the broader Process Bigraph project, which seeks to create an
8
- innovative framework for representing, simulating, and analyzing complex biological systems.
6
+ Welcome to `bigraph-schema` – a library providing a serializable type schema for composite systems simulations.
7
+ This library provides the core of the broader Vivarium 2.0 project.
9
8
 
10
- The goal of `bigraph-schema` is to support interoperability and extensibility across compositional modeling,
11
- facilitating seamless integration with existing and future modeling platforms. This is achieved by establishing a
9
+ The goal of `bigraph-schema` is to support interoperability and extensibility across composite simulation formats,
10
+ facilitating integration with existing and future modeling platforms. This is achieved by establishing a
12
11
  standardized and serializable schema for the complex, hierarchical, and multiscale nature of biological systems.
13
12
 
14
13
  ## Installation
@@ -23,6 +23,11 @@ class Edge:
23
23
  self.config_schema,
24
24
  config)
25
25
 
26
+ # TODO: make generate work here
27
+ # _, self.config = self.core.generate(
28
+ # self.config_schema,
29
+ # config)
30
+
26
31
  self.initialize(self.config)
27
32
 
28
33
 
@@ -1926,15 +1926,19 @@ def generate_map(core, schema, state, top_schema=None, top_state=None, path=None
1926
1926
  schema,
1927
1927
  'value')
1928
1928
 
1929
- # generated_schema = {}
1930
- # generated_state = {}
1931
1929
  # TODO: can we assume this was already sorted at the top level?
1932
-
1933
1930
  generated_schema, generated_state = core.sort(
1934
1931
  schema,
1935
1932
  state)
1936
1933
 
1937
- all_keys = union_keys(schema, state) # set(schema.keys()).union(state.keys())
1934
+ try:
1935
+ all_keys = union_keys(schema, state) # set(schema.keys()).union(state.keys())
1936
+ except Exception as e:
1937
+ # provide the path at which the error occurred
1938
+ raise Exception(
1939
+ f"Error at path {path}:\n"
1940
+ f"Expected schema: {core.representation(schema)}\n"
1941
+ f"Provided state: {state}") from e
1938
1942
 
1939
1943
  for key in all_keys:
1940
1944
  if is_schema_key(key):
@@ -130,6 +130,18 @@ class TypeSystem(Registry):
130
130
  return self
131
131
 
132
132
 
133
+ def update_types(self, type_updates):
134
+ for type_key, type_data in type_updates.items():
135
+ is_update = self.exists(type_key)
136
+
137
+ self.register(
138
+ type_key,
139
+ type_data,
140
+ update=is_update)
141
+
142
+ return self
143
+
144
+
133
145
  def lookup(self, type_key, attribute):
134
146
  return self.access(type_key).get(attribute)
135
147
 
@@ -164,7 +176,8 @@ class TypeSystem(Registry):
164
176
  return registry
165
177
 
166
178
 
167
- def register(self, key, schema, alternate_keys=tuple(), force=False):
179
+ # TODO: explain this method
180
+ def register(self, key, schema, alternate_keys=tuple(), strict=True, update=False):
168
181
  """
169
182
  register the schema under the given key in the registry
170
183
  """
@@ -172,6 +185,13 @@ class TypeSystem(Registry):
172
185
  if isinstance(schema, str):
173
186
  schema = self.find(schema)
174
187
  schema = copy.deepcopy(schema)
188
+ if self.exists(key) and update:
189
+ if update:
190
+ found = self.find(key)
191
+ schema = deep_merge(
192
+ found,
193
+ schema)
194
+ strict = False
175
195
 
176
196
  if '_type' not in schema:
177
197
  schema['_type'] = key
@@ -187,18 +207,10 @@ class TypeSystem(Registry):
187
207
  inherit_type = self.access(inherit)
188
208
  new_schema = copy.deepcopy(inherit_type)
189
209
 
190
- # schema = self.resolve(
191
- # new_schema,
192
- # schema)
193
-
194
210
  schema = self.merge_schemas(
195
211
  new_schema,
196
212
  schema)
197
213
 
198
- # schema = type_merge(
199
- # new_schema,
200
- # schema)
201
-
202
214
  self.inherits[key].append(
203
215
  inherit_type)
204
216
 
@@ -233,7 +245,7 @@ class TypeSystem(Registry):
233
245
  key,
234
246
  schema,
235
247
  alternate_keys,
236
- force)
248
+ strict=strict)
237
249
 
238
250
 
239
251
  def resolve_parameters(self, type_parameters, schema):
@@ -717,6 +729,9 @@ class TypeSystem(Registry):
717
729
  method_function = registry.access(
718
730
  found)
719
731
 
732
+ if method_function is None:
733
+ raise Exception(f'no method "{method_name}" found for state {state} and schema {schema}')
734
+
720
735
  return method_function
721
736
 
722
737
 
@@ -1371,11 +1386,13 @@ class TypeSystem(Registry):
1371
1386
  state,
1372
1387
  'deserialize')
1373
1388
 
1374
- return deserialize_function(
1389
+ deserialized = deserialize_function(
1375
1390
  schema,
1376
1391
  state,
1377
1392
  self)
1378
1393
 
1394
+ return deserialized
1395
+
1379
1396
 
1380
1397
  def fill_ports(self, interface, wires=None, state=None, top_schema=None, top_state=None, path=None):
1381
1398
  # deal with wires
@@ -74,7 +74,7 @@ def test_reregister_type(core):
74
74
  'A', {'_default': 'b'},
75
75
  strict=True)
76
76
 
77
- core.register('A', {'_default': 'b'})
77
+ core.register('A', {'_default': 'b'}, strict=False)
78
78
 
79
79
  assert core.access('A')['_default'] == 'b'
80
80
 
@@ -2262,7 +2262,7 @@ def test_merge(core):
2262
2262
  assert 'D' in top_state
2263
2263
  assert top_schema['D']['_type'] == 'float'
2264
2264
 
2265
- def test_remove_omitted():
2265
+ def test_remove_omitted(core=None):
2266
2266
  result = remove_omitted(
2267
2267
  {'a': {}, 'b': {'c': {}, 'd': {}}},
2268
2268
  {'b': {'c': {}}},
@@ -2273,6 +2273,22 @@ def test_remove_omitted():
2273
2273
  assert 'd' not in result['b']
2274
2274
 
2275
2275
 
2276
+ def test_union_key_error(core):
2277
+ schema = core.access('map[map[float]]')
2278
+ state = {
2279
+ 'a': {'b': 1.1},
2280
+ 'c': {'d': 2.2},
2281
+ 'e': 3.3 # this should be an error
2282
+ }
2283
+ generate_method = core.choose_method(schema, state, 'generate')
2284
+
2285
+ # assert that the Exception is raised
2286
+ with pytest.raises(Exception):
2287
+ result = generate_method(core, schema, state)
2288
+
2289
+
2290
+
2291
+
2276
2292
  if __name__ == '__main__':
2277
2293
  core = TypeSystem()
2278
2294
  core = register_test_types(core)
@@ -2322,4 +2338,5 @@ if __name__ == '__main__':
2322
2338
  test_generate(core)
2323
2339
  test_edge_cycle(core)
2324
2340
  test_merge(core)
2325
- test_remove_omitted()
2341
+ test_remove_omitted(core)
2342
+ test_union_key_error(core)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bigraph-schema
3
- Version: 0.0.49
3
+ Version: 0.0.50
4
4
  Summary: A serializable type schema for compositional systems biology
5
5
  Home-page: https://github.com/vivarium-collective/bigraph-schema
6
6
  Author: Eran Agmon, Ryan Spangler
@@ -27,12 +27,11 @@ License-File: AUTHORS.md
27
27
  [![PyPI version](https://img.shields.io/pypi/v/bigraph-schema.svg)](https://pypi.org/project/bigraph-schema/)
28
28
  [![Tutorial](https://img.shields.io/badge/GitHub%20Pages-Tutorial-brightgreen)](https://vivarium-collective.github.io/bigraph-schema/notebooks/demo.html)
29
29
 
30
- Welcome to `bigraph-schema` – a library providing a serializable type schema for compositional systems biology
31
- simulations. This library is an integral component of the broader Process Bigraph project, which seeks to create an
32
- innovative framework for representing, simulating, and analyzing complex biological systems.
30
+ Welcome to `bigraph-schema` – a library providing a serializable type schema for composite systems simulations.
31
+ This library provides the core of the broader Vivarium 2.0 project.
33
32
 
34
- The goal of `bigraph-schema` is to support interoperability and extensibility across compositional modeling,
35
- facilitating seamless integration with existing and future modeling platforms. This is achieved by establishing a
33
+ The goal of `bigraph-schema` is to support interoperability and extensibility across composite simulation formats,
34
+ facilitating integration with existing and future modeling platforms. This is achieved by establishing a
36
35
  standardized and serializable schema for the complex, hierarchical, and multiscale nature of biological systems.
37
36
 
38
37
  ## Installation
@@ -1,7 +1,7 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
3
 
4
- VERSION = '0.0.49'
4
+ VERSION = '0.0.50'
5
5
 
6
6
 
7
7
  with open("README.md", "r") as readme:
File without changes