notifyfork 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- notifyfork-0.1.2/.env.example +46 -0
- notifyfork-0.1.2/.github/workflows/auto-tag.yml +51 -0
- notifyfork-0.1.2/.github/workflows/ci.yml +57 -0
- notifyfork-0.1.2/.github/workflows/publish.yml +51 -0
- notifyfork-0.1.2/.gitignore +15 -0
- notifyfork-0.1.2/CHANGELOG.md +33 -0
- notifyfork-0.1.2/CONTRIBUTING.md +63 -0
- notifyfork-0.1.2/LICENSE +21 -0
- notifyfork-0.1.2/PKG-INFO +599 -0
- notifyfork-0.1.2/README.md +539 -0
- notifyfork-0.1.2/examples/README.md +18 -0
- notifyfork-0.1.2/examples/custom_provider/register_xpto_provider.py +49 -0
- notifyfork-0.1.2/examples/email/send_order_confirmed.py +40 -0
- notifyfork-0.1.2/examples/email/send_sendgrid_external.py +43 -0
- notifyfork-0.1.2/examples/push/send_flash_sale.py +31 -0
- notifyfork-0.1.2/examples/slack/send_system_error.py +34 -0
- notifyfork-0.1.2/examples/sms/send_otp.py +28 -0
- notifyfork-0.1.2/examples/whatsapp/send_order_shipped.py +51 -0
- notifyfork-0.1.2/notifyfork/__init__.py +4 -0
- notifyfork-0.1.2/notifyfork/api/__init__.py +0 -0
- notifyfork-0.1.2/notifyfork/api/urls.py +5 -0
- notifyfork-0.1.2/notifyfork/api/webhooks/__init__.py +0 -0
- notifyfork-0.1.2/notifyfork/api/webhooks/resend_webhook.py +127 -0
- notifyfork-0.1.2/notifyfork/api/webhooks/sendgrid_webhook.py +124 -0
- notifyfork-0.1.2/notifyfork/api/webhooks/tasks.py +74 -0
- notifyfork-0.1.2/notifyfork/api/webhooks/twilio_webhook.py +121 -0
- notifyfork-0.1.2/notifyfork/api/webhooks/urls.py +10 -0
- notifyfork-0.1.2/notifyfork/client.py +63 -0
- notifyfork-0.1.2/notifyfork/core/__init__.py +0 -0
- notifyfork-0.1.2/notifyfork/core/application/__init__.py +0 -0
- notifyfork-0.1.2/notifyfork/core/application/dtos/__init__.py +0 -0
- notifyfork-0.1.2/notifyfork/core/application/dtos/send_notification_dto.py +25 -0
- notifyfork-0.1.2/notifyfork/core/application/interfaces/__init__.py +0 -0
- notifyfork-0.1.2/notifyfork/core/application/interfaces/notification_provider.py +43 -0
- notifyfork-0.1.2/notifyfork/core/application/interfaces/notification_repository.py +15 -0
- notifyfork-0.1.2/notifyfork/core/application/interfaces/template_repository.py +8 -0
- notifyfork-0.1.2/notifyfork/core/application/use_cases/__init__.py +0 -0
- notifyfork-0.1.2/notifyfork/core/application/use_cases/send_notification.py +91 -0
- notifyfork-0.1.2/notifyfork/core/domain/__init__.py +0 -0
- notifyfork-0.1.2/notifyfork/core/domain/entities/__init__.py +0 -0
- notifyfork-0.1.2/notifyfork/core/domain/entities/notification.py +141 -0
- notifyfork-0.1.2/notifyfork/core/domain/events/__init__.py +0 -0
- notifyfork-0.1.2/notifyfork/core/domain/events/notification_events.py +26 -0
- notifyfork-0.1.2/notifyfork/core/domain/value_objects/__init__.py +0 -0
- notifyfork-0.1.2/notifyfork/core/domain/value_objects/template.py +95 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/__init__.py +0 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/apps.py +7 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/container/__init__.py +3 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/container/providers.py +218 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/migrations/0001_initial.py +48 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/migrations/0002_seed_templates.py +116 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/migrations/0003_delivery_status.py +50 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/migrations/__init__.py +0 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/models/__init__.py +6 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/models/notification_model.py +98 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/providers/__init__.py +0 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/providers/firebase_provider.py +69 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/providers/resend_provider.py +83 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/providers/sendgrid_provider.py +150 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/providers/slack_provider.py +108 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/providers/smtp_provider.py +65 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/providers/twilio_provider.py +57 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/providers/whatsapp_provider.py +135 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/queue/__init__.py +0 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/queue/tasks.py +82 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/repositories/__init__.py +0 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/repositories/notification_repository.py +69 -0
- notifyfork-0.1.2/notifyfork/core/infrastructure/repositories/template_repository.py +23 -0
- notifyfork-0.1.2/notifyfork/shared/__init__.py +0 -0
- notifyfork-0.1.2/notifyfork/shared/exceptions/__init__.py +0 -0
- notifyfork-0.1.2/notifyfork/shared/exceptions/provider_exceptions.py +21 -0
- notifyfork-0.1.2/notifyfork/shared/logging/__init__.py +0 -0
- notifyfork-0.1.2/notifyfork/shared/logging/setup.py +38 -0
- notifyfork-0.1.2/notifyfork/shared/utils/__init__.py +0 -0
- notifyfork-0.1.2/pyproject.toml +83 -0
- notifyfork-0.1.2/requirements.txt +17 -0
- notifyfork-0.1.2/tests/__init__.py +0 -0
- notifyfork-0.1.2/tests/conftest.py +247 -0
- notifyfork-0.1.2/tests/integration/__init__.py +0 -0
- notifyfork-0.1.2/tests/unit/__init__.py +0 -0
- notifyfork-0.1.2/tests/unit/api/__init__.py +0 -0
- notifyfork-0.1.2/tests/unit/application/__init__.py +0 -0
- notifyfork-0.1.2/tests/unit/application/test_send_notification_use_case.py +292 -0
- notifyfork-0.1.2/tests/unit/conftest.py +31 -0
- notifyfork-0.1.2/tests/unit/domain/__init__.py +0 -0
- notifyfork-0.1.2/tests/unit/domain/test_notification_entity.py +61 -0
- notifyfork-0.1.2/tests/unit/domain/test_template_value_object.py +134 -0
- notifyfork-0.1.2/tests/unit/providers/__init__.py +0 -0
- notifyfork-0.1.2/tests/unit/providers/test_resend_provider.py +98 -0
- notifyfork-0.1.2/tests/unit/providers/test_sendgrid_provider.py +148 -0
- notifyfork-0.1.2/tests/unit/providers/test_slack_provider.py +72 -0
- notifyfork-0.1.2/tests/unit/providers/test_whatsapp_provider.py +98 -0
- notifyfork-0.1.2/tests/unit/test_client.py +63 -0
- notifyfork-0.1.2/tests/unit/test_container.py +46 -0
- notifyfork-0.1.2/tests/unit/test_custom_provider.py +89 -0
- notifyfork-0.1.2/tests/unit/webhooks/__init__.py +0 -0
- notifyfork-0.1.2/tests/unit/webhooks/test_delivery_status.py +365 -0
- notifyfork-0.1.2/tests/urls.py +10 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Environment variables read by NotifyFork's providers and webhooks.
|
|
2
|
+
# Wire these into your own project's env/settings however you normally do —
|
|
3
|
+
# NotifyFork doesn't ship a settings.py of its own.
|
|
4
|
+
#
|
|
5
|
+
# Only set the ones for the channels you're actually using; providers with
|
|
6
|
+
# missing credentials are skipped at startup (see container/providers.py).
|
|
7
|
+
|
|
8
|
+
# Twilio (SMS + WhatsApp)
|
|
9
|
+
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxx
|
|
10
|
+
TWILIO_AUTH_TOKEN=your_auth_token
|
|
11
|
+
TWILIO_FROM_NUMBER=+15551234567
|
|
12
|
+
TWILIO_WHATSAPP_FROM_NUMBER=+15551234567
|
|
13
|
+
|
|
14
|
+
# SendGrid
|
|
15
|
+
SENDGRID_API_KEY=SG.xxxxxxxxxxxxxxxx
|
|
16
|
+
SENDGRID_FROM_EMAIL=you@yourdomain.com
|
|
17
|
+
SENDGRID_FROM_NAME=Your App
|
|
18
|
+
|
|
19
|
+
# Resend
|
|
20
|
+
RESEND_API_KEY=re_xxxxxxxxxxxxxxxx
|
|
21
|
+
RESEND_FROM_EMAIL=you@yourdomain.com
|
|
22
|
+
RESEND_FROM_NAME=Your App
|
|
23
|
+
|
|
24
|
+
# SMTP (fallback email provider)
|
|
25
|
+
SMTP_HOST=smtp.gmail.com
|
|
26
|
+
SMTP_PORT=465
|
|
27
|
+
SMTP_USERNAME=you@gmail.com
|
|
28
|
+
SMTP_PASSWORD=your_app_password
|
|
29
|
+
SMTP_FROM_EMAIL=you@gmail.com
|
|
30
|
+
|
|
31
|
+
# Firebase (push)
|
|
32
|
+
FIREBASE_CREDENTIALS_PATH=credentials/firebase.json
|
|
33
|
+
|
|
34
|
+
# Slack
|
|
35
|
+
SLACK_BOT_TOKEN=xoxb-your-bot-token
|
|
36
|
+
|
|
37
|
+
# Webhook signature validation — set these on your project's settings.py,
|
|
38
|
+
# read from wherever you like (TWILIO_AUTH_TOKEN above already covers Twilio).
|
|
39
|
+
SENDGRID_WEBHOOK_PUBLIC_KEY=your_pub_key # from SendGrid Event Webhook settings
|
|
40
|
+
RESEND_WEBHOOK_SECRET=whsec_your_signing_secret # from Resend Dashboard → Webhooks
|
|
41
|
+
|
|
42
|
+
# Fallback order when more than one provider supports the same channel
|
|
43
|
+
# (e.g. SendGrid + SMTP for email) — comma-separated provider names, tried
|
|
44
|
+
# in order until one succeeds. Optional; defaults to DEFAULT_PROVIDER_ORDER
|
|
45
|
+
# in container/providers.py if unset.
|
|
46
|
+
NOTIFYFORK_PROVIDER_ORDER=sendgrid_email,resend_email,smtp_email
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Auto Tag
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: write
|
|
9
|
+
actions: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
tag:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Read version from pyproject.toml
|
|
19
|
+
id: version
|
|
20
|
+
run: |
|
|
21
|
+
VERSION=$(grep -m1 '^version = ' pyproject.toml | sed -E 's/version = "(.*)"/\1/')
|
|
22
|
+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
23
|
+
echo "Version: $VERSION"
|
|
24
|
+
|
|
25
|
+
- name: Check if tag already exists
|
|
26
|
+
run: |
|
|
27
|
+
TAG="v${{ steps.version.outputs.version }}"
|
|
28
|
+
if git ls-remote --exit-code --tags origin "refs/tags/$TAG" > /dev/null 2>&1; then
|
|
29
|
+
echo "::error::Tag $TAG already exists on origin. Bump the version in pyproject.toml before merging to main."
|
|
30
|
+
exit 1
|
|
31
|
+
fi
|
|
32
|
+
echo "Tag $TAG does not exist yet — OK to create."
|
|
33
|
+
|
|
34
|
+
- name: Create and push tag
|
|
35
|
+
run: |
|
|
36
|
+
TAG="v${{ steps.version.outputs.version }}"
|
|
37
|
+
git config user.name "github-actions[bot]"
|
|
38
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
39
|
+
git tag -a "$TAG" -m "Release $TAG"
|
|
40
|
+
git push origin "$TAG"
|
|
41
|
+
|
|
42
|
+
- name: Trigger publish workflow
|
|
43
|
+
env:
|
|
44
|
+
GH_TOKEN: ${{ github.token }}
|
|
45
|
+
run: |
|
|
46
|
+
TAG="v${{ steps.version.outputs.version }}"
|
|
47
|
+
# A tag pushed with GITHUB_TOKEN does NOT fire publish.yml's
|
|
48
|
+
# "on: push: tags" trigger (GitHub blocks GITHUB_TOKEN-authored
|
|
49
|
+
# events from cascading, to avoid workflow loops). workflow_dispatch
|
|
50
|
+
# is explicitly exempted from that rule, so we call it directly.
|
|
51
|
+
gh workflow run publish.yml --ref "$TAG"
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches: [main]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
check-version:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Fetch main
|
|
18
|
+
run: git fetch origin main:refs/remotes/origin/main
|
|
19
|
+
|
|
20
|
+
- name: Compare version against main
|
|
21
|
+
run: |
|
|
22
|
+
PR_VERSION=$(grep -m1 '^version = ' pyproject.toml | sed -E 's/version = "(.*)"/\1/')
|
|
23
|
+
MAIN_VERSION=$(git show origin/main:pyproject.toml | grep -m1 '^version = ' | sed -E 's/version = "(.*)"/\1/')
|
|
24
|
+
|
|
25
|
+
echo "PR version: $PR_VERSION"
|
|
26
|
+
echo "main version: $MAIN_VERSION"
|
|
27
|
+
|
|
28
|
+
if [ "$PR_VERSION" = "$MAIN_VERSION" ]; then
|
|
29
|
+
echo "::error::Version in pyproject.toml ($PR_VERSION) is the same as main. Bump it before merging."
|
|
30
|
+
exit 1
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
HIGHEST=$(printf '%s\n%s\n' "$PR_VERSION" "$MAIN_VERSION" | sort -V | tail -n1)
|
|
34
|
+
|
|
35
|
+
if [ "$HIGHEST" != "$PR_VERSION" ]; then
|
|
36
|
+
echo "::error::Version in pyproject.toml ($PR_VERSION) is lower than main ($MAIN_VERSION). Bump it before merging."
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
echo "Version bump OK: $MAIN_VERSION -> $PR_VERSION"
|
|
41
|
+
|
|
42
|
+
test:
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
steps:
|
|
45
|
+
- name: Checkout
|
|
46
|
+
uses: actions/checkout@v4
|
|
47
|
+
|
|
48
|
+
- name: Set up Python
|
|
49
|
+
uses: actions/setup-python@v5
|
|
50
|
+
with:
|
|
51
|
+
python-version: "3.12"
|
|
52
|
+
|
|
53
|
+
- name: Install dependencies
|
|
54
|
+
run: pip install -e ".[dev]"
|
|
55
|
+
|
|
56
|
+
- name: Run tests
|
|
57
|
+
run: pytest
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
# auto-tag.yml pushes the tag using GITHUB_TOKEN, which GitHub excludes
|
|
8
|
+
# from triggering the "push: tags" event above (anti-loop protection).
|
|
9
|
+
# workflow_dispatch is exempt from that rule, so auto-tag.yml calls this
|
|
10
|
+
# explicitly (`gh workflow run publish.yml --ref vX.Y.Z`) after tagging.
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
build:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Set up Python
|
|
21
|
+
uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.12"
|
|
24
|
+
|
|
25
|
+
- name: Install build tool
|
|
26
|
+
run: pip install build
|
|
27
|
+
|
|
28
|
+
- name: Build distribution
|
|
29
|
+
run: python -m build
|
|
30
|
+
|
|
31
|
+
- name: Upload artifact
|
|
32
|
+
uses: actions/upload-artifact@v4
|
|
33
|
+
with:
|
|
34
|
+
name: dist
|
|
35
|
+
path: dist/
|
|
36
|
+
|
|
37
|
+
publish:
|
|
38
|
+
needs: build
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
environment: pypi
|
|
41
|
+
permissions:
|
|
42
|
+
id-token: write
|
|
43
|
+
steps:
|
|
44
|
+
- name: Download artifact
|
|
45
|
+
uses: actions/download-artifact@v4
|
|
46
|
+
with:
|
|
47
|
+
name: dist
|
|
48
|
+
path: dist/
|
|
49
|
+
|
|
50
|
+
- name: Publish to PyPI
|
|
51
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to NotifyFork will be documented here.
|
|
4
|
+
Format based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
5
|
+
|
|
6
|
+
## [Unreleased]
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
- `@notifyfork.provider` decorator to register a custom provider from outside the lib, no `NotificationProvider` subclassing required (duck-typed, same as everything else in the container)
|
|
10
|
+
- `notifyfork.send()`, replacing `send_event()`. You pass `channel`, `template_id` and `notification_type` straight through instead of registering an event type first
|
|
11
|
+
- `examples/custom_provider/register_xpto_provider.py` showing the provider decorator end to end
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
- `examples/email/send_sendgrid_external.py` now actually hits the `order_confirmed_sg` template it documents. Under the old event routing it was silently sharing `order.confirmed`'s rule and sending through `order_confirmed` instead, so the SendGrid Dynamic Template path in that example never really ran
|
|
15
|
+
- `channel` and `notification_type` are plain strings now, not the closed `NotificationChannel` / `NotificationType` enums, all the way through `SendNotificationDTO`, the `Notification` entity and the repository. A provider registered for a channel NotifyFork doesn't ship out of the box (Telegram, say) now works end to end through `notifyfork.send(channel="telegram", ...)` — previously pydantic rejected it before the provider was ever consulted. The enums are still there and still used by the built-in providers, they're just no longer enforced on the way in
|
|
16
|
+
|
|
17
|
+
### Removed
|
|
18
|
+
- `event_router.py`, `EventType` and `EVENT_ROUTING_TABLE`. That layer only translated an `event_type` string into `channel` + `template_id` before queueing, and the queue already accepted those fields directly. Every caller already knows the channel and template it wants, so there was nothing left for the router to decide
|
|
19
|
+
- `send_event()`, replaced by `send()`
|
|
20
|
+
|
|
21
|
+
## [0.1.0] - 2024-06-01
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
- Provider-agnostic notification gateway with event-driven routing
|
|
25
|
+
- Channels: SMS (Twilio), Email (SMTP + SendGrid), WhatsApp (Twilio), Push (Firebase), Slack
|
|
26
|
+
- LOCAL and EXTERNAL template modes with `VariableMapping` for provider-specific variable translation
|
|
27
|
+
- Celery async dispatch with `acks_late`, exponential backoff, and periodic retry sweep
|
|
28
|
+
- Django ORM repositories with full async support (`aupdate_or_create`, `aget`)
|
|
29
|
+
- Dependency container that only registers providers with credentials configured
|
|
30
|
+
- Django migrations with seed data for default templates
|
|
31
|
+
- Full unit test suite with pytest + conftest shared fixtures
|
|
32
|
+
- Runnable examples for every channel
|
|
33
|
+
- Bilingual README (English + Portuguese)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Contributing to NotifyFork
|
|
2
|
+
|
|
3
|
+
First off, thank you for taking the time to contribute! 🎉
|
|
4
|
+
|
|
5
|
+
## Ways to contribute
|
|
6
|
+
|
|
7
|
+
- 🐛 **Report a bug**: open an [issue](https://github.com/marioasaraujo/notifyfork/issues) with steps to reproduce
|
|
8
|
+
- 💡 **Suggest a feature**: open an issue with the `enhancement` label
|
|
9
|
+
- 📖 **Improve documentation**: typos, clarity, translations
|
|
10
|
+
- 🔌 **Add a new provider**: see guide below
|
|
11
|
+
- ✅ **Fix a bug**: check open issues labeled `good first issue`
|
|
12
|
+
|
|
13
|
+
## Development setup
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
git clone https://github.com/marioasaraujo/notifyfork
|
|
17
|
+
cd notifyfork
|
|
18
|
+
python -m venv .venv && source .venv/bin/activate
|
|
19
|
+
pip install -r requirements.txt
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Running tests
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pytest tests/unit -v --cov=notifyfork --cov-report=term-missing
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Coverage must stay above **80%**. PRs that drop coverage will not be merged.
|
|
29
|
+
|
|
30
|
+
## Adding a new provider
|
|
31
|
+
|
|
32
|
+
1. Create `notifyfork/core/infrastructure/providers/your_provider.py`
|
|
33
|
+
2. Extend `NotificationProvider`, implementing `name`, `supported_channels`, `send_with_template`
|
|
34
|
+
3. Register in `notifyfork/core/infrastructure/container/providers.py`
|
|
35
|
+
4. Add tests in `tests/unit/providers/test_your_provider.py`
|
|
36
|
+
5. Add a runnable example in `examples/your_channel/`
|
|
37
|
+
6. Update the channel table in `README.md`
|
|
38
|
+
|
|
39
|
+
## Adding a new kind of notification
|
|
40
|
+
|
|
41
|
+
There's no event catalog. Just add the template via a new migration in
|
|
42
|
+
`notifyfork/core/infrastructure/migrations/`, then call `notifyfork.send(...)`
|
|
43
|
+
with that `template_id` and whatever `channel` it belongs to.
|
|
44
|
+
|
|
45
|
+
## Pull Request checklist
|
|
46
|
+
|
|
47
|
+
- [ ] Tests pass (`pytest tests/unit`)
|
|
48
|
+
- [ ] Coverage ≥ 80%
|
|
49
|
+
- [ ] New provider has at least one example in `examples/`
|
|
50
|
+
- [ ] README updated if a new channel was added
|
|
51
|
+
- [ ] `CHANGELOG.md` updated
|
|
52
|
+
|
|
53
|
+
## Code style
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
ruff check notifyfork tests # lint
|
|
57
|
+
ruff format notifyfork tests # format
|
|
58
|
+
mypy notifyfork # type check
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Questions?
|
|
62
|
+
|
|
63
|
+
Open an issue or reach out directly, see the [README](README.md#contact) for contact info.
|
notifyfork-0.1.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Mario Araujo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|