Skip to content

Commit 3a2e0ac

Browse files
authored
Merge branch 'main' into lower-bound
2 parents 2c46bae + fe7166a commit 3a2e0ac

File tree

7 files changed

+161
-66
lines changed

7 files changed

+161
-66
lines changed

.github/workflows/test-redistribute.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ on:
1212
jobs:
1313
test-redistribute:
1414
runs-on: ubuntu-latest
15-
strategy:
16-
matrix:
17-
package:
18-
- fastapi-cli-slim
19-
- fastapi-cli
2015
steps:
2116
- name: Dump GitHub context
2217
env:
@@ -33,8 +28,6 @@ jobs:
3328
- name: Install build dependencies
3429
run: pip install build
3530
- name: Build source distribution
36-
env:
37-
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
3831
run: python -m build --sdist
3932
- name: Decompress source distribution
4033
run: |
@@ -44,8 +37,6 @@ jobs:
4437
run: |
4538
cd dist/fastapi_cli*/
4639
pip install --group tests --editable .[standard]
47-
env:
48-
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
4940
- name: Run source distribution tests
5041
run: |
5142
cd dist/fastapi_cli*/

fastapi-cli-slim/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# FastAPI CLI
2+
3+
<a href="https://github.com/fastapi/fastapi-cli/actions/workflows/test.yml" target="_blank">
4+
<img src="https://github.com/fastapi/fastapi-cli/actions/workflows/test.yml/badge.svg" alt="Test">
5+
</a>
6+
<a href="https://github.com/fastapi/fastapi-cli/actions/workflows/publish.yml" target="_blank">
7+
<img src="https://github.com/fastapi/fastapi-cli/actions/workflows/publish.yml/badge.svg" alt="Publish">
8+
</a>
9+
<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/fastapi-cli" target="_blank">
10+
<img src="https://coverage-badge.samuelcolvin.workers.dev/fastapi/fastapi-cli.svg" alt="Coverage">
11+
<a href="https://pypi.org/project/fastapi-cli" target="_blank">
12+
<img src="https://img.shields.io/pypi/v/fastapi-cli?color=%2334D058&label=pypi%20package" alt="Package version">
13+
</a>
14+
15+
---
16+
17+
**Source Code**: <a href="https://github.com/fastapi/fastapi-cli" target="_blank">https://github.com/fastapi/fastapi-cli</a>
18+
19+
---
20+
21+
Run and manage FastAPI apps from the command line with FastAPI CLI. 🚀
22+
23+
## `fastapi-cli-slim`
24+
25+
⚠️ Do not install this package. ⚠️
26+
27+
This package, `fastapi-cli-slim`, does nothing other than depend on `fastapi-cli`.
28+
29+
You **should not** install this package.
30+
31+
Install instead:
32+
33+
```bash
34+
pip install "fastapi[standard]"
35+
```
36+
37+
or:
38+
39+
```bash
40+
pip install fastapi-cli
41+
```
42+
43+
This package is deprecated and will stop receiving any updates and published versions.
44+
45+
## License
46+
47+
This project is licensed under the terms of the MIT license.

pdm_build.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,38 @@
33

44
from pdm.backend.hooks import Context
55

6-
TIANGOLO_BUILD_PACKAGE = os.getenv("TIANGOLO_BUILD_PACKAGE", "fastapi-cli")
6+
TIANGOLO_BUILD_PACKAGE = os.getenv("TIANGOLO_BUILD_PACKAGE")
77

88

9-
def pdm_build_initialize(context: Context):
9+
def pdm_build_initialize(context: Context) -> None:
1010
metadata = context.config.metadata
11+
# Get main version
12+
version = metadata["version"]
1113
# Get custom config for the current package, from the env var
12-
config: dict[str, Any] = context.config.data["tool"]["tiangolo"][
14+
all_configs_config: dict[str, Any] = context.config.data["tool"]["tiangolo"][
1315
"_internal-slim-build"
14-
]["packages"].get(TIANGOLO_BUILD_PACKAGE)
15-
if not config:
16+
]["packages"]
17+
18+
if TIANGOLO_BUILD_PACKAGE not in all_configs_config:
1619
return
20+
21+
config = all_configs_config[TIANGOLO_BUILD_PACKAGE]
1722
project_config: dict[str, Any] = config["project"]
1823
# Override main [project] configs with custom configs for this package
1924
for key, value in project_config.items():
2025
metadata[key] = value
26+
# Get custom build config for the current package
27+
build_config: dict[str, Any] = (
28+
config.get("tool", {}).get("pdm", {}).get("build", {})
29+
)
30+
# Override PDM build config with custom build config for this package
31+
for key, value in build_config.items():
32+
context.config.build_config[key] = value
33+
# Get main dependencies
34+
dependencies: list[str] = metadata.get("dependencies", [])
35+
# Sync versions in dependencies
36+
new_dependencies = []
37+
for dep in dependencies:
38+
new_dep = f"{dep}>={version}"
39+
new_dependencies.append(new_dep)
40+
metadata["dependencies"] = new_dependencies

