saturnin.component.apps¶
Saturnin application registration and discovery.
Applications are registered as entry points for their ApplicationDescriptor
- i.e.
the instance of ApplicationDescriptor
for installed service is returned by EntryPoint.load()
.
The entry point group for service registration is saturnin.application
.
Globals¶
- saturnin.component.apps.application_registry: ApplicationRegistry¶
Saturnin application registry
Classes¶
- class saturnin.component.apps.ApplicationInfo(*, uid: UUID, name: str, version: str, vendor: UUID, classification: str, description: str, factory: str, config: str, descriptor: str, distribution: str)[source]¶
Bases:
Distinct
Information about application stored in
ApplicationRegistry
.- Parameters:
uid (UUID) – Application UID
name (str) – Application name
version (str) – Application version
vendor (UUID) – Application vendor UID
classification (str) – Application classification
description (str) – Application description
factory (str) – Application factory specification (entry point)
config (str) – Application configuration factory (entry point)
descriptor (str) – Application descriptor specification (entry point)
distribution (str) – Installed distribution package that contains this application
- as_toml_dict() Dict [source]¶
Returns dictionary with instance data suitable for storage in TOML format (values that are not of basic type are converted to string).
- Return type:
- get_recipe_name() str [source]¶
Returns default recipe name for this application. If application name contains dots, only part after last dot is returned. Otherwise it returns the application name.
- Return type:
- property config_obj: Any¶
Application configuration factory object. If it’s not assigned directly, then it’s loaded using
config
on first access.
- property descriptor_obj: ApplicationDescriptor¶
Application descriptor object. If it’s not assigned directly, then it’s loaded using
descriptor
on first access.
- property factory_obj: Any¶
Application command factory object. If it’s not assigned directly, then it’s loaded using
factory
on first access.
- property set_config_obj: Any¶
Application command factory object. If it’s not assigned directly, then it’s loaded using
factory
on first access.
- property set_descriptor_obj: ApplicationDescriptor¶
Application descriptor object. If it’s not assigned directly, then it’s loaded using
descriptor
on first access.
- class saturnin.component.apps.ApplicationRegistry(data: Mapping | Sequence | Registry = None)[source]¶
Bases:
Registry
Saturnin application registry.
Holds
ApplicationInfo
instances.It is used in two modes:
In full saturnin deployment, the information about applications is loaded from TOML file. Application descriptors and factories are loaded on demand.
In standalone service/bundle mode, application information including app. desciptors and factories is stored directly by executor script, so there is no dynamic discovery and the whole could be compiled with Nutika.
- Parameters:
data (Union[Mapping, Sequence, Registry]) –
- add(descriptor: ApplicationDescriptor, factory: Any, distribution: str) None [source]¶
Direct application registration. Used by systems that does not allow dynamic discovery, for example programs compiled by Nuitka.
- Parameters:
descriptor (ApplicationDescriptor) – Application descriptor
factory (Any) – Application factory
distribution (str) – Distribution package name with application
- Return type:
None
- load() None [source]¶
Read information about installed applications from previously saved TOML file.
- Return type:
None
- load_from_installed(*, ignore_errors: bool = False) None [source]¶
Populate registry from descriptors of installed applications.
- Parameters:
ignore_errors (bool) – When True, errors are ignored, otherwise
Error
is raised.- Return type:
None