Prompt Buddy logoPrompt Buddy

cloudflare · Cloudflare Workers Docs

Workers Foreign Function Interface (FFI)

Teaches how to use the Pyodide Foreign Function Interface to access Cloudflare bindings, convert Python objects to JavaScript, and import JavaScript globals like Request and Response within a Python Worker.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Workers Foreign Function Interface (FFI)

Teaches how to use the Pyodide Foreign Function Interface to access Cloudflare bindings, convert Python objects to JavaScript, and import JavaScript globals like Request and Response within a Python Worker.

When To Use

Use when you need to access Cloudflare resources like R2 or KV, convert Python data types to JavaScript, or utilize standard JavaScript globals within a Python-based Worker.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/workers-python-ffi-foreign-function-interface-workflow-guide.mdA guide explaining how to use the Foreign Function Interface to access JavaScript bindings and globals from Python Workers via Pyodide.Questions about a guide explaining how to use the Foreign Function Interface to access JavaScript bindings and globals from Python Wo...
examples/workers-python-ffi-foreign-function-interface-cloudflare-workers-python-.textA configuration file demonstrating the setup for Workers Foreign Function Interface using Python.Exact payloads, commands, or snippets shown in A configuration file demonstrating the setup for Workers Foreign Function Interface using Python.
examples/workers-python-ffi-foreign-function-interface-cloudflare-workers-python--2.textA Python script demonstrating the implementation of the Workers Foreign Function Interface (FFI) using a main entry point.Exact payloads, commands, or snippets shown in A Python script demonstrating the implementation of the Workers Foreign Function Interface (FFI) using a main entry p...
examples/workers-python-ffi-foreign-function-interface-cloudflare-workers-python--3.textA Python implementation of a Cloudflare Workers Entrypoint using the WorkerEntrypoint class to handle fetch requests.Exact payloads, commands, or snippets shown in A Python implementation of a Cloudflare Workers Entrypoint using the WorkerEntrypoint class to handle fetch requests.
examples/workers-python-ffi-foreign-function-interface-cloudflare-workers-python--4.textA Python code snippet demonstrating how to use pyodide.ffi.tojs to convert Python dictionaries into JavaScript Objects within a Cloudflare Worker.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to use pyodide.ffi.tojs to convert Python dictionaries into JavaScript Object...
examples/workers-python-ffi-foreign-function-interface-cloudflare-workers-python--5.textA Python code example demonstrating the implementation of a WorkerEntrypoint class for using the Workers Foreign Function Interface.Exact payloads, commands, or snippets shown in A Python code example demonstrating the implementation of a WorkerEntrypoint class for using the Workers Foreign Func...

What This Skill Covers

  • Foreign Function Interface (FFI)
  • Main sections: Using Bindings from Python Workers, Converting Python to JavaScript, Using JavaScript globals from Python Workers.

Workflow

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical source: https://developers.cloudflare.com/workers/languages/python/ffi