Actyon offers an async approach on a multiplexed flux pattern.
Project description
actyon
Action with a Y! Why? Cause
asyncis in the box.
actyon offers an approach on a multiplexed flux pattern using coroutines (PEP 492).
Install
pip install actyon
Documentation
See Documentation
Examples
- Github API (Actyon)
- Counter (Flux)
- Traffic Light (State Machine)
Idea
- An actyon is defining an isolated execution run.
- Producers are called on all combinations of input dependencies.
- Consumers are called on all results at once.
- Dependencies are available in any kind of structure.
- Dependencies are injected according to function signatures.
- Missing dependencies are ignored, unless no producer can be executed.
Implications
- Synchronization points are
- Start
- Conclusion of all producers
- End
- Producers are called asynchronously at once
- Consumers are called asynchronously at once
- Typing is mandatory
- Coroutines for producers and consumers are mandatory
- Python 3.8+ is required
Nerd Section
Great, but who needs this?
First of all, this is an open source project for everybody to use, distribute, adjust or simply carve out whatever you need. For me it's a case study on dependency injection and coroutines, so don't expect this to be a masterpiece.
Are you serious? Python is not Java, we don't need DI.
Aside from answer N° 1, I want to make clear I'm not a java developer getting started with python. I love python and its capabilities. So making python even greater and more accessible to the people is the key to me. Maybe DI is a step towards that, maybe it's not. Still, this code may provide other developers with an idea to accomplish exactly that.
Gotcha. Why did you decide on this approach?
Once you start developing software, you want it to simplify things. That's the whole definition of a software developer by the way: we are lazy by definition. Anyway, this code shows how you can multiplex tasks and sync them on the interface level. Your tasks are executed asynchronously all together, results are gathered and in the end they are being processed further - again, asynchronously all together. The decorator functionality allows for the application of the SOLID principle, which is pretty neat:
- Single-responsibility principle
- Open–closed principle
- Liskov substitution principle
- Interface segregation principle
- Dependency inversion principle
In this code the bottom two are quite shallow and not really applicable, but let's not get stuck with this. Another key feature of the functional interface is the simplicity. Define an action, use the decorators on whatever functions you have and just execute it. It even got a nice console output when you add hook=actyon.DisplayHook() to the Actyon's constructor. Try it out, but caution: parallel actyon execution will break the rendering.
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 actyon-0.3.1.tar.gz.
File metadata
- Download URL: actyon-0.3.1.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4a5b7aa5c383d7979856e90166d2d00e22181c22a778834fbbe4faae429423e
|
|
| MD5 |
294755d419039e22dbe599bfe0709e83
|
|
| BLAKE2b-256 |
fc57c55785c2c427b9ada9db07a2af6e81e5dc7e9cdf9c53643cd44f10326ef7
|
File details
Details for the file actyon-0.3.1-py3-none-any.whl.
File metadata
- Download URL: actyon-0.3.1-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9bc97c0132ef3f9d0893311652986f0796a5e23ad1dafdac1a8a2743f1bd917
|
|
| MD5 |
1ee65f070bf920907a4624706756b594
|
|
| BLAKE2b-256 |
580d4d3f36bd30670e924d2bc170617fece9ca1abb7de6a7a90da05e872e0056
|