Skip to main content

Framework for Asyncio/Actor/AHSM Run-to-completion Concurrency

Project description


Framework for Asyncio/Actor/AHSM Run-to-completion Concurrency written in Python3. In other words, a cheap knock-off of QP that uses Python3 coroutines. This book describes QP and how to program hierarchical state machines.

This framework has fewer than 1000 LOC. It allows the programmer to create highly-concurrent programs by using a "message-passing" system and run-to-completion message handlers within a state-machine architecture. With these tools, complex, asynchronous operations are decomposed into managable chunks of code.

In the paragraph above message-passing is in quotes because farc is doing object reference copy and not object copy or serialization. This leaves the programmer open to nasty side-effects. For example, if you pass a list object and the recipient modifies the list, the sender experiences those modifications even after the message was passed.

Known Issue: On windows, Ctrl+C is supressed by asyncio event loop's run_forever() (bug report). The workaround is to inject an event to awake the event loop.

Note: This project used to be called "pq" but that name was taken in PyPI, so I renamed to farc (ugh).

Code Repository

Release History

2019/05/15 0.1.1

  • Removed 'initialState' argument from farc.Hsm() constructor; framework now expects Hsm/Ahsm classes to have 'initial()' method.
  • Made state methods private in examples to demonstrate a best-practice.
  • Created farc.Framework.run_forever() helper function.
  • Misc comment and doctring improvements

2018/10/09 0.1.0 Initial release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for farc, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size farc-0.1.1-py3-none-any.whl (14.1 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size farc-0.1.1.tar.gz (10.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page