Skip to main content

Redux implementation for Python

Project description


Implementation of a Redux store with support for adding feature modules, dynamically. The store exposes a reactive API based on RxPY.

Providing a feature module

Create and export an instance of ReduxFeatureModule for your module. The module definition consists of:

  • a unique module identifier. This identifier is also used as a namespace in the redux state
  • an optional reducer that operates on that namespace
  • an optional epic to handle asynchronous actions
  • an optional list of other feature modules this module depends on


from redux import create_feature_module, ReduxFeatureModule

sample_feature_module: ReduxFeatureModule = create_feature_module(
    'SAMPLE_FEATURE', sample_reducer, sample_epic, [dep1, dep2]

Registering a feature module

Register the feature module with the root store using the add_feature_module method. This will also register all dependent modules in topology order.

from redux import create_store, ReduxRootStore

store: ReduxRootStore = create_store()

Consuming a feature module

Use the select_feature method to create a selector for the desired feature.


from redux import select_feature

select_sample = select_feature(sample_feature)

Side effects in Feature Modules

Feature modules may provide side effects, aka epics, for asynchronous processing. Sometimes such epics require an initialization event to execute bootstrapping logic. The store sends an initialization event for this purpose, after a feature module has been initialized. Use the of_init_feature method to subscribe to this event.


from redux import of_init_feature, Epic
from rx.operators import map

initEpic: Epic = lambda actions_, state_: actions_.pipe(of_init_feature(sample_feature), map(...))

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

redux-py-0.0.1.tar.gz (5.9 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page