TypedDict and Pydantic models for GitHub webhook payloads.
Project description
github-webhook-types
TypedDict definitions and Pydantic models for GitHub webhook payloads.
The package generates its public payload types from Octokit's machine-readable webhook schema. The schema JSON is not vendored in this repository; generated metadata records the upstream package versions and SHA256 hashes used to create the committed Python modules.
Install
pip install github-webhook-types
Usage
from github_webhook_types import GitHubEventName, parse_delivery
from github_webhook_types.generated.models import IssuesOpenedPayload
from github_webhook_types.generated.typed_dicts import IssuesOpenedPayloadDict
event: GitHubEventName = "issues"
payload = parse_delivery(event, b'{"action": "opened", "repository": {}, "sender": {}, "issue": {}}')
typed_payload: IssuesOpenedPayloadDict = {
"action": "opened",
"repository": {},
"sender": {},
"issue": {},
}
model = IssuesOpenedPayload.model_validate(typed_payload)
parse_delivery() dispatches by X-GitHub-Event and, when present, the payload action. Unknown GitHub fields are accepted by the generated Pydantic models so new fields do not immediately break consumers.
Type Source
Generated payload types come from:
https://unpkg.com/@octokit/webhooks-schemas/schema.jsonhttps://unpkg.com/@octokit/webhooks-examples/api.github.com/index.json
The current source metadata is exported from github_webhook_types.generated._schema_meta.
Development
pdm install
pdm run generate
pdm run quality
pdm run docs:build
pdm run docs:preview
pdm run docs:dev
Use pdm run generate:check to verify that the committed generated files still match the current Octokit schema metadata.
Use pdm run docs:preview to serve the built site/ directory, and pdm run docs:dev for Zensical's live docs server.
License
ISC.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file github_webhook_types-0.0.1a1.tar.gz.
File metadata
- Download URL: github_webhook_types-0.0.1a1.tar.gz
- Upload date:
- Size: 52.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.26.9 CPython/3.14.5 Linux/6.17.0-1013-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d87d146c4936449eb7d83a420f6a29d8edbe902597ee13b5b99dd3d9a8975d41
|
|
| MD5 |
f79c7e8a850b7546ac3eabdc27f8f0de
|
|
| BLAKE2b-256 |
5381f1ccc55a88e0319c52a7b784444b0fb16b97b0412be1c079bd56f784bb82
|
File details
Details for the file github_webhook_types-0.0.1a1-py3-none-any.whl.
File metadata
- Download URL: github_webhook_types-0.0.1a1-py3-none-any.whl
- Upload date:
- Size: 26.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.26.9 CPython/3.14.5 Linux/6.17.0-1013-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
360dde80e7b0313da6e31a01d541c33ace4ab1176d3d8ba93ef9717168dd6878
|
|
| MD5 |
ba5d0ffae3bfbede3ccd55f92ab6fd59
|
|
| BLAKE2b-256 |
62f3eae282a2b5d57f6ddd433f108501c51525a16414910db816019db5c806ff
|