{"id":28165540,"url":"https://github.com/alexdemure/gadfastemporal","last_synced_at":"2025-09-04T07:38:04.207Z","repository":{"id":289241586,"uuid":"969932568","full_name":"AlexDemure/gadfastemporal","owner":"AlexDemure","description":"Example repository demonstrating integration of Temporal workflows with FastAPI","archived":false,"fork":false,"pushed_at":"2025-04-26T08:22:35.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"production","last_synced_at":"2025-08-17T00:24:09.837Z","etag":null,"topics":["fastapi-temporal","python-temporal","temporal"],"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/AlexDemure.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,"zenodo":null}},"created_at":"2025-04-21T07:07:11.000Z","updated_at":"2025-04-26T08:22:38.000Z","dependencies_parsed_at":"2025-04-22T09:46:05.310Z","dependency_job_id":"ba85102e-3bab-419b-b288-0ec4c53487a0","html_url":"https://github.com/AlexDemure/gadfastemporal","commit_stats":null,"previous_names":["alexdemure/gadfastemporal"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AlexDemure/gadfastemporal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexDemure%2Fgadfastemporal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexDemure%2Fgadfastemporal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexDemure%2Fgadfastemporal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexDemure%2Fgadfastemporal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexDemure","download_url":"https://codeload.github.com/AlexDemure/gadfastemporal/tar.gz/refs/heads/production","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexDemure%2Fgadfastemporal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273573946,"owners_count":25129882,"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","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["fastapi-temporal","python-temporal","temporal"],"created_at":"2025-05-15T12:11:45.129Z","updated_at":"2025-09-04T07:38:04.176Z","avatar_url":"https://github.com/AlexDemure.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/AlexDemure/gadfastemporal\"\u003e\n    \u003ca href=\"https://ibb.co/8nnQPMQD\"\u003e\u003cimg src=\"https://i.ibb.co/RGGJQ2Jp/logo.png\" alt=\"logo\" border=\"0\"\u003e\u003c/a\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  Example repository demonstrating integration of Temporal workflows with FastAPI\n\u003c/p\u003e\n\n---\n### Temporal Python\n- https://github.com/temporalio/samples-python\n- https://github.com/temporalio/sdk-python\n\n### Installation\n\n```\npip install gadfastemporal\n```\n\n### Usage\n\n```python\nimport contextlib\nimport contextvars\nimport typing\nimport uuid\n\nfrom fastapi import FastAPI\nfrom pydantic import BaseModel\n\nfrom gadfastemporal import Temporal\nfrom gadfastemporal import Workflow\nfrom gadfastemporal import converters\nfrom gadfastemporal import decorators\nfrom gadfastemporal import interceptors\n\ncontextvar = contextvars.ContextVar(\"contextvar\", default=None)\n\nclass Settings(BaseModel):\n    TEMPORAL_HOST: str = \"localhost:7233\"\n    TEMPORAL_NAMESPACE: str = \"default\"\n    TEMPORAL_QUEUE: str = \"my-queue\"\n\n\nsettings = Settings()\n\n\n@decorators.workflow\nclass SimpleWorkflow(Workflow):\n    @staticmethod\n    def id(_: dict) -\u003e str:\n        return str(uuid.uuid4())\n\n    @staticmethod\n    def activities() -\u003e typing.List[typing.Callable]:\n        return [SimpleWorkflow.process]\n\n    @decorators.run\n    async def run(self, command: dict) -\u003e str:\n        return await temporal.activity.sync(self.process, command)\n\n    @staticmethod\n    @decorators.activity\n    async def process(data: dict) -\u003e str:\n        return f\"Processed: {data}\"\n\n\ntemporal = Temporal(\n    host=settings.TEMPORAL_HOST,\n    namespace=settings.TEMPORAL_NAMESPACE,\n    task_queue=settings.TEMPORAL_QUEUE,\n    workflows=[SimpleWorkflow],\n    worker_interceptors=[interceptors.SentryInterceptor()],\n    client_interceptors=[interceptors.ContextPropagationInterceptor(contexts=[contextvar])],\n    data_converter=converters.pydantic,\n    search_attributes=[contextvar],\n)\n\n@contextlib.asynccontextmanager\nasync def lifespan(_: FastAPI):\n    await temporal.start()\n    yield\n    await temporal.shutdown()\n\n\napp = FastAPI(lifespan=lifespan)\n\n@app.post(\"/run\")\nasync def run():\n    data = dict(x=1)\n    contextvar.set({\"Traceparent\": \"12345\"})\n    return await temporal.workflow.sync(SimpleWorkflow, data)\n```\n\nUp containers\n```\ndocker compose -f .compose/docker-compose.yml up -d --build\n```\n\nCreate search-attribute\n```\ntemporal operator search-attribute create --name Traceparent --type Keyword\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexdemure%2Fgadfastemporal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexdemure%2Fgadfastemporal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexdemure%2Fgadfastemporal/lists"}