Skip to content

feat: add asynchronous support to core notifier engines and HTTP providers#481

Open
Harshidpatel12 wants to merge 3 commits into
liiight:mainfrom
Harshidpatel12:main
Open

feat: add asynchronous support to core notifier engines and HTTP providers#481
Harshidpatel12 wants to merge 3 commits into
liiight:mainfrom
Harshidpatel12:main

Conversation

@Harshidpatel12

Copy link
Copy Markdown

Summary

This PR introduces native asynchronous support to the notifiers library, allowing notifications to be sent and resources to be queried asynchronously without blocking the event loop in ASGI/async frameworks (like FastAPI or Sanic).

Core Features Added

  1. Core Async Interface:
    • Added notify_async and fallback handlers to the base Provider and ProviderResource classes, allowing all existing providers to run asynchronously inside the thread pool executor by default.
    • Added a top-level package helper notify_async (exposed in __init__.py).
  2. Dynamic Async Request Wrapper:
    • Implemented AsyncRequestsHelper in notifiers/utils/requests.py using a dynamically imported httpx client to avoid adding heavy mandatory dependencies.
  3. Optional Package Extras:
    • Added async optional dependencies extra to pyproject.toml (pip install notifiers[async]).
  4. Native Async Support for HTTP Providers:
    • Migrated all HTTP-based providers (Slack, Telegram, Gitter, Mailgun, Pushover, Twilio, Zulip, PagerDuty, Pushbullet, DingTalk, VictorOps, PopcornNotify, SimplePush, Notify, Statuspage, and Join) to use native async HTTP calls.
  5. Detailed Documentation:
    • Updated README.md with installation details and async code examples.
  6. Tests:
    • Created a comprehensive async test suite in tests/test_async.py verifying both thread-executor fallback logic and mocked native async HTTP calls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant