fastgithub


Namefastgithub JSON
Version 0.0.3 PyPI version JSON
download
home_pageNone
SummaryA Python library to supercharge your GitHub organization with bots and webhooks.
upload_time2024-11-24 00:40:27
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseMIT License Copyright (c) 2023 Vincent Duchauffour Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords automation bot ci fastapi github web webhook
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">

# FastGitHub

<table>
  <tr>
    <td>
    </td>
    <td>
    </td>
  </tr>
  <tr>
    <td>
      CI/CD
    </td>
    <td>
      <a href="https://github.com/VDuchauffour/fastgithub/actions/workflows/ci.yml">
        <img src="https://github.com/VDuchauffour/fastgithub/actions/workflows/ci.yml/badge.svg" alt="CI Pipeline">
      </a>
      <a href="https://github.com/VDuchauffour/fastgithub/actions/workflows/release.yml">
        <img src="https://github.com/VDuchauffour/fastgithub/actions/workflows/release.yml/badge.svg" alt="Release">
      </a>
      <a href="https://codecov.io/gh/VDuchauffour/fastgithub">
        <img src="https://codecov.io/gh/VDuchauffour/fastgithub/branch/main/graph/badge.svg" alt="Codecov">
      </a>
    </td>
  </tr>
  <tr>
    <td>
        Meta
    </td>
    <td>
      <a href="https://github.com/astral-sh/ruff">
        <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json" alt="Ruff">
      </a>
      <a href="https://github.com/pre-commit/pre-commit">
        <img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit" alt="Pre-commit">
      </a>
      <a href="https://spdx.org/licenses/">
        <img src="https://img.shields.io/github/license/VDuchauffour/fastgithub?color=blueviolet" alt="License">
      </a>
    </td>
  </tr>
  <tr>
    <td>
        Package
    </td>
    <td>
      <a href="https://pypi.org/project/fastgithub/">
        <img src="https://img.shields.io/pypi/pyversions/fastgithub.svg?logo=python&label=Python&logoColor=gold" alt="PyPI - Python version">
      </a>
      <a href="https://pypi.org/project/fastgithub/">
        <img src="https://img.shields.io/pypi/v/fastgithub.svg?logo=pypi&label=PyPI&logoColor=gold" alt="PyPI - Version">
      </a>
    </td>
  </tr>
</table>

</div>

______________________________________________________________________

## About this project

FastGitHub provides a GitHub webhooks handler for FastAPI to automate your workflows.

FastGitHub also provides sets of automations (named _recipes_).

## ️️⚙️ Installation

Install the package from the PyPI registry.

```shell
pip install fastgithub
```

## ⚡ Usage

### Example

```python
from typing import Any
import uvicorn
from fastapi import FastAPI
from fastgithub import GithubWebhookHandler, SignatureVerificationSHA256, webhook_router

signature_verification = SignatureVerificationSHA256(secret="mysecret")
webhook_handler = GithubWebhookHandler(signature_verification)


@webhook_handler.listen("push")
def hello(data: dict[str, Any]):
    print(f"Hello from: {data['repository']}")


app = FastAPI()
router = webhook_router(handler=webhook_handler, path="/postreceive")
app.include_router(router)

if __name__ == "__main__":
    uvicorn.run(app)
```

You can also fill a list of functions for a specific event to the handler:

```python
def hello(data: dict[str, Any]):
    print(f"Hello from: {data['repository']}")


def bye(data: dict[str, Any]):
    print(f"Goodbye from: {data['repository']}")


webhook_handler.listen("push", [hello, bye])
```

## ⛏️ Development

In order to install all development dependencies, run the following command:

```shell
uv sync
```

To ensure that you follow the development workflow, please setup the pre-commit hooks:

```shell
uv run pre-commit install
```

## Acknowledgements

