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.
Usage
For creating an action initialize a variable of Action type and specify types of action's params
from actions import Action
class Test:
def __init__(self):
self.example_action = Action(int, str)
def fire(self):
self.example_action.invoke(0, "test")
def print_callback(number: int, text: str):
print(f"Number: {number} | Text: {text}")
test = Test()
test.example_action.connect(print_callback)
test.fire()
Example
Usage examples can be found in examples/ folder
Metadata
Release files for actions-python 0.7.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| actions_python-0.7.5.tar.gz | 8.9 kB | Without provenance | Details for actions_python-0.7.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| actions_python-0.7.5-py3-none-any.whl | Python 3 | none | any | Details for actions_python-0.7.5-py3-none-any.whl |
Total release size: 19.3 kB
Release files / actions_python-0.7.5.tar.gz
| Download URL | actions_python-0.7.5.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a1b88f86ae93c5690dd5cefe5557224747ca33643e36d56494ae9f458363797b
|
|
BLAKE2b-256 checksum How to use checksums |
c8e45b4c69ff0b7519be60c81ecd9ac54e10e80219fdee79654fa253e392966a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.13
|
Release files / actions_python-0.7.5-py3-none-any.whl
| Download URL | actions_python-0.7.5-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
731e26336575dae022cb781cb4a28b232e6f33a4ebf61e4d170ab6a4822147a2
|
|
BLAKE2b-256 checksum How to use checksums |
fb8989e6c8b509810e7af8f295c3084704d0aa4c490ebb2216fbaf792edacfc1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.13
|
Security for actions-python 0.7.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.