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
import asyncio
import aioredux
async 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.
Release files for aioredux 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aioredux-1.1.0.tar.gz | 14.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aioredux-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.6 kB
Release files / aioredux-1.1.0.tar.gz
| Download URL | aioredux-1.1.0.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d2b5f1fce67fe6e65f65a9ae6e1ced0c5d1891e5967666792bf75aa584a336dd
|
|
BLAKE2b-256 checksum How to use checksums |
6c9f61f46a38830b63f81f21e30e18bbf475451b4efacf8e8def602839ae57b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aioredux-1.1.0-py3-none-any.whl
| Download URL | aioredux-1.1.0-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8c4513a84c0acb97fa888815f335f0b051b9a454ed3f25f843dc9e99dc60360
|
|
BLAKE2b-256 checksum How to use checksums |
5c4dbd47eecef09ea5f3b9f239e08b4b06d835cd9cdcfa34f1c5dca1b0a1065f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |