🌟 Prasar Event Handling Framework 🌟
🚀 Robust, Type-Safe, and Asynchronous Event Handling for Python 🐍
✨ Features
- 🔄 Support for both synchronous and asynchronous events
- 🛡️ Strong type checking for event arguments and return types
- 🌈 Custom logging with colored output
- 🎛️ Easy-to-use API for binding and emitting events
- 🧪 Comprehensive error handling and validation
🛠️ Installation
To install Prasar, simply use pip:
pip install prasar
📚 Dependencies
- Python 3.7+
- colorama
- typing
🚀 Quick Start
from prasar import Prasar
# Create a Prasar instance
prasar = Prasar()
# Define and bind a synchronous event
def greet(name: str) -> str:
return f"Hello, {name}!"
prasar.bind_event("greet", greet, str, return_type=str)
# Emit the event
result = prasar.emit("greet", "Alice")
print(result) # Output: Hello, Alice!
# Define and bind an asynchronous event
async def fetch_data(url: str) -> dict:
# Simulating async operation
return {"data": "Some data from " + url}
prasar.bind_async_event("fetch", fetch_data, str, return_type=dict)
# Emit the async event
import asyncio
result = asyncio.run(prasar.async_emit("fetch", "https://example.com"))
print(result) # Output: {'data': 'Some data from https://example.com'}
🌈 Logging
Prasar includes a custom logging module with colorful output:
from prasar_logger import Logger
logger = Logger("MyLogger").get_logger()
logger.info("✅ This is an info message")
logger.error("❌ This is an error message")
📘 API Reference
Prasar Class
| Method | Description |
|---|---|
| bind_event() | Binds a synchronous event |
| bind_async_event() | Binds an asynchronous event |
| emit() | Emits a synchronous event |
| async_emit() | Emits an asynchronous event |
Logger Class
| Method | Description |
|---|---|
| init() | Initializes a new Logger instance |
| get_logger() | Returns the configured logger object |
For detailed API documentation, please visit our API Reference.
🤝 Contributing
We welcome contributions! Please see our Contribution Guidelines for more details.
📄 License
This project is licensed under the MIT License. See the LICENSE file for details.
🙏 Acknowledgements
- Thanks to all our contributors and users!
- Inspired by various event handling systems in the Python ecosystem.
⭐ Star us on GitHub | 🐦 Follow us on Instagram
Metadata
Release files for Prasar 1.2.1
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 |
|---|---|---|---|---|
| prasar-1.2.1.tar.gz | 7.3 kB | Without provenance | Details for prasar-1.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| Prasar-1.2.1-py3-none-any.whl | Python 3 | none | any | Details for Prasar-1.2.1-py3-none-any.whl |
Total release size: 15.1 kB
Release files / prasar-1.2.1.tar.gz
| Download URL | prasar-1.2.1.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f36ce251e1ec3ee969d0b00e8b08d73ba80fd869c6827a0f845a46a8698bfd1e
|
|
BLAKE2b-256 checksum How to use checksums |
126d92eab6eb61a891a5979cc348f3b52b1ada5cbdf3e178b5e8d72f4a556528
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Release files / Prasar-1.2.1-py3-none-any.whl
| Download URL | Prasar-1.2.1-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ed7f2380612d3339aa7074a54fbe19871c9bca5d7599deeff65fd1c81e7748e
|
|
BLAKE2b-256 checksum How to use checksums |
a6efc7f5ddee2f9401bd4d6f2ae389cc7296fd3e391c0296da89916535a25cd9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Security for Prasar 1.2.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.