Metadata-Version: 2.5
Name: render-lab-tasks-cloudflare
Version: 0.1.0
Summary: cloudflare tasks for Render Workflows
Project-URL: Repository, https://github.com/render-lab/render-tasks-python
License-Expression: MIT
License-File: LICENSE
Requires-Python: >=3.12
Requires-Dist: httpx<0.29,>=0.28
Requires-Dist: render-lab-tasks-core<0.2,>=0.1.0
Requires-Dist: render==1.0.1
Description-Content-Type: text/markdown

# render-lab-tasks-cloudflare

Python port of all 7 registered tasks in the pinned TypeScript pack at
`45f9c2d44bd28e01ae9813e0d2ff56ee6c533816`. Python 3.12+.

From the repository, install this pack and its supporting core together:

```sh
pip install render-lab-tasks-cloudflare==0.1.0
```

Import task definitions from `render_lab_tasks_cloudflare.tasks`. Combine its `app` with
other pack apps using `Workflows.from_workflows(...)` and call tasks with
`await ctx.run(task, input)`. Package roots do not register tasks. JSON fields
retain the TS spelling; Python functions use snake_case.

## Tasks

| Registered name | Python export (also exposes `_impl`) |
| --- | --- |
| `cloudflare.deleteDnsRecord` | `delete_dns_record` |
| `cloudflare.deployWorker` | `deploy_worker` |
| `cloudflare.dnsUpsert` | `dns_upsert` |
| `cloudflare.listDnsRecords` | `list_dns_records` |
| `cloudflare.purgeCache` | `purge_cache` |
| `cloudflare.workersKvGet` | `workers_kv_get` |
| `cloudflare.workersKvPut` | `workers_kv_put` |

## Dependencies and retries

Raw implementations accept context first and keyword-only `deps`. The `.client`
module exports typed `Port`, `Deps`, and `Client` classes (also vendor-named aliases).
Inject a fake port, or pass a caller-owned `httpx.AsyncClient` to `Client` for custom
transport/configuration. Default dependencies close their HTTP clients after the
operation. Credentials resolve at first use. HTTP and SDK retries are disabled;
`retry.py` owns durable retry settings. DTO types live in `.types`.

## Environment

| Variable | Contract |
| --- | --- |
| `CLOUDFLARE_API_TOKEN` | Required on API calls. |
| `CLOUDFLARE_ZONE_ID` | Default zone when zoneId is omitted. |
| `CLOUDFLARE_ACCOUNT_ID` | Default account when accountId is omitted. |
| `CLOUDFLARE_KV_NAMESPACE_ID` | Default KV namespace when namespaceId is omitted. |

## Verification and limitations

DNS upsert is a read-then-write operation and is not atomic. Worker upload sends a multipart ES module (`worker.js`) plus JSON metadata, correcting the pinned TS request (ADR-0007). Supply a single JavaScript ES module in `script`. Bindings, assets, routes, and compatibility dates are outside this input surface; Cloudflare applies its default compatibility date. Live Worker validation remains pending. KV GET returns null on 404 and preserves empty text values.

Shared JSON fixtures compare the Python task output with the actual pinned TS
implementation. REST fixtures also compare HTTP requests; HubSpot and Linear
fixtures compare source SDK arguments with HTTP payloads/GraphQL variables.
No live vendor calls were made for this batch. Registered-task parity does not
claim live readiness or all supporting TS exports. See the root verification
tracker and docs/porting-batches.md. Licensed under MIT.