pyproject.toml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ github-actions = [
6767
]
6868
tests = [
6969
"coverage[toml]>=6.2,<8.0",
70-
"fastapi-slim>=0.128.0",
70+
"fastapi>=0.128.0",
7171
"mypy==1.19.1",
7272
"pytest>=7.4.0,<10.0.0",
73-
"ruff==0.15.0",
73+
"ruff==0.15.1",
7474
"uvicorn>=0.39.0",
7575
]
7676

@@ -91,6 +91,29 @@ source-includes = [
9191

9292
[tool.tiangolo._internal-slim-build.packages.fastapi-cli-slim.project]
9393
name = "fastapi-cli-slim"
94+
readme = "fastapi-cli-slim/README.md"
95+
dependencies = [
96+
"fastapi-cli",
97+
]
98+
optional-dependencies = {}
99+
scripts = {}
100+
101+
[tool.tiangolo._internal-slim-build.packages.fastapi-cli-slim.tool.pdm.build]
102+
# excludes needs to explicitly exclude the top level python packages,
103+
# otherwise PDM includes them by default
104+
# A "*" glob pattern can't be used here because in PDM internals, the patterns are put
105+
# in a set (unordered, order varies) and each excluded file is assigned one of the
106+
# glob patterns that matches, as the set is unordered, the matched pattern could be "*"
107+
# independent of the order here. And then the internal code would give it a lower score
108+
# than the one for a default included file.
109+
# By not using "*" and explicitly excluding the top level packages, they get a higher
110+
# score than the default inclusion
111+
excludes = ["src", "tests", "pdm_build.py"]
112+
# source-includes needs to explicitly define some value because PDM will check the
113+
# truthy value of the list, and if empty, will include some defaults, including "tests",
114+
# an empty string doesn't match anything, but makes the list truthy, so that PDM
115+
# doesn't override it during the build.
116+
source-includes = [""]
94117

95118
[tool.pytest.ini_options]
96119
addopts = [

release-notes.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@
44

55
### Internal
66

7+
* ⬆ Bump ruff from 0.15.0 to 0.15.1. PR [#305](https://github.com/fastapi/fastapi-cli/pull/305) by [@dependabot[bot]](https://github.com/apps/dependabot).
8+
* ⬆ Bump rich-toolkit from 0.19.3 to 0.19.4. PR [#304](https://github.com/fastapi/fastapi-cli/pull/304) by [@dependabot[bot]](https://github.com/apps/dependabot).
9+
* ⬆ Bump typer from 0.21.2 to 0.23.0. PR [#302](https://github.com/fastapi/fastapi-cli/pull/302) by [@dependabot[bot]](https://github.com/apps/dependabot).
10+
* ⬆ Bump rich-toolkit from 0.19.2 to 0.19.3. PR [#303](https://github.com/fastapi/fastapi-cli/pull/303) by [@dependabot[bot]](https://github.com/apps/dependabot).
11+
* ➕ Replace test dependency on `fastapi-slim` with `fastapi`. PR [#301](https://github.com/fastapi/fastapi-cli/pull/301) by [@musicinmybrain](https://github.com/musicinmybrain).
12+
13+
## 0.0.21
14+
15+
### Internal
16+
17+
* 👷 Update build setup for `fastapi-cli-slim`, deprecate it, and make it only depend on `fastapi-cli`. PR [#300](https://github.com/fastapi/fastapi-cli/pull/300) by [@tiangolo](https://github.com/tiangolo).
18+
* ⬆ Bump typer from 0.21.1 to 0.21.2. PR [#298](https://github.com/fastapi/fastapi-cli/pull/298) by [@dependabot[bot]](https://github.com/apps/dependabot).
19+
* ⬆ Bump fastapi-slim from 0.128.6 to 0.128.7. PR [#297](https://github.com/fastapi/fastapi-cli/pull/297) by [@dependabot[bot]](https://github.com/apps/dependabot).
20+
* ⬆ Bump rich-toolkit from 0.19.0 to 0.19.2. PR [#296](https://github.com/fastapi/fastapi-cli/pull/296) by [@dependabot[bot]](https://github.com/apps/dependabot).
721
* ⬆ Bump rich-toolkit from 0.18.1 to 0.19.0. PR [#293](https://github.com/fastapi/fastapi-cli/pull/293) by [@dependabot[bot]](https://github.com/apps/dependabot).
822
* ⬆ Bump fastapi-slim from 0.128.5 to 0.128.6. PR [#294](https://github.com/fastapi/fastapi-cli/pull/294) by [@dependabot[bot]](https://github.com/apps/dependabot).
923
* ⬆ Bump fastapi-slim from 0.128.2 to 0.128.5. PR [#292](https://github.com/fastapi/fastapi-cli/pull/292) by [@dependabot[bot]](https://github.com/apps/dependabot).

src/fastapi_cli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.0.20"
1+
__version__ = "0.0.21"

0 commit comments

Comments
 (0)