Skip to main content

easy-events

A library that help you to manage events

Getting started

  1. Installation
  2. Usages
  3. Code example
  4. Documentation

Installation

pip install easy-events

GitHub : Github

Usages

text

Code example

from easy_events import EasyEvents

# create an event or use it in a class
client = EasyEvents()


# create another event (can be sync or async)
# you can put as much parameters as you want
@client.add_event(aliases="test1")
def test(arg1, arg2, *, arg3):
	# data is the default parameter, it contain some basic informations that you can format as you want
	print(arg1, arg2, arg3)


# trigger the event
client.trigger(data=test1, parameters="arg1 arg2 arg3 arg4")
client.trigger("test1", "arg1 arg2 arg3 arg4")
client.trigger("test1", ["arg1", "arg2", "arg3", "arg4"])
client.trigger("test1", {"arg1": "arg1", "arg2": "arg2", "arg3": ["arg3", "arg4"]})

# dict way
client.trigger({"event": "test1", "parameters": {"arg1": "arg1", "arg2": "arg2", "arg3": ["arg3", "arg4"]}})

# dict way v2
client.trigger({"event": "test", "parameters": ["arg1", "arg2", "arg3", "arg4"]})

# dict way v3
client.trigger({"event": "test1", "parameters": "arg1 arg2 arg3 arg4"})

# list way
client.trigger(["test", "arg1", "arg2", "arg3", "arg4"])

# str way
client.trigger("test arg1 arg2 arg3 arg4")

# the result will be (for all cases):
# arg1 = arg1
# arg2 = arg2
# arg3 = [arg3, arg4]

This library also support type assignation

from easy_events import EasyEvents

client = EasyEvents()


@client.add_event()
def sum(X: int, Y: int):
	return X+Y


client.trigger("sum 5 10")
client.trigger(["sum", "5", 10])
# the result will be 15

Context support

from easy_events import EasyEvents


class CTX:
	def __init__(self, data: int = 0):
		self.data = data


client = EasyEvents(default_context=CTX)
# client = EasyEvents(default_context=CTX(0)) works as well

@client.add_event()
def context(ctx):
	print("ctx.data = ", ctx.data)


client.trigger("context", context=CTX(1))
client.trigger("context")

# this will print :
# "ctx.data = 1"
# "ctx.data = 0"

Metadata

Release files for easy-events 3.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for easy-events 3.1.1
File Size Uploaded Provenance Actions
easy-events-3.1.1.tar.gz 9.2 kB Without provenance Details for easy-events-3.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for easy-events 3.1.1
File Interpreter ABI Platform Actions
easy_events-3.1.1-py3-none-any.whl Python 3 none any Details for easy_events-3.1.1-py3-none-any.whl

Total release size: 20.2 kB

Release files / easy-events-3.1.1.tar.gz

Download URL easy-events-3.1.1.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
74f216ae039a9773a3d2cee4dd7900521c45d82e2921ac87cd8362ffede4774e
BLAKE2b-256 checksum
How to use checksums
45a9a40d8ac9805f9f933465583929b010f1dade3d45b3e66a3c33b17ab9cf18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.11

Release files / easy_events-3.1.1-py3-none-any.whl

Download URL easy_events-3.1.1-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7af8e7f5bd1cfcd62571bcfc5e11a4e096eddbe8480a08e86eba40827cacbd41
BLAKE2b-256 checksum
How to use checksums
2bdd010f8f22623c007cdaeaec4329e8a7feab4a98ad0499684a8d729b15775b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.11

Security for easy-events 3.1.1

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.

Release history Release notifications | RSS feed

This release

3.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page