Initial ideas and designs are inspired by [python-github-webhook](https://github.com/bloomberg/python-github-webhook) and [python-github-bot-api](https://github.com/NiklasRosenstein/python-github-bot-api/)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "fastgithub",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "automation, bot, ci, fastapi, github, web, webhook",
    "author": null,
    "author_email": "Vincent Duchauffour <vincent.duchauffour@proton.me>",
    "download_url": "https://files.pythonhosted.org/packages/d1/65/02b10d0c804691691dbe433a502580562cb2d644496ee3b65c8cca63290a/fastgithub-0.0.3.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n\n# FastGitHub\n\n<table>\n  <tr>\n    <td>\n    </td>\n    <td>\n    </td>\n  </tr>\n  <tr>\n    <td>\n      CI/CD\n    </td>\n    <td>\n      <a href=\"https://github.com/VDuchauffour/fastgithub/actions/workflows/ci.yml\">\n        <img src=\"https://github.com/VDuchauffour/fastgithub/actions/workflows/ci.yml/badge.svg\" alt=\"CI Pipeline\">\n      </a>\n      <a href=\"https://github.com/VDuchauffour/fastgithub/actions/workflows/release.yml\">\n        <img src=\"https://github.com/VDuchauffour/fastgithub/actions/workflows/release.yml/badge.svg\" alt=\"Release\">\n      </a>\n      <a href=\"https://codecov.io/gh/VDuchauffour/fastgithub\">\n        <img src=\"https://codecov.io/gh/VDuchauffour/fastgithub/branch/main/graph/badge.svg\" alt=\"Codecov\">\n      </a>\n    </td>\n  </tr>\n  <tr>\n    <td>\n        Meta\n    </td>\n    <td>\n      <a href=\"https://github.com/astral-sh/ruff\">\n        <img src=\"https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json\" alt=\"Ruff\">\n      </a>\n      <a href=\"https://github.com/pre-commit/pre-commit\">\n        <img src=\"https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit\" alt=\"Pre-commit\">\n      </a>\n      <a href=\"https://spdx.org/licenses/\">\n        <img src=\"https://img.shields.io/github/license/VDuchauffour/fastgithub?color=blueviolet\" alt=\"License\">\n      </a>\n    </td>\n  </tr>\n  <tr>\n    <td>\n        Package\n    </td>\n    <td>\n      <a href=\"https://pypi.org/project/fastgithub/\">\n        <img src=\"https://img.shields.io/pypi/pyversions/fastgithub.svg?logo=python&label=Python&logoColor=gold\" alt=\"PyPI - Python version\">\n      </a>\n      <a href=\"https://pypi.org/project/fastgithub/\">\n        <img src=\"https://img.shields.io/pypi/v/fastgithub.svg?logo=pypi&label=PyPI&logoColor=gold\" alt=\"PyPI - Version\">\n      </a>\n    </td>\n  </tr>\n</table>\n\n</div>\n\n______________________________________________________________________\n\n## About this project\n\nFastGitHub provides a GitHub webhooks handler for FastAPI to automate your workflows.\n\nFastGitHub also provides sets of automations (named _recipes_).\n\n## \ufe0f\ufe0f\u2699\ufe0f Installation\n\nInstall the package from the PyPI registry.\n\n```shell\npip install fastgithub\n```\n\n## \u26a1 Usage\n\n### Example\n\n```python\nfrom typing import Any\nimport uvicorn\nfrom fastapi import FastAPI\nfrom fastgithub import GithubWebhookHandler, SignatureVerificationSHA256, webhook_router\n\nsignature_verification = SignatureVerificationSHA256(secret=\"mysecret\")\nwebhook_handler = GithubWebhookHandler(signature_verification)\n\n\n@webhook_handler.listen(\"push\")\ndef hello(data: dict[str, Any]):\n    print(f\"Hello from: {data['repository']}\")\n\n\napp = FastAPI()\nrouter = webhook_router(handler=webhook_handler, path=\"/postreceive\")\napp.include_router(router)\n\nif __name__ == \"__main__\":\n    uvicorn.run(app)\n```\n\nYou can also fill a list of functions for a specific event to the handler:\n\n```python\ndef hello(data: dict[str, Any]):\n    print(f\"Hello from: {data['repository']}\")\n\n\ndef bye(data: dict[str, Any]):\n    print(f\"Goodbye from: {data['repository']}\")\n\n\nwebhook_handler.listen(\"push\", [hello, bye])\n```\n\n## \u26cf\ufe0f Development\n\nIn order to install all development dependencies, run the following command:\n\n```shell\nuv sync\n```\n\nTo ensure that you follow the development workflow, please setup the pre-commit hooks:\n\n```shell\nuv run pre-commit install\n```\n\n## Acknowledgements\n\nInitial ideas and designs are inspired by [python-github-webhook](https://github.com/bloomberg/python-github-webhook) and [python-github-bot-api](https://github.com/NiklasRosenstein/python-github-bot-api/)\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Vincent Duchauffour  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "A Python library to supercharge your GitHub organization with bots and webhooks. ",
    "version": "0.0.3",
    "project_urls": {
        "Documentation": "https://github.com/VDuchauffour/fastgithub",
        "Homepage": "https://github.com/VDuchauffour/fastgithub"
    },
    "split_keywords": [
        "automation",
        " bot",
        " ci",
        " fastapi",
        " github",
        " web",
        " webhook"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e54d2c9867da3c247c694320e0cfb013c05e38219fc1d63b580b4bfb6cb40597",
                "md5": "632543b9b6eee3895e742c9116c023c5",
                "sha256": "9af8c0f5e82a35d9f9699abd7fb39ba4622710400e7931fbff0d8cf9003cb3ad"
            },
            "downloads": -1,
            "filename": "fastgithub-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "632543b9b6eee3895e742c9116c023c5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 8122,
            "upload_time": "2024-11-24T00:40:26",
            "upload_time_iso_8601": "2024-11-24T00:40:26.287025Z",
            "url": "https://files.pythonhosted.org/packages/e5/4d/2c9867da3c247c694320e0cfb013c05e38219fc1d63b580b4bfb6cb40597/fastgithub-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d16502b10d0c804691691dbe433a502580562cb2d644496ee3b65c8cca63290a",
                "md5": "1b9e4efb931baa244327277e64a48864",
                "sha256": "b486a8db578d222cb8de63ea6aee75ce79bc0b9296055e592342538a9ac1348c"
            },
            "downloads": -1,
            "filename": "fastgithub-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "1b9e4efb931baa244327277e64a48864",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 57602,
            "upload_time": "2024-11-24T00:40:27",
            "upload_time_iso_8601": "2024-11-24T00:40:27.618488Z",
            "url": "https://files.pythonhosted.org/packages/d1/65/02b10d0c804691691dbe433a502580562cb2d644496ee3b65c8cca63290a/fastgithub-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-24 00:40:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "VDuchauffour",
    "github_project": "fastgithub",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "fastgithub"
}
        
Elapsed time: 2.00477s