Skip to main content

Language server for FastAPI and Starlette

Project description

fastapi-lsp

CI Release

Language server for FastAPI and Starlette — routes, Depends() graph, url_for, Jinja templates, env/settings. One Rust binary, any LSP-capable editor. Static analysis only.

Features

Diagnostics param mismatches, shadowed routes, unincluded routers, Depends(fn()), dep cycles, broken url_for, missing templates, undefined env keys
Navigation test call → handler, Depends() chains both ways, template files, .env lines
Hover route card: resolved path, router chain, response model, deps, middleware
Completions route paths, url_for names, template paths, env keys
Symbols GET /api/books/{book_id} in the symbol picker
Code lenses test count, dep usage, override count per handler
check CLI same diagnostics as a linter — fastapi-lsp check .

Installation

uv tool install fastapi-lsp

Or with pip:

pip install fastapi-lsp

Or download a pre-built binary from the releases page.

Editor setup

Neovim

vim.lsp.config('fastapi_lsp', {
  cmd = { 'fastapi-lsp', '--stdio' },
  filetypes = { 'python', 'html', 'htmldjango' },
  root_markers = { 'pyproject.toml', '.git' },
})
vim.lsp.enable('fastapi_lsp')

Helix

# ~/.config/helix/languages.toml
[language-server.fastapi-lsp]
command = "fastapi-lsp"
args = ["--stdio"]

[[language]]
name = "python"
language-servers = ["pyright", "fastapi-lsp"]

[[language]]
name = "html"
language-servers = ["vscode-html-language-server", "fastapi-lsp"]

[[language]]
name = "jinja"
language-servers = ["fastapi-lsp"]

Zed

// ~/.config/zed/settings.json
{
  "languages": { "Python": { "language_servers": ["fastapi-lsp", "..."] } },
  "lsp": { "fastapi-lsp": { "initialization_options": { "templates": ["app/templates"] } } }
}

Configuration

Zero config for standard projects. Priority: InitializationOptionsfastapi-lsp.toml[tool.fastapi-lsp] in pyproject.toml.

Option Default
entrypoint (auto-detected) main app file
templates [] Jinja template directories
source_roots [] extra import resolution roots
env_files [".env", ".env.example"] env key definitions
settings_env_files [".env", ".env.example", ".env.unittest"] env files checked for BaseSettings coverage
process_env false include server process env
process_env_show_values false show process-env values in hover
client_fixtures ["client", "async_client"] pytest HTTP client fixture names
env.ignore [] env keys to suppress from diagnostics

Feature toggles — all true by default except test_unknown_paths:

Toggle Default
diagnostics true
completion true
hover true
navigation true
code_actions true
code_lens true
symbols true
inlay_hints true
document_links true
test_unknown_paths false
# fastapi-lsp.toml
entrypoint = "app/main.py"
templates = ["app/templates"]

[features]
code_lens = false

[check]
only = []
ignore = ["env/undefined-key"]

CLI

fastapi-lsp lsp [--stdio | --tcp --address 127.0.0.1 --port 9257]
fastapi-lsp check PATH [--only CODES] [--ignore CODES] [--format text|json] [--fix]
fastapi-lsp routes [PATH] [--format text|json]

Development

cargo build
cargo test
uv run --group dev pytest e2e/ -v

License

MIT

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.

fastapi_lsp-0.1.5-py3-none-win_amd64.whl (2.6 MB view details)

Uploaded Python 3Windows x86-64

fastapi_lsp-0.1.5-py3-none-manylinux_2_28_x86_64.whl (2.5 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

fastapi_lsp-0.1.5-py3-none-manylinux_2_28_aarch64.whl (2.4 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

fastapi_lsp-0.1.5-py3-none-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

fastapi_lsp-0.1.5-py3-none-macosx_10_12_x86_64.whl (2.5 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file fastapi_lsp-0.1.5-py3-none-win_amd64.whl.

File metadata

  • Download URL: fastapi_lsp-0.1.5-py3-none-win_amd64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fastapi_lsp-0.1.5-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 7451e85f8c52b277bbba2f9caaa5394369ebd4e343cfcfad816bff00ddc62b88
MD5 bf569121341459ff2100b8f3057c0791
BLAKE2b-256 224b346837f75b1bcc1a7aee89d147b6130ead20d97f04ab0bfdb390811a871a

See more details on using hashes here.

File details

Details for the file fastapi_lsp-0.1.5-py3-none-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: fastapi_lsp-0.1.5-py3-none-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: Python 3, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fastapi_lsp-0.1.5-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9fda5edfb0009199b9260510ecdb99ff1e9e20a5a1f258e77d297aa9ca783190
MD5 61e1a27bf4b98adc82d237f8647b0236
BLAKE2b-256 e4ff894cf7d7326df7e7d0f491298bbb2a4ca628574183ad68cf9bfe8c075281

See more details on using hashes here.

File details

Details for the file fastapi_lsp-0.1.5-py3-none-manylinux_2_28_aarch64.whl.

File metadata

  • Download URL: fastapi_lsp-0.1.5-py3-none-manylinux_2_28_aarch64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: Python 3, manylinux: glibc 2.28+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fastapi_lsp-0.1.5-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e7d2c023a7b96badee4b15c4d5210bb32b2126cc1e4cede3c9ac4cb8b8c70fe4
MD5 793911fa8ed548272acb40bd0c7237b7
BLAKE2b-256 c888bce062f05884a2274ba0dc3828a1968524dc712d5a9a86b7b223d8aff8a4

See more details on using hashes here.

File details

Details for the file fastapi_lsp-0.1.5-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fastapi_lsp-0.1.5-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fastapi_lsp-0.1.5-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e0e5e76a488589b4717c10cd87a0621fb317746bfa50f34092c24beee8677b9d
MD5 f18b63f7a27f42277786f34f31377f3d
BLAKE2b-256 2e0360d17c48a66bf061746ab32ea2137beebca7d39f75a7e25d7df9594a5d8e

See more details on using hashes here.

File details

Details for the file fastapi_lsp-0.1.5-py3-none-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: fastapi_lsp-0.1.5-py3-none-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: Python 3, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fastapi_lsp-0.1.5-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0eb36721a186db3d80e0361cf3c2597f438fbce91ef608c3f52b435486710645
MD5 fa5173e19446cf47ab134f0012d63ae0
BLAKE2b-256 0ce942cd26e880c3c3a3c8e57f39eae1d87822167ae55dc046da87e029affb0a

See more details on using hashes here.

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