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
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.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aioredux-1.1.0.tar.gz.
File metadata
- Download URL: aioredux-1.1.0.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2b5f1fce67fe6e65f65a9ae6e1ced0c5d1891e5967666792bf75aa584a336dd
|
|
| MD5 |
723e4f7783532aa56c6b97aa18673ad4
|
|
| BLAKE2b-256 |
6c9f61f46a38830b63f81f21e30e18bbf475451b4efacf8e8def602839ae57b2
|
File details
Details for the file aioredux-1.1.0-py3-none-any.whl.
File metadata
- Download URL: aioredux-1.1.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8c4513a84c0acb97fa888815f335f0b051b9a454ed3f25f843dc9e99dc60360
|
|
| MD5 |
6c6558c63257503cf1fba30615cdcf66
|
|
| BLAKE2b-256 |
5c4dbd47eecef09ea5f3b9f239e08b4b06d835cd9cdcfa34f1c5dca1b0a1065f
|