{"id":13795860,"url":"https://github.com/odd12258053/agraffe","last_synced_at":"2025-05-13T00:30:31.380Z","repository":{"id":43759519,"uuid":"292777452","full_name":"odd12258053/agraffe","owner":"odd12258053","description":"Agraffe, build API with ASGI in Serverless services (e.g AWS lambda, Google Cloud Functions and Azure Functions).","archived":false,"fork":false,"pushed_at":"2023-03-12T06:45:41.000Z","size":325,"stargazers_count":45,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-01T19:11:23.935Z","etag":null,"topics":["asgi","async","asyncio","aws-lambda","azure-functions","fastapi","gcp-cloud-functions","python","python3","serverless","serverless-services","starlette","web"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/odd12258053.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-04T07:15:15.000Z","updated_at":"2024-08-03T23:05:58.984Z","dependencies_parsed_at":"2024-08-03T23:05:58.642Z","dependency_job_id":"846b7651-11eb-4816-871a-97b287bde7c7","html_url":"https://github.com/odd12258053/agraffe","commit_stats":{"total_commits":38,"total_committers":2,"mean_commits":19.0,"dds":0.02631578947368418,"last_synced_commit":"9cd72a5aa1fde01a521ead7b8a8e5fd5804fd7da"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odd12258053%2Fagraffe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odd12258053%2Fagraffe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odd12258053%2Fagraffe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odd12258053%2Fagraffe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/odd12258053","download_url":"https://codeload.github.com/odd12258053/agraffe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225159839,"owners_count":17430190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asgi","async","asyncio","aws-lambda","azure-functions","fastapi","gcp-cloud-functions","python","python3","serverless","serverless-services","starlette","web"],"created_at":"2024-08-03T23:01:03.309Z","updated_at":"2024-11-18T10:30:54.896Z","avatar_url":"https://github.com/odd12258053.png","language":"Python","funding_links":[],"categories":["Async"],"sub_categories":[],"readme":"\n![icon](./resources/icon.png)\n\n[![PyPI version](https://badge.fury.io/py/agraffe.svg)](https://badge.fury.io/py/agraffe)\n![Test](https://github.com/odd12258053/agraffe/workflows/Test/badge.svg)\n\nAgraffe, build API with ASGI in Serverless services (e.g AWS lambda, Google Cloud Functions and Azure Functions).\n\n## Support Services\n- [x] Google Cloud Functions\n  - Python 3.7, 3.8, 3.9, 3.10, 3.11\n- [x] AWS lambda (with API Gateway HTTP API or REST API, or with Function URL)\n  - Python 3.7, 3.8, 3.9\n- [x] Azure Functions\n  - Python 3.7, 3.8, 3.9, 3.10\n\n## Requirements\n\nPython 3.7+\n\n## Installation\n```sh\n$ pip install agraffe\n```\n\n## Example\nCreate it\n\n- Create a file `main.py` with:\n\n```python\nimport contextlib\n\nfrom agraffe import Agraffe\nfrom fastapi import FastAPI, Request\n\n\n@contextlib.asynccontextmanager\nasync def lifespan(app):\n    yield {'message': 'hello'}\n\napp = FastAPI(lifespan=lifespan)\n\n\n@app.get(\"/\")\ndef read_root():\n    return {\"Hello\": \"World\"}\n\n\n@app.get(\"/items/{item_id}\")\ndef read_item(item_id: int, q: str | None = None):\n    return {\"item_id\": item_id, \"q\": q}\n\n\n@app.get(\"/lifespan\")\ndef lifespan_(request: Request):\n    return {\"count\": request.state.message}\n\n\nentry_point = Agraffe.entry_point(app)\n```\n```python\n# or, for on GCP\nfrom agraffe.services.google_cloud_functions import HttpCycle\n\ndef entry_point(request):\n    return Agraffe(app, HttpCycle)(request=request)\n```\n\nDeploy it\n\n- Deploy the api with:\n\n```sh\n$ gcloud functions deploy {FUNCTION NAME} --entry-point entry_point --runtime python310 --trigger-http --allow-unauthenticated\n```\n\nSee `/example` for other services.\n\n## License\nThis project is licensed under the terms of the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fodd12258053%2Fagraffe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fodd12258053%2Fagraffe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fodd12258053%2Fagraffe/lists"}