Skip to main content

Actyon offers an async approach on a multiplexed flux pattern.

Project description

actyon

Action with a Y! Why? Cause async is in the box.

MIT license Status Python Codecov

Latest Release Open Issues Open PRs

actyon offers an approach on a multiplexed flux pattern using coroutines (PEP 492).

Install

pip install actyon

Documentation

See Documentation

Examples

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

actyon-0.3.1.tar.gz (16.6 kB view hashes)

Uploaded Source

Built Distribution

actyon-0.3.1-py3-none-any.whl (20.6 kB view hashes)

Uploaded Python 3

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