Add missing pydantic runtime dependency #277
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This statement in the docs https://fastapi.tiangolo.com/fastapi-cli/?h=fastapi+cli#fastapi-cli says:
When you install FastAPI (e.g. with pip install "fastapi[standard]"), it includes a package called fastapi-cli, this package provides the fastapi command in the terminal.Which means that you can run the command
fastapiafter installingfastapi-cliitself. The same applies to this section https://github.com/fastapi/fastapi-cli/tree/0.0.20?tab=readme-ov-file#description.I guess it's not designed to run without the
fastapipackage, but the code itself haspydantic, which is not mentioned as a runtime dependency.pydanticis a missing runtime dependency and is not mentioned here https://github.com/fastapi/fastapi-cli/blob/0.0.20/pyproject.toml#L34-L39, but it's used at runtime here https://github.com/fastapi/fastapi-cli/blob/0.0.20/src/fastapi_cli/cli.py#L6 and here https://github.com/fastapi/fastapi-cli/blob/0.0.20/src/fastapi_cli/config.py#L5.This line of the
fastapicode https://github.com/fastapi/fastapi/blob/master/fastapi/cli.py#L2 says that it directly relies onfastapi_cli.Basically, an entry point
fastapi = fastapi_cli.cli:mainbelongs to thefastapi-clipackage.Operating System Details
unix and win platforms
Python Version
py310-py314
Additional Context
If I run
fastapi --helporfastapi --versionwithoutpydantic >=2.0.0in the test environment, I get:But if I add
pydanticto the runtime dependencies, it works fine:Additionally, I sorted dependencies alphabetically for readability and maintenance.
Also, see the conda-build recipe of
fastapi-cli0.0.20 https://github.com/AnacondaRecipes/fastapi-cli-feedstock/blob/main/recipe/meta.yaml