cloudflare

Integrate Python Cloudflare Workers with FastAPI applications using Wrangler configuration.

11|Updated Apr 4, 2025
One-click install
npx skills add https://github.com/sanand0/scripts --skill cloudflare-sanand0
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cloudflare
Source: https://github.com/sanand0/scripts/tree/main/agents/cloudflare
Command: npx skills add https://github.com/sanand0/scripts --skill cloudflare-sanand0

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill simplifies the complex process of developing, deploying, and integrating Python-based Cloudflare Workers, reducing setup time and common pitfalls. It helps you quickly get your serverless functions running without deep dives into wrangler specifics.

Core Features & Use Cases

  • Python Worker Integration: Seamlessly integrate FastAPI applications into Cloudflare Workers, leveraging existing Python codebases.
  • Dependency Management: Guides on vendoring Python dependencies (uv run pywrangler sync) for efficient deployment.
  • Development Workflow: Provides clear commands for local development (uv run pywrangler dev) and deployment (uv run pywrangler deploy).
  • Use Case: Quickly deploy a Python FastAPI backend as a serverless Cloudflare Worker, handling all the necessary setup and deployment steps automatically, allowing you to focus on your application logic.

Quick Start

Deploy a Python Cloudflare Worker from the current directory.

Frequently Asked Questions about cloudflare

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I deploy a Python FastAPI application as a serverless Cloudflare Worker?

Deploy a Python FastAPI application to Cloudflare Workers by setting up a wrangler.toml configuration, vendoring dependencies with uv, and using wrangler dev for local testing before deploying with wrangler deploy. This runs your FastAPI backend as a serverless endpoint on Cloudflare's global network.

Can I run Python code on Cloudflare Workers?

Yes, Python runs on Cloudflare Workers through Wrangler's Python Worker runtime. You configure a pyproject.toml with dependencies, set compatibility flags in wrangler.toml, and create a Worker entry point that handles requests as an ASGI application or returns JSON responses.

What's the workflow for developing and testing a Python Cloudflare Worker locally?

Develop locally using uv run pywrangler dev to test your Python Worker in a Cloudflare-simulated environment. This lets you iterate on your FastAPI application, manage dependencies, and validate request handling before deploying to production with uv run pywrangler deploy.

How do I manage Python dependencies in a Cloudflare Worker?

Manage Python dependencies by declaring them in pyproject.toml and vendoring them with uv run pywrangler sync. This bundles all required packages into your Worker deployment, ensuring they're available at runtime without external package manager calls.

Does Cloudflare Workers support existing Python frameworks like FastAPI?

Yes, Cloudflare Workers supports FastAPI and other ASGI frameworks. You integrate them by creating a Worker entry point that forwards requests to your ASGI app, allowing you to reuse existing Python codebases and run them serverlessly on Cloudflare's edge network.

What do I need to set up before deploying a Python Worker to Cloudflare?

Before deploying, create a wrangler.toml with Worker configuration and compatibility flags, define a pyproject.toml with your dependencies, establish a Default WorkerEntrypoint function, and test locally with wrangler dev. This ensures your Python runtime, dependencies, and request handling are production-ready.