Fly.io is a compute platform for deploying containerized apps globally. There is no official Fly.io Python SDK — interaction is via the flyctl CLI, fly.toml config file, and the Machines REST API. The unofficial fly-python-sdk on PyPI (pip install fly-python-sdk) is a third-party project last updated October 2023 and should not be relied upon.
curl -L https://fly.io/install.sh | shVerified import paths — ran on the pinned version, not inferred.
Primary workflow is CLI-based. fly launch detects framework and generates fly.toml. fly deploy on every code change.
Use [http_service] for single-process HTTP apps. Use [[services]] only for TCP or multi-port configurations. Run fly config validate to check.
Replace auto_stop_machines = true with auto_stop_machines = 'stop' or 'suspend'.
Use auto_stop_machines = 'suspend' + min_machines_running = 0 to minimize cost on low-traffic apps. Stopped/suspended machines only billed for storage (~$0.15/GB/month).
Run fly scale count 1 after first deploy, or set min_machines_running = 0 with auto_stop_machines = 'suspend'.
Bind your server to 0.0.0.0. E.g. uvicorn app:app --host 0.0.0.0 --port 8080
Verify requirements before relying on suspend for fast cold-start. Check fly machine status <id> to confirm state transitions.
Always run fly deploy after any fly.toml change. Use fly config show to inspect deployed config.
In GitHub Actions use superfly/flyctl-actions@v1 pinned to a specific version. Disable autoupdate in production environments with fly settings autoupdate disable.
Ensure the Python version used in your deployment environment (e.g., specified in `fly.toml` buildpack, or your Dockerfile's `FROM` image) meets the minimum `Requires-Python` version of your dependencies. For example, if a dependency requires `Python >=3.11`, use `python:3.11-slim` or newer.
For the 'root' user warning, ensure pip is run within a virtual environment or specify a non-root user in your Dockerfile (e.g., using a `USER` instruction). For the pip update notice, run `pip install --upgrade pip` to update pip.
No dependency data recorded yet.