Skip to content

Commit bb107a8

Browse files
authored
♻️ Add fastapi-cli[standard] including Uvicorn, make fastapi-cli and fastapi-cli-slim have the same packages (#55)
1 parent 97f223f commit bb107a8

File tree

3 files changed

+5
-33
lines changed

3 files changed

+5
-33
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Run and manage FastAPI apps from the command line with FastAPI CLI. 🚀
2424

2525
**FastAPI CLI** is a command line program `fastapi` that you can use to serve your FastAPI app, manage your FastAPI project, and more.
2626

27-
When you install FastAPI (e.g. with `pip install fastapi`), it includes a package called `fastapi-cli`, this package provides the `fastapi` command in the terminal.
27+
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.
2828

2929
To run your FastAPI app for development, you can use the `fastapi dev` command:
3030

pdm_build.py

+4-23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os
2-
from typing import Any, Dict, List
2+
from typing import Any, Dict
33

44
from pdm.backend.hooks import Context
55

@@ -11,29 +11,10 @@ def pdm_build_initialize(context: Context):
1111
# Get custom config for the current package, from the env var
1212
config: Dict[str, Any] = context.config.data["tool"]["tiangolo"][
1313
"_internal-slim-build"
14-
]["packages"][TIANGOLO_BUILD_PACKAGE]
14+
]["packages"].get(TIANGOLO_BUILD_PACKAGE)
15+
if not config:
16+
return
1517
project_config: Dict[str, Any] = config["project"]
16-
# Get main optional dependencies, extras
17-
optional_dependencies: Dict[str, List[str]] = metadata.get(
18-
"optional-dependencies", {}
19-
)
20-
# Get custom optional dependencies name to always include in this (non-slim) package
21-
include_optional_dependencies: List[str] = config.get(
22-
"include-optional-dependencies", []
23-
)
2418
# Override main [project] configs with custom configs for this package
2519
for key, value in project_config.items():
2620
metadata[key] = value
27-
# Get custom build config for the current package
28-
build_config: Dict[str, Any] = (
29-
config.get("tool", {}).get("pdm", {}).get("build", {})
30-
)
31-
# Override PDM build config with custom build config for this package
32-
for key, value in build_config.items():
33-
context.config.build_config[key] = value
34-
# Get main dependencies
35-
dependencies: List[str] = metadata.get("dependencies", [])
36-
# Add optional dependencies to the default dependencies for this (non-slim) package
37-
for include_optional in include_optional_dependencies:
38-
optional_dependencies_group = optional_dependencies.get(include_optional, [])
39-
dependencies.extend(optional_dependencies_group)

pyproject.toml

-9
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ dependencies = [
3838

3939
[project.optional-dependencies]
4040
standard = [
41-
"fastapi",
4241
"uvicorn[standard] >= 0.15.0",
4342
]
4443

@@ -69,14 +68,6 @@ source-includes = [
6968
[tool.tiangolo._internal-slim-build.packages.fastapi-cli-slim.project]
7069
name = "fastapi-cli-slim"
7170

72-
[tool.tiangolo._internal-slim-build.packages.fastapi-cli]
73-
# No default dependencies included for now
74-
include-optional-dependencies = []
75-
76-
[tool.tiangolo._internal-slim-build.packages.fastapi-cli.project]
77-
# No custom optional dependencies for now
78-
# optional-dependencies = {}
79-
8071
[tool.pytest.ini_options]
8172
addopts = [
8273
"--strict-config",

0 commit comments

Comments
 (0)