Skip to main content

A simple Python packaging for managing event-like actions and validating handlers argument types.

Project description

Actions-python

Overview

Actions-python is a Python package designed to manage actions with event-driven behavior. It provides a flexible way to connect handlers (callbacks) to actions, ensuring that handler argument types are validated before invocation. This helps maintain strict type consistency while enabling dynamic behavior in event-driven systems.

Features

  • Event-driven architecture: Connect handlers to actions and invoke them when the action is triggered.
  • Type validation: Ensures that handler argument types match the expected types defined when the action is initialized.
  • Dynamic handling: Allows flexible addition of handlers at runtime, each with its own argument type validation.
  • Supports multiple argument types: Can handle multiple types of arguments for a single action.

Installation

To install the project you can use pip:

pip install https://github.com/Allorak/actions-python

Or install from PyPI index:

pip install actions_python

Core ideas

  • Actions: An action is an event that can have one or more handlers (callbacks) connected to it. When the action is triggered, all handlers are invoked with the specified arguments.
  • Handlers: Callbacks that are connected to actions. Each handler should expect arguments of a specific type, which are validated at both the connection stage and the invocation stage.
  • Type validation: When a handler is connected, the types of its arguments are validated to ensure they match the expected types. Similarly, when invoking the action, arguments are validated against the expected types.

Example

Usage examples can be found in examples/ folder

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

actions_python-0.3.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

actions_python-0.3.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file actions_python-0.3.0.tar.gz.

File metadata

  • Download URL: actions_python-0.3.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for actions_python-0.3.0.tar.gz
Algorithm Hash digest
SHA256 0cbc74af7d83d99f9f2a4554cf05ba130d23e1488c09dc5dc23a1515234e4907
MD5 b796b84af5ee2568bba7aa65b80490c0
BLAKE2b-256 fb5f3703c0eb723116a2fee17d5c97d685b768c6729b39ef405ad3f3d71eb166

See more details on using hashes here.

File details

Details for the file actions_python-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: actions_python-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for actions_python-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e28af6ba922fef531f9d7d6746ff500d05b63dd1511ff348be9676f4b1e391cf
MD5 9cc9236509453d198207f501d1723bae
BLAKE2b-256 41adb6208a782d7d0bce736c96d582facec3d9cd428440103e4feba17a59ea8c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page