Skip to main content

Python SDK for Fastly Compute

Project description

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

Here's how to write your own Python WSGI app and run it on Fastly's edge network:

  1. Install the package that provides the Fastly Python build tool and gives you access to the Fastly API:

    pip install fastly-compute

  2. Make a project shaped like our Flask example. You may find it easiest to clone the repository, copy the examples/flask-app folder, and modify it. If you change the name of the top-level .py file, be sure to also update the entrypoint (entry = "your_top_level_module_name") in pyproject.toml.

  3. cd your-project

  4. Install the Fastly CLI if you don't already have it.

  5. fastly compute init

  6. Say yes when warned "The current directory isn't empty." Answer "Other" when it asks for Language.

  7. Add this to the bottom of fastly.toml:

    [scripts]
    build = "fastly-compute-py build"
    
  8. fastly compute build

  9. fastly compute deploy

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fastly_compute-0.1.0-cp312-abi3-manylinux_2_28_x86_64.whl (18.7 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ x86-64

fastly_compute-0.1.0-cp312-abi3-manylinux_2_28_aarch64.whl (18.2 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ ARM64

fastly_compute-0.1.0-cp312-abi3-macosx_11_0_arm64.whl (17.0 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

fastly_compute-0.1.0-cp312-abi3-macosx_10_15_x86_64.whl (17.9 MB view details)

Uploaded CPython 3.12+macOS 10.15+ x86-64

File details

Details for the file fastly_compute-0.1.0-cp312-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fastly_compute-0.1.0-cp312-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 31fb3399d9d1c506b9f7ceb2e2ef97966a7715bc204b2ea8a8674a286f96e3a9
MD5 8a02f74ca5791948e45fa3c404dca5d7
BLAKE2b-256 0e35bb72a076e50d77d32158cfddbf9b71b5be01aee44802a2f6078520d2e3ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastly_compute-0.1.0-cp312-abi3-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on fastly/compute-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fastly_compute-0.1.0-cp312-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for fastly_compute-0.1.0-cp312-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f1dd2282e7bdfa55dd792218bbecb74100f8543a9fb7acc956221b36b582a78c
MD5 a978652145843d1f129ef9795d3500b1
BLAKE2b-256 10d4742fc8f9b32aa456e736e6d7865a940d86a239eaa7622868985b2f3ea25f

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastly_compute-0.1.0-cp312-abi3-manylinux_2_28_aarch64.whl:

Publisher: publish.yml on fastly/compute-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fastly_compute-0.1.0-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastly_compute-0.1.0-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f4846937181110131e81b04b4752aa4f980129ef43d85134dce9379ba6cb411d
MD5 8f007668da5fddff58e1f6153043c7b6
BLAKE2b-256 c5c1de1f220b311a2cd7f247910b1f346c26431a090aca5635177cdb8d08fa80

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastly_compute-0.1.0-cp312-abi3-macosx_11_0_arm64.whl:

Publisher: publish.yml on fastly/compute-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fastly_compute-0.1.0-cp312-abi3-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for fastly_compute-0.1.0-cp312-abi3-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 e5ba6fa294360f17a1975b67b59fcee691677bbda4da921468afa06e4aa6c987
MD5 6ed488caf0afc02bd60c3a7902b16984
BLAKE2b-256 9374e3be93750ed90baa6e28c2266004eabc71368ebd9bd3b76a02826146ed07

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastly_compute-0.1.0-cp312-abi3-macosx_10_15_x86_64.whl:

Publisher: publish.yml on fastly/compute-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page