astral-sh / uv-docker-example

An example of using uv in Docker images
102 stars 18 forks source link

Must install fastapi with the `standard` extra since fastapi version 0.112.0 #23

Closed Actionb closed 2 months ago

Actionb commented 2 months ago

Hi there, thanks for the helpful examples! However, I ran into a small issue: using run.sh without any arguments produces an error:

$ ./run.sh

To use the fastapi command, please install "fastapi[standard]":

    pip install "fastapi[standard]"

Traceback (most recent call last):
  File "/app/.venv/bin/fastapi", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/fastapi/cli.py", line 12, in main
    raise RuntimeError(message)  # noqa: B904
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: To use the fastapi command, please install "fastapi[standard]":

    pip install "fastapi[standard]"

Since fastapi 0.112.0, fastapi-cli is no longer included by default and must be installed using the standard extra. For example:

# pyproject.toml
[project]
name = "uv-docker-example"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
    "fastapi[standard]>=0.112.2",
]
zanieb commented 2 months ago

Thanks! Pull request welcome here.