Files
fastapi/pdm_build.py
Sebastián Ramírez a25c92ceb9 ♻️ Add support for pip install "fastapi[standard]" with standard dependencies and python -m fastapi (#11935)
* ♻️ Add support for `pip install "fastapi[standard]"` and make `fastapi` not include the optional standard dependencies

* 📝 Update docs to include new fastapi[standard]

*  Add new stub fastapi command that tells people to install fastapi[standard]

*  Add tests for new stub CLI

* 🔧 Add new command fastapi in main fastapi project, for when fastapi-cli is not installed

* ✏️ Fix types

* 📝 Add note about quotes when installing fastapi[standard]

* 📝 Update docs about standard extra dependencies

* ⬆️ Upgrade fastapi-cli
2024-08-02 01:03:05 -05:00

21 lines
697 B
Python

import os
from typing import Any, Dict
from pdm.backend.hooks import Context
TIANGOLO_BUILD_PACKAGE = os.getenv("TIANGOLO_BUILD_PACKAGE", "fastapi")
def pdm_build_initialize(context: Context) -> None:
metadata = context.config.metadata
# Get custom config for the current package, from the env var
config: Dict[str, Any] = context.config.data["tool"]["tiangolo"][
"_internal-slim-build"
]["packages"].get(TIANGOLO_BUILD_PACKAGE)
if not config:
return
project_config: Dict[str, Any] = config["project"]
# Override main [project] configs with custom configs for this package
for key, value in project_config.items():
metadata[key] = value