From 7b57e42986bb4d40c9eb6580537d13fb8e76097e Mon Sep 17 00:00:00 2001 From: Yurii Motov <109919500+YuriiMotov@users.noreply.github.com> Date: Sat, 23 May 2026 18:35:54 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Document=20`--entrypoint`=20CLI?= =?UTF-8?q?=20option=20(#15464)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/en/docs/fastapi-cli.md | 10 ++++++++-- docs/en/docs/tutorial/first-steps.md | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/en/docs/fastapi-cli.md b/docs/en/docs/fastapi-cli.md index 17898888f1..9d8f415d9b 100644 --- a/docs/en/docs/fastapi-cli.md +++ b/docs/en/docs/fastapi-cli.md @@ -95,7 +95,7 @@ which would be equivalent to: from backend.main import app ``` -### `fastapi dev` with path { #fastapi-dev-with-path } +### `fastapi dev` with path or with `--entrypoint` CLI option { #fastapi-dev-with-path-or-with-entrypoint-cli-option } You can also pass the file path to the `fastapi dev` command, and it will guess the FastAPI app object to use: @@ -103,7 +103,13 @@ You can also pass the file path to the `fastapi dev` command, and it will guess $ fastapi dev main.py ``` -But you would have to remember to pass the correct path every time you call the `fastapi` command. +Or, you can also pass the `--entrypoint` option to the `fastapi dev` command: + +```console +$ fastapi dev --entrypoint main:app +``` + +But you would have to remember to pass the correct path\entrypoint every time you call the `fastapi` command. Additionally, other tools might not be able to find it, for example the [VS Code Extension](editor-support.md) or [FastAPI Cloud](https://fastapicloud.com), so it is recommended to use the `entrypoint` in `pyproject.toml`. diff --git a/docs/en/docs/tutorial/first-steps.md b/docs/en/docs/tutorial/first-steps.md index 96aaa7463b..ae43e401ba 100644 --- a/docs/en/docs/tutorial/first-steps.md +++ b/docs/en/docs/tutorial/first-steps.md @@ -180,7 +180,7 @@ which would be equivalent to: from backend.main import app ``` -### `fastapi dev` with path { #fastapi-dev-with-path } +### `fastapi dev` with path or with `--entrypoint` CLI option { #fastapi-dev-with-path-or-with-entrypoint-cli-option } You can also pass the file path to the `fastapi dev` command, and it will guess the FastAPI app object to use: @@ -188,7 +188,13 @@ You can also pass the file path to the `fastapi dev` command, and it will guess $ fastapi dev main.py ``` -But you would have to remember to pass the correct path every time you call the `fastapi` command. +Or, you can also pass the `--entrypoint` option to the `fastapi dev` command: + +```console +$ fastapi dev --entrypoint main:app +``` + +But you would have to remember to pass the correct path\entrypoint every time you call the `fastapi` command. Additionally, other tools might not be able to find it, for example the [VS Code Extension](../editor-support.md) or [FastAPI Cloud](https://fastapicloud.com), so it is recommended to use the `entrypoint` in `pyproject.toml`.