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.
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
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/workers-python-ffi-foreign-function-interface-workflow-guide.md | A 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-.text | A 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.text | A 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.text | A 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.text | A 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.text | A 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
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - 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
