github-events 0.1.0__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.
@@ -0,0 +1,37 @@
1
+ Metadata-Version: 2.3
2
+ Name: github-events
3
+ Version: 0.1.0
4
+ Summary: TypedDicts for every GitHub webhook event, with optional pydantic validation and FastAPI dispatch
5
+ Requires-Dist: typing-extensions>=4.12
6
+ Requires-Dist: fastapi>=0.110 ; extra == 'fastapi'
7
+ Requires-Dist: pydantic>=2.0 ; extra == 'fastapi'
8
+ Requires-Dist: pydantic>=2.0 ; extra == 'pydantic'
9
+ Requires-Python: >=3.11
10
+ Provides-Extra: fastapi
11
+ Provides-Extra: pydantic
12
+ Description-Content-Type: text/markdown
13
+
14
+ # github-events
15
+
16
+ Typed GitHub webhook payloads, HMAC signature verification, and event dispatch.
17
+
18
+ ```sh
19
+ pip install github-events
20
+ # Optional payload validation and FastAPI integration:
21
+ pip install 'github-events[fastapi]'
22
+ ```
23
+
24
+ ```python
25
+ import os
26
+ from github_events import WebhookDispatcher
27
+
28
+ hooks = WebhookDispatcher(secret=os.environ["GITHUB_WEBHOOK_SECRET"])
29
+
30
+ @hooks.on("push")
31
+ async def on_push(payload):
32
+ print(payload["ref"])
33
+ ```
34
+
35
+ Pass the raw request body and GitHub webhook headers to the dispatcher, or mount
36
+ its `as_fastapi_router()` in your FastAPI application. The base package depends only on `typing-extensions`. The `pydantic` extra adds validation; the `fastapi` extra
37
+ adds the HTTP integration and validation dependencies.
@@ -0,0 +1,24 @@
1
+ # github-events
2
+
3
+ Typed GitHub webhook payloads, HMAC signature verification, and event dispatch.
4
+
5
+ ```sh
6
+ pip install github-events
7
+ # Optional payload validation and FastAPI integration:
8
+ pip install 'github-events[fastapi]'
9
+ ```
10
+
11
+ ```python
12
+ import os
13
+ from github_events import WebhookDispatcher
14
+
15
+ hooks = WebhookDispatcher(secret=os.environ["GITHUB_WEBHOOK_SECRET"])
16
+
17
+ @hooks.on("push")
18
+ async def on_push(payload):
19
+ print(payload["ref"])
20
+ ```
21
+
22
+ Pass the raw request body and GitHub webhook headers to the dispatcher, or mount
23
+ its `as_fastapi_router()` in your FastAPI application. The base package depends only on `typing-extensions`. The `pydantic` extra adds validation; the `fastapi` extra
24
+ adds the HTTP integration and validation dependencies.
@@ -0,0 +1,28 @@
1
+ [project]
2
+ name = "github-events"
3
+ version = "0.1.0"
4
+ description = "TypedDicts for every GitHub webhook event, with optional pydantic validation and FastAPI dispatch"
5
+ readme = "README.md"
6
+ requires-python = ">=3.11"
7
+ dependencies = ["typing-extensions>=4.12"]
8
+
9
+ [project.optional-dependencies]
10
+ pydantic = ["pydantic>=2.0"]
11
+ fastapi = ["fastapi>=0.110", "pydantic>=2.0"]
12
+
13
+ [dependency-groups]
14
+ dev = [
15
+ "fastapi>=0.110",
16
+ "httpx>=0.28",
17
+ "pydantic>=2.0",
18
+ "pytest>=9.0",
19
+ "pytest-asyncio>=1.4",
20
+ ]
21
+
22
+ [build-system]
23
+ requires = ["uv_build>=0.11,<0.12"]
24
+ build-backend = "uv_build"
25
+
26
+ [tool.pytest.ini_options]
27
+ asyncio_mode = "auto"
28
+ testpaths = ["tests"]
@@ -0,0 +1,42 @@
1
+ """TypedDicts for every GitHub webhook event, plus dispatch.
2
+
3
+ Core (typing-extensions only): the payload TypedDicts (re-exported here), the event
4
+ registry, and WebhookDispatcher (signature verification + routing). Optional
5
+ extras: github-events[pydantic] adds payload validation (used automatically by
6
+ WebhookDispatcher when pydantic is installed); github-events[fastapi] adds a
7
+ mountable endpoint via WebhookDispatcher.as_fastapi_router().
8
+
9
+ Payload types are named `<Event>Event` / `<Event><Action>Event` — PushEvent,
10
+ IssuesOpenedEvent, PullRequestClosedEvent, ... — and each actioned event also
11
+ has a union alias (IssuesEvent = IssuesAssignedEvent | IssuesClosedEvent | ...).
12
+ WebhookEvent unions all of them.
13
+ """
14
+
15
+ from github_events import _models
16
+ from github_events._models import * # noqa: F403 - generated re-export
17
+ from github_events._registry import (
18
+ ACTION_EVENTS,
19
+ ACTION_TYPES,
20
+ EVENT_NAMES,
21
+ EVENT_TYPES,
22
+ EventName,
23
+ WebhookEvent,
24
+ )
25
+ from github_events.dispatch import (
26
+ SignatureVerificationError,
27
+ WebhookDispatcher,
28
+ WebhookError,
29
+ )
30
+
31
+ __all__ = [
32
+ *_models.__all__,
33
+ "ACTION_EVENTS",
34
+ "ACTION_TYPES",
35
+ "EVENT_NAMES",
36
+ "EVENT_TYPES",
37
+ "EventName",
38
+ "SignatureVerificationError",
39
+ "WebhookDispatcher",
40
+ "WebhookError",
41
+ "WebhookEvent",
42
+ ]