FastAPI Cloud CLI

raw JSON →
0.15.1 verified Tue May 12 auth: no python install: stale

fastapi-cloud-cli is a command-line interface tool for deploying and managing FastAPI applications on FastAPI Cloud. It provides commands for logging in, deploying, managing environment variables, and streaming logs. The library is actively maintained, with frequent releases, and is currently at version 0.15.1.

pip install fastapi-cloud-cli
error fastapi command not found
cause The `fastapi-cloud-cli` package is not installed, or the virtual environment where it is installed is not activated, leading the shell to not find the `fastapi` executable.
fix
Install the CLI tool using pip install fastapi-cloud-cli or pip install "fastapi[standard]" (which includes it as a dependency), and ensure your Python virtual environment is activated before running fastapi commands.
error Build Failed When Installing Dependencies
cause During deployment, some of your application's dependencies do not have pre-built wheels available for the specific Python version configured, causing the build process to fail.
fix
Pin your Python version in your project's configuration (e.g., pyproject.toml or runtime.txt) to one for which all your dependencies have pre-built wheels available.
error Error: App not found
cause This error during `fastapi deploy` typically means you are logged into FastAPI Cloud with an account different from the one that created the application, or the application was previously deleted from your dashboard.
fix
Verify you are logged in with the correct account using fastapi login. If the app was deleted, run fastapi unlink to remove the local configuration and then fastapi deploy to create a new application.
error The fastapi-cloud-cli tries to create a /.config file automatically on invocation of fastapi. Given that root path is privileged, caused our app to start failing deployments.
cause When running in containerized environments (like Kubernetes or WSL with Windows mounts), `fastapi-cloud-cli` attempts to write configuration files to a root path (`/.config`) that is often privileged and non-writable, leading to deployment failures.
fix
If using WSL, ensure your application's source code is located within the Linux filesystem (e.g., /home/yourusername/) rather than a mounted Windows directory (e.g., /mnt/c/). In other containerized setups, review container permissions or explore configuration options to specify an alternative writable location for fastapi-cloud-cli configuration files.
breaking Version 0.13.0 dropped official support for Python 3.9. Users on Python 3.9 must upgrade their Python version to 3.10 or newer.
fix Upgrade Python environment to 3.10 or higher.
gotcha When `fastapi-cloud-cli` is installed as part of `fastapi[standard]`, it may attempt to create configuration files in privileged root paths (e.g., `/.config`). This can cause deployment failures in restricted environments like some Kubernetes setups.
fix If FastAPI Cloud deployment features are not explicitly needed, install FastAPI using `pip install "fastapi[standard-no-fastapi-cloud-cli]"` to avoid including `fastapi-cloud-cli`.
gotcha Deployment might fail with 'Build Failed When Installing Dependencies' if required packages do not have pre-built wheels for your specific Python version. This is common when using a very new or less common Python version.
fix Pin your Python version to one known to have pre-built wheels available for all your project's dependencies. Consult your dependency documentation for compatible Python versions.
gotcha On Windows, the `fastapi` command might not be found in the PATH after installation, leading to 'command not found' errors.
fix Ensure that the directory where `pip` installs executables (often in a virtual environment's `Scripts` directory) is added to your system's PATH environment variable. Alternatively, invoke it using `python -m fastapi_cloud_cli` if direct `fastapi` alias isn't resolving.
pip install "fastapi[standard]"
python os / libc variant status wheel install import disk
3.10 alpine (musl) standard wheel - - 80.4M
3.10 alpine (musl) standard - - - -
3.10 alpine (musl) fastapi-cloud-cli wheel - - 75.5M
3.10 alpine (musl) fastapi-cloud-cli - - - -
3.10 slim (glibc) standard wheel 9.2s - 83M
3.10 slim (glibc) standard - - - -
3.10 slim (glibc) fastapi-cloud-cli wheel 8.0s - 78M
3.10 slim (glibc) fastapi-cloud-cli - - - -
3.11 alpine (musl) standard wheel - - 88.2M
3.11 alpine (musl) standard - - - -
3.11 alpine (musl) fastapi-cloud-cli wheel - - 82.5M
3.11 alpine (musl) fastapi-cloud-cli - - - -
3.11 slim (glibc) standard wheel 8.3s - 91M
3.11 slim (glibc) standard - - - -
3.11 slim (glibc) fastapi-cloud-cli wheel 7.3s - 85M
3.11 slim (glibc) fastapi-cloud-cli - - - -
3.12 alpine (musl) standard wheel - - 80.9M
3.12 alpine (musl) standard - - - -
3.12 alpine (musl) fastapi-cloud-cli wheel - - 75.4M
3.12 alpine (musl) fastapi-cloud-cli - - - -
3.12 slim (glibc) standard wheel 6.9s - 85M
3.12 slim (glibc) standard - - - -
3.12 slim (glibc) fastapi-cloud-cli wheel 6.3s - 79M
3.12 slim (glibc) fastapi-cloud-cli - - - -
3.13 alpine (musl) standard wheel - - 80.5M
3.13 alpine (musl) standard - - - -
3.13 alpine (musl) fastapi-cloud-cli wheel - - 75.1M
3.13 alpine (musl) fastapi-cloud-cli - - - -
3.13 slim (glibc) standard wheel 6.9s - 84M
3.13 slim (glibc) standard - - - -
3.13 slim (glibc) fastapi-cloud-cli wheel 6.2s - 79M
3.13 slim (glibc) fastapi-cloud-cli - - - -
3.9 alpine (musl) standard wheel - - 78.9M
3.9 alpine (musl) standard - - - -
3.9 alpine (musl) fastapi-cloud-cli wheel - - 74.1M
3.9 alpine (musl) fastapi-cloud-cli - - - -
3.9 slim (glibc) standard wheel 10.7s - 82M
3.9 slim (glibc) standard - - - -
3.9 slim (glibc) fastapi-cloud-cli wheel 9.3s - 77M
3.9 slim (glibc) fastapi-cloud-cli - - - -

This quickstart demonstrates how to initialize a FastAPI project, create a simple FastAPI application, log in to FastAPI Cloud, and deploy the application using the `fastapi` CLI. The `fastapi[standard]` installation includes `fastapi-cloud-cli`.

# 1. Create a new FastAPI project (requires uv or pip)
# Using uv (recommended):
# uv init myapp
# cd myapp
# uv add "fastapi[standard]"

# Using pip:
mkdir myapp
cd myapp
pip install "fastapi[standard]"

# 2. Create a basic FastAPI application (main.py)
# (Content of main.py)
# from fastapi import FastAPI
# app = FastAPI()
# @app.get("/")
# def read_root():
#     return {"message": "Hello, FastAPI Cloud!"}

# 3. Log in to FastAPI Cloud (if not already logged in)
# This will open a browser for authentication.
# fastapi login

# 4. Deploy your application
# The CLI will detect your app, and for the first deployment,
# it will prompt to select/create a team and app.
# Ensure FASTAPI_CLOUD_TOKEN is set for CI/CD or non-interactive use.
# For example: export FASTAPI_CLOUD_TOKEN=os.environ.get('FASTAPI_CLOUD_TOKEN', '')
fastapi deploy