本页还没有译文
本页 11 段还没译成简体中文,下面显示的是英文原文。Packages
还没翻译译自英文(developers.cloudflare.com)本页 11 段都还没译
Pywrangler is a CLI tool for managing packages and Python Workers. It is meant as a wrapper for wrangler that sets up a full environment for you, including bundling your packages into your worker bundle on deployment.
To get started, create a pyproject.toml file with the following contents:
[project]
name = "YourProjectName"
version = "0.1.0"
description = "Add your description here"
requires-python = ">=3.13"
dependencies = [
"fastapi"
]
[dependency-groups]
dev = [
"workers-py",
"workers-runtime-sdk"
]The above will allow your worker to depend on the FastAPI package.
To run the worker locally:
uv run pywrangler dev
To deploy your worker:
uv run pywrangler deploy
Your dependencies will get bundled with your worker automatically on deployment.
The pywrangler CLI also supports all commands supported by the wrangler tool, for the full list of commands run uv run pywrangler --help.
Supported Libraries
Python Workers support pure and PyEmscripten Python packages on PyPI. Additionally, Python Workers support packages that are included in Pyodide.
WebAssembly support for Python packages is still in early stages, and some packages may not yet be available as PyEmscripten wheels on PyPI. If a package you would like to use is not yet available, we encourage you to reach out to the package maintainers and request PyEmscripten wheels. You can also start a thread in the Python Packages Discussions on the Cloudflare Workers Runtime GitHub repository — we would be happy to help you communicate with package maintainers.