Skip to main content

An event-based framework

Project description

madframe - Functional State-Machine Framework for Python

  • 💢 TypeCheck at runtime (coming soon !)
  • ☮️ Non intruisive
  • 🧰 Functionnal
  • 🕐 Event-Based

Includes

🤖 Autofill

Autofill is the process of automaticaly composing a function usage deduced from the prototype naming and a given context.

from madframe.autofill import autofill

context = {"value": "foo"}
def some_function(value):
    print(value)

await autofill(some_function, args=[], context=context) # notice that we don't pass any argument
> "foo"
# autofill undertand it has to retrieve the value from context if you don't specify it

await autofill(some_function, args["bar"], context=context) # we pass an argument
> "bar"

💁 every madframe decorator uses autofill

🕙 Routine

from madframe.bindings import setup

@setup
def initialize():
    return {"some_key": "foo"}

@routine(1)
def print_foo(some_key):
    print(some_key) # -> prints "foo"

🏗️ Setup

Setup is used to define function to be ran at start-up. Those executions block the start-up and will abort the lauch if they fail.

📝 Perpetuate

perpetuate is autofill but the context is also updated with the result of the function (given it's a dict)

🚩 Wire

from madframe.bindings import wire

something_is_done_when, do_something_when = wire()

fetch = do_something_when(fetch_data)
something_is_done_when(analyze_data)

fetch # is equivalent of `analyze_data(fetch_data)`

Package test pypi python: >3.9

Installation

pip3 install madframe

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

madframe-0.0.1.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

madframe-0.0.1-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file madframe-0.0.1.tar.gz.

File metadata

  • Download URL: madframe-0.0.1.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for madframe-0.0.1.tar.gz
Algorithm Hash digest
SHA256 d7e679f22987d6a40da336b0fa9a6d8f96f8426a47d2640ba7376fec5a74dbfd
MD5 17fb21980a6956c7efb4b04f3de51a9f
BLAKE2b-256 e4501efd6d5ee91b11d9f6feec8347ee4700a73db3a0de05637c8d8c76e4dc67

See more details on using hashes here.

File details

Details for the file madframe-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: madframe-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for madframe-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8cd9c4b8a29d2d73605cdc4832573a68ad00b7db6918b48756a4f0f78329a612
MD5 fb850805b967b205ac7e2264e4e2f40b
BLAKE2b-256 52423d0829ee81bf110015f1624ad6d2ae7fc74d457aeec63251be20d7f4841b

See more details on using hashes here.

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