THE ORIONIS API
Build with clarity.
Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.
class IContainer(ABC): (source)
Known subclasses: orionis.container.container.Container, orionis.IApplication
Undocumented
| Method | begin |
Begin a new scope context manager for scoped services. |
| Method | bound |
Determine if a key is bound in the container or current scope. |
| Async Method | build |
Build and return an instance of the specified type. |
| Async Method | call |
Invoke a method on an object instance with automatic dependency injection. |
| Method | get |
Get the current active scope context for scoped services. |
| Method | instance |
Register an object instance as a singleton in the container. |
| Async Method | invoke |
Invoke a callable with automatic dependency injection. |
| Async Method | make |
Resolve and return a service instance by key. |
| Method | scoped |
Register a scoped service binding. |
| Method | singleton |
Register a singleton service binding. |
| Method | transient |
Register a transient service binding. |
orionis.container.container.ContainerBegin a new scope context manager for scoped services.
| Parameters | |
self:Container | The container instance. |
| Returns | |
ScopeManager | Context manager for managing the lifecycle of scoped services. |
Callable[ ..., Any], *args: tuple[ Any, ...], **kwargs: dict[ str, Any]) -> Any:
(source)
¶
orionis.container.container.ContainerBuild and return an instance of the specified type.
Notes
Resolves deferred providers before attempting instantiation.
| Parameters | |
type_:Callable[..., Any] | The class to instantiate. |
*args:tuple[Any, ...] | Positional arguments for the constructor. |
**kwargs:dict[str, Any] | Keyword arguments for the constructor. |
| Returns | |
Any | Instantiated object of the specified type. |
| Raises | |
TypeError | If the type cannot be auto-resolved by the container. |
object, method_name: str, *args: object, **kwargs: object) -> Any:
(source)
¶
orionis.container.container.ContainerInvoke a method on an object instance with automatic dependency injection.
| Parameters | |
instance:object | The object instance containing the method. |
methodstr | The name of the method to invoke. |
*args:object | Positional arguments for the method. |
**kwargs:object | Keyword arguments for the method. |
| Returns | |
Any | The result of the method invocation with dependencies resolved. |
| Raises | |
AttributeError | If the method is not found on the instance. |
TypeError | If the attribute is not callable. |
orionis.container.container.ContainerGet the current active scope context for scoped services.
Notes
Returns None if there is no active scope. Use beginScope() to create
a new scope context before accessing scoped services.
| Parameters | |
self:Container | The container instance. |
| Returns | |
ScopeManager | None | The current active scope context if available, otherwise None. The scope context is a dictionary-like object that contains instances of scoped services registered in the current scope. |
type[ Any] | None, instance: object, *, alias: str | None = None, override: bool = False) -> bool:
(source)
¶
orionis.container.container.ContainerRegister an object instance as a singleton in the container.
| Parameters | |
abstract:type[Any] | None | The abstract contract class to associate with the instance, or None. |
instance:object | The initialized object to register. |
alias:str | None, optional | An optional alias for the registration. |
override:bool, optional | If True, override any existing registration. |
| Returns | |
bool | True if the instance was registered successfully. |
| Raises | |
TypeError | If the instance is a class, or if type validation fails. |
ValueError | If the alias is invalid or already registered, or if the contract is already registered and override is False. |
Callable[ ..., Any], *args: tuple[ Any, ...], **kwargs: dict[ str, Any]) -> Any:
(source)
¶
orionis.container.container.ContainerInvoke a callable with automatic dependency injection.
| Parameters | |
fn:Callable[..., Any] | The callable to invoke. Must not be a class or type. |
*args:tuple[Any, ...] | Positional arguments for the callable. |
**kwargs:dict[str, Any] | Keyword arguments for the callable. |
| Returns | |
Any | The result of the callable execution with dependencies injected. |
| Raises | |
TypeError | If fn is not a callable or is a class/type. |
type[ Any] | str, *args: tuple[ Any, ...], **kwargs: dict[ str, Any]) -> Any:
(source)
¶
orionis.container.container.ContainerResolve and return a service instance by key.
| Parameters | |
key:type[Any] | str | The abstract type or alias to resolve. |
*args:tuple[Any, ...] | Positional arguments for instantiation. |
**kwargs:dict[str, Any] | Keyword arguments for instantiation. |
| Returns | |
Any | The resolved service instance. |
| Raises | |
ValueError | If the service is not registered and cannot be auto-resolved. |
type[ Any] | None, concrete: type[ Any], *, alias: str | None = None, override: bool = False) -> bool:
(source)
¶
orionis.container.container.ContainerRegister a scoped service binding.
| Parameters | |
abstract:type[Any] | None | The abstract contract type to bind, or None to use the concrete type. |
concrete:type[Any] | The concrete implementation type to register. |
alias:str | None, optional | An optional alias for the service. |
override:bool, optional | Whether to override an existing registration. |
| Returns | |
bool | True if the binding was registered successfully. |
type[ Any] | None, concrete: type[ Any], *, alias: str | None = None, override: bool = False) -> bool:
(source)
¶
orionis.container.container.ContainerRegister a singleton service binding.
| Parameters | |
abstract:type[Any] | None | The abstract contract type to bind, or None to use the concrete type. |
concrete:type[Any] | The concrete implementation type to register. |
alias:str | None, optional | An optional alias for the service. |
override:bool, optional | Whether to override an existing registration. |
| Returns | |
bool | True if the binding was registered successfully. |
type[ Any] | None, concrete: type[ Any], *, alias: str | None = None, override: bool = False) -> bool:
(source)
¶
orionis.container.container.ContainerRegister a transient service binding.
| Parameters | |
abstract:type[Any] | None | The abstract contract type to bind, or None to use the concrete type. |
concrete:type[Any] | The concrete implementation type to register. |
alias:str | None, optional | An optional alias for the service. |
override:bool, optional | Whether to override an existing registration. |
| Returns | |
bool | True if the binding was registered successfully. |