Pythonic redux
Project description
Pythonic Redux
Pythonic Redux using asyncio. aioredux provides a predictable state container with the following goal: “[Redux] helps you write applications that behave consistently, run in different environments …, and are easy to test” (from the Redux documentation).
Free software: Mozilla Public License
This package requires Python 3.4 or higher
Usage
@asyncio.coroutine() def go(): initial_state = { 'todos': (), } def add_todo(text): return {'type': 'ADD_TODO', 'text': text} def reducer(state, action): if action['type'] == 'ADD_TODO': todos = state['todos'] + (action['text'],) return {'todos': todos} return state store = yield from aioredux.create_store(reducer, initial_state) yield from store.dispatch(add_todo('todo text')) print(store.state['todos') asyncio.get_event_loop().run_until_complete(go())
Implementation notes
dispatch is marked as async although in most cases it functions like a plain Python function returning a Future. This is done to allow for cases where dispatch performs a more complicated set of (async) actions.
A Pythonic version of redux-thunk is also included.
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
Built Distribution
File details
Details for the file aioredux-1.0.1.tar.gz
.
File metadata
- Download URL: aioredux-1.0.1.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b28e6b92216aa5270b118578b5d9921fde593216491d2e3656bbe995671dc2fd |
|
MD5 | 897b1a0ea700c27426e8c6a44850e4f8 |
|
BLAKE2b-256 | 1cb588f53804034b09153c38de7d3d28de51e688cb718f87e97f5b3ff550036f |
File details
Details for the file aioredux-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: aioredux-1.0.1-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4e000913c4543c1942006dd7414b4010f5422a08b96d40f34dac9c7a07b9f49 |
|
MD5 | 2180565e490451cbf05aff8301e7a88e |
|
BLAKE2b-256 | 4ac8b4889265b3ef1bd638c504db627b899650aaa5a4f77d6d0121193e1dd2c7 |