Prasar 1.2.1

Last updated:

0 purchases

Prasar 1.2.1 Image
Prasar 1.2.1 Images
Add to Cart

Description:

Prasar 1.2.1

๐ŸŒŸ 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.


Made with โค๏ธ by Abhishek Mishra
โญ Star us on GitHub | ๐Ÿฆ Follow us on Instagram

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.