vivarium-collective / process-bigraph

Apache License 2.0
2 stars 1 forks source link

Improve type system access #37

Closed eagmon closed 9 months ago

eagmon commented 9 months ago

We want more flexible registration of types, like this:

from process_bigraph import core  # rename types as core, to disambiguate from Python types 

def check_sbml(value, bindings, types):
    # Do something to check that the value is a valid SBML file
    return True

sbml_type = {
    '_type': 'string',
    '_check': check_sbml  # allow the check method to pass in
}

core.register('sbml', sbml_type)  # register should work at the top level, like this.

This needs more documentation to help people determine the different function args (for example check methods require value, bindings, types).