Skip to main content

🌟 Prasar Event Handling Framework 🌟

Prasar Logo

PyPI version License: MIT Python Versions

🚀 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

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)

Source distribution for Prasar 1.2.1
File Size Uploaded
prasar-1.2.1.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Prasar 1.2.1
File Interpreter ABI Platform
Prasar-1.2.1-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files

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