Fastly Compute Python SDK
Experimental Python SDK for Fastly Compute services.
Highlights
- Support for WSGI Frameworks. Flask and Bottle examples are included for reference.
- Access from Python to Fastly's API
- Full type hints and IDE support
Quick Start
Install Dependencies
To work with fastly-compute in Python, you must install two system dependencies:
- The Fastly CLI.
- The uv Python package manager.
Additional dependencies, including the Python SDK for compute and build tooling, will be installed and managed by uv in an isolated environment.
Set Up Your Project
For this basic project, we'll use the Flask microframework. We will create our project and add the SDK and build tooling by adding fastly-compute and flask:
$ uv init my-compute-service
...
$ cd my-compute-service
$ uv add fastly-compute flask
...
Write Your Service
uv init automatically creates a main.py file in your project directory. Replace its contents with the following Flask application code:
import platform
from flask import Flask
from fastly_compute.wsgi import WsgiHttpIncoming
app = Flask(__name__)
@app.route("/")
def index():
version = platform.python_version()
return f"Hello from Python {version} on Fastly Compute!"
HttpIncoming = WsgiHttpIncoming(app)
Configure Compute Service Entry Point
The fastly-compute-py build tool, provided as part of the fastly-compute package, needs to be told about the module containing the compute service we just created. We can do this by modifying the pyproject.toml as follows:
# Add to end of pyproject.toml
[tool.fastly-compute]
entry = "main"
Then, let's do a quick test to make sure we are able to build a WebAssembly (Wasm) component:
$ uv run fastly-compute-py build
Building Python application for Fastly Compute...
Entry point: main
Output: bin/main.wasm
Resolving Python dependencies...
Componentizing Python application...
Composing final WebAssembly module...
Injecting Fastly metadata...
✓ Build complete: bin/main.wasm
Test and Deploy Your Service Using the Fastly CLI
Now that we have the skeleton of our service, let's test it using the Fastly CLI.
-
Run
fastly compute init -
Say yes when warned "The current directory isn't empty." Answer "Other" when it asks for Language.
-
Add this to the bottom of
fastly.toml:[scripts] build = "uv run fastly-compute-py build"
With that in place, we can now run fastly compute serve to test our service locally. When you're ready, you can use the Fastly CLI to deploy the service to the production fleet and perform other actions.
See the examples/ directory for more examples.
Run Some Examples on Your Own Machine
We ship a few simple examples you can run locally to get a taste of what's possible.
Status
Currently supports...
- Building pure Python into WebAssembly components
- Creating Python bindings from Fastly's WIT files
- Hosting web frameworks by adapting Fastly's API to WSGI
- Hosting non-WSGI applications by writing directly against Fastly's API
Caveats
- So our memory-snapshotting build process can retain them, all the packages
needed at runtime must get imported when your entrypoint (e.g.
flask-app.py) is imported. This can happen transitively. But beware of deferred imports like non-top-level ones; if they aren't triggered by importing your entrypoint, they will fail at runtime. (If you have third-party code that uses non-top-level imports, you can ensure they work by importing them at the top level in your own code.) - Third-party C extension modules are not yet supported.
- Our in-Python API may change backward-incompatibly during this beta period.
Contributing
See CONTRIBUTING.md.
Release files for fastly-compute 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastly_compute-0.1.3.tar.gz | 116.3 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| fastly_compute-0.1.3-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details |
| fastly_compute-0.1.3-cp312-abi3-manylinux_2_28_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| fastly_compute-0.1.3-cp312-abi3-manylinux_2_28_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| fastly_compute-0.1.3-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details |
| fastly_compute-0.1.3-cp312-abi3-macosx_10_15_x86_64.whl | CPython 3.12 | abi3 | macOS 10.15+ x86-64 | Details |
Total release size: 88.6 MB
Release files / fastly_compute-0.1.3.tar.gz
| Download URL | fastly_compute-0.1.3.tar.gz |
|---|---|
| Size | 116.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3b30b41da695d2c1e6870693b113d2f8d3732800b09f10fe0959f3af474dea55
|
|
BLAKE2b-256 checksum How to use checksums |
e66f45555c261f85199e8ac6ad7b71d20af975be51cae4c9bb446b11a50b3cac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.
Transparency logRelease files / fastly_compute-0.1.3-cp312-abi3-win_amd64.whl
| Download URL | fastly_compute-0.1.3-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 16.3 MB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
44e25fdc6671c9d232c45c1141a2e9df8fd7220f4fffa5dabd1b2347780b6ebb
|
|
BLAKE2b-256 checksum How to use checksums |
263877fc347040778911fca54776c1e304971043a390fe622bed105554303a01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.
Transparency logRelease files / fastly_compute-0.1.3-cp312-abi3-manylinux_2_28_x86_64.whl
| Download URL | fastly_compute-0.1.3-cp312-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 18.7 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
bd66ec8b56b3f90bd96e1c2604c3dba619329384e5213ec9058af2dd428b27fb
|
|
BLAKE2b-256 checksum How to use checksums |
536199d1f3432a0cfa50371674d3837f3bf77f096d0f996c189247fb962240b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.
Transparency logRelease files / fastly_compute-0.1.3-cp312-abi3-manylinux_2_28_aarch64.whl
| Download URL | fastly_compute-0.1.3-cp312-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 18.3 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
71887b90dc6edcd055e0b1c3e982ed22983b7977657da8fa8aad44c6f552ab71
|
|
BLAKE2b-256 checksum How to use checksums |
c17b23439fd72a56bc2e697d19404af5f9097aa43df33e4bc5a447474aa5f9c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.
Transparency logRelease files / fastly_compute-0.1.3-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | fastly_compute-0.1.3-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 17.1 MB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
f43fc2f54ee9c0a0aabe98e883b267d9f480cd2842c470d0475dd1cece14a72e
|
|
BLAKE2b-256 checksum How to use checksums |
dc882bec4aca84b25d8d5dfbe34a468349fa6869588ad5964341dd9f81cc4121
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.
Transparency logRelease files / fastly_compute-0.1.3-cp312-abi3-macosx_10_15_x86_64.whl
| Download URL | fastly_compute-0.1.3-cp312-abi3-macosx_10_15_x86_64.whl |
|---|---|
| Size | 18.0 MB |
| Tags | CPython 3.12 abi3 macOS 10.15+ x86-64 |
|
SHA-256 checksum How to use checksums |
a465595168ccf338b22454a1b1c2552ddf4111fece752fe5a04ffd22ccd8231d
|
|
BLAKE2b-256 checksum How to use checksums |
a0aed63cf79244113963d6720c033e307704ccae838cb7d14b47281168d3ab02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.
Transparency log