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

Install from the Zed extensions panel (Cmd+Shift+X) — search for fastapi-lsp and click Install. It activates automatically for Python, HTML, and Jinja2 files.

To control server order alongside other language servers or pass initialization options, add to ~/.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.6-py3-none-win_amd64.whl (2.7 MB view details)

Uploaded Python 3Windows x86-64

fastapi_lsp-0.1.6-py3-none-manylinux_2_28_x86_64.whl (2.6 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

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

Uploaded Python 3manylinux: glibc 2.28+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

fastapi_lsp-0.1.6-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.6-py3-none-win_amd64.whl.

File metadata

  • Download URL: fastapi_lsp-0.1.6-py3-none-win_amd64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","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.6-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 3fe1ceae7b3ec6eb827709a75f313f723b72ba8eead3554c2ac6df53003cf531
MD5 02b0ef0a382bdc39b7827b35e2f56694
BLAKE2b-256 f39c77f44747c7d9111645c3b3c67e8b9bddd5829f65b49aee2d5f6af2cd673c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fastapi_lsp-0.1.6-py3-none-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: Python 3, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","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.6-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f503a31ade81e8e0b5c6ada24c92affa4b9e828cef24d9af8508a79abd1e4221
MD5 769a7aecde268f033bafae8d88daf1de
BLAKE2b-256 2aa82e6a906e627391c557c4e533880599cd616f0e655b1b5458edfc72bdaea8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fastapi_lsp-0.1.6-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.24 {"installer":{"name":"uv","version":"0.11.24","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.6-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8224ad680120ddce752104dddefee5de6ae90d7cb5a8917e1712da87b2bafc4b
MD5 c674cd82928fc3c8b25cea87129f8fb0
BLAKE2b-256 33290af8e04256b31dbdf03a9c5598b2c3a456c8f0a9cc43f4010bc215279587

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fastapi_lsp-0.1.6-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.24 {"installer":{"name":"uv","version":"0.11.24","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.6-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0fcd1b6837e5e80a5c624a4d44b494595d8d5bf2637e61010f634378a6ad489e
MD5 216bf10cdd40931cd7b86faa114eba12
BLAKE2b-256 871cec811a4050a7f3d2a415e78ad6abf7f6ddaf5c39decc022db34d57654314

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fastapi_lsp-0.1.6-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.24 {"installer":{"name":"uv","version":"0.11.24","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.6-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6712fe0d0506932f1d604b8b519a22211cf929f6133d1be3e66837eae932310a
MD5 a9c2a5fb174bf2e5e9bf9faa8adc6c4d
BLAKE2b-256 c1ea292f32cb7c341f5d9eac6ee707bd90903c3a48cfcfef4aca4250da5cfba6

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