Welcome to the ReduxPY documentation!¶
Implementation of a Redux store with support for adding feature modules, dynamically. The store exposes a reactive API based on RxPY.
-
class
redux.
Action
(type: str, payload: Any)¶ Action implementation that takes a payload
-
payload
: Any¶ The action action payload
-
-
redux.
Epic
¶ The central part of internal API.
This represents a generic version of type ‘origin’ with type arguments ‘params’. There are two kind of these aliases: user defined and special. The special ones are wrappers around builtin collections and ABCs in collections.abc. These must have ‘name’ always set. If ‘inst’ is False, then the alias can’t be instantiated, this is used by e.g. typing.List and typing.Dict.
alias of Callable[[rx.core.observable.observable.Observable, rx.core.observable.observable.Observable], rx.core.observable.observable.Observable]
-
redux.
Reducer
¶ The central part of internal API.
This represents a generic version of type ‘origin’ with type arguments ‘params’. There are two kind of these aliases: user defined and special. The special ones are wrappers around builtin collections and ABCs in collections.abc. These must have ‘name’ always set. If ‘inst’ is False, then the alias can’t be instantiated, this is used by e.g. typing.List and typing.Dict.
alias of Callable[[StateType, redux._internal.types.Action], StateType]
-
class
redux.
ReduxFeatureModule
(id: str, reducer: Optional[Callable[[StateType, redux._internal.types.Action], StateType]], epic: Optional[Callable[[rx.core.observable.observable.Observable, rx.core.observable.observable.Observable], rx.core.observable.observable.Observable]], dependencies: Iterable[ReduxFeatureModule])¶ Defines the feature module. The ID identifies the section in the state and is also used to globally discriminate features.
After instantiating a feature store the store will fire an initialization action for that feature. Use
of_init_feature()
to register for these initialization actions.-
dependencies
: Iterable[redux._internal.types.ReduxFeatureModule]¶ Dependencies on other feature modules
-
epic
: Optional[Callable[[rx.core.observable.observable.Observable, rx.core.observable.observable.Observable], rx.core.observable.observable.Observable]]¶ Epic that handles module specific asynchronous operations.
-
reducer
: Optional[Callable[[StateType, redux._internal.types.Action], StateType]]¶ Reducer that handles module specific actions.
-
-
class
redux.
ReduxRootStore
(as_observable: Callable[], rx.core.observable.observable.Observable], dispatch: Callable[[redux._internal.types.Action], None], add_feature_module: Callable[[redux._internal.types.ReduxFeatureModule], None], on_next: Callable[[redux._internal.types.Action], None], on_completed: Callable[], None])¶ Implementation of a store that manages sub-state as features. Features are added to the store automatically, when required by the select method.
-
add_feature_module
: Callable[[redux._internal.types.ReduxFeatureModule], None]¶ Adds a new feature module
-
as_observable
: Callable[], rx.core.observable.observable.Observable]¶ Converts the store to an observable of state emissions
-
on_next
: Callable[[redux._internal.types.Action], None]¶ Alias for
dispatch()
-
-
redux.
combine_epics
(*epics)¶ Combines a sequence of epics into one single epic by merging them
-
redux.
combine_reducers
(reducers)¶ Creates a new reducer from a mapping of reducers.
-
redux.
create_action
(type_name)¶ Creates a function that produces an action of the given type
-
redux.
create_feature_module
(identifier, reducer=None, epic=None, dependencies=())¶ Constructs a new feature module descriptor
- Parameters
- Return type
ReduxFeatureModule
- Returns
The feature module descriptor
-
redux.
create_store
(initial_state=None)¶ Constructs a new store that can handle feature modules.
-
redux.
handle_actions
(action_map, initial_state=None)¶ Creates a new reducer from a mapping of action name to reducer for that action.
- Parameters
- Return type
Callable
[[~StateType,Action
], ~StateType]- Returns
A reducer function that handles the actions in the map
-
redux.
of_init_feature
(identifier)¶ Operator to test for the initialization action of a feature
-
redux.
of_type
(type_name)¶ Returns a reactive operator that filters for actions of the given type
-
redux.
select
(selector)¶ Reactive operator that applies a selector and shares the result across multiple subscribers
-
redux.
select_action_payload
(action)¶ Selects the payload from the action
- Parameters
action (
Action
) – the action object- Return type
~PayloadType
- Returns
the payload of the action
-
redux.
select_feature
(identifier, initial_state=None)¶ Returns a function that returns the feature state from the root state