Skip to content

Utilities

API for introspection helpers and type namespace registration.

App introspection

scinexus.composable.is_app(obj)

checks whether obj has been decorated by define_app

scinexus.composable.is_app_composable(obj)

checks whether obj has been decorated by define_app and it's app_type attribute is not NON_COMPOSABLE

Type system

scinexus.typing.register_type_namespace(provider)

register a lazy namespace provider for forward-reference resolution

Parameters:

Name Type Description Default
provider Callable[[], dict[str, type]]

a zero-arg callable returning a dict of {name: type}. It is invoked lazily (each time _resolve_name needs a fallback) so downstream packages can defer heavy imports. Providers are responsible for their own caching.

required
Notes

Registration is idempotent: re-registering the same callable is a no-op. Providers are consulted in registration order, and the first provider that yields name wins.

scinexus.typing.SerialisableType

Bases: Protocol

a runtime-checkable protocol for objects that serialise to a dict

Any object that implements a to_rich_dict method returning dict[str, object] satisfies this protocol. Writer apps rely on this to convert results before storing them in a data store -- both DataStoreDirectory and DataStoreSqlite call to_rich_dict() during the write path.

scinexus.typing.IdentifierType = str | Path | DataMemberABC module-attribute

accepted types for identifying members of a data store

A loader app can receive a file path as a string, a pathlib.Path, or a DataMemberABC handle returned by iterating over a data store.

Introspection helpers

scinexus.misc.get_object_provenance(obj)

returns string of complete object provenance

scinexus.misc.in_jupyter()

whether code is being executed within a jupyter notebook