Skip to content

Commit 1b3baf1

Browse files
authored
⬆️ Migrate to uv (#127)
* Move version into pyproject.toml * Remove duplicate classifier * Manage dependencies with uv * Update package ecosystem * Migrate the publish workflow to uv * Migrate the test-redistribution workflow to uv * Migrate the test workflow to uv * Revert to dynamic version to support certain envs * Keep re-dist. tests uv-free, simulating downstream * Back to vanilla publishing for now * Back to ruff publish
1 parent b6db249 commit 1b3baf1

File tree

9 files changed

+2793
-44
lines changed

9 files changed

+2793
-44
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ updates:
99
prefix:
1010
labels: [dependencies, internal]
1111
# Python
12-
- package-ecosystem: "pip"
12+
- package-ecosystem: "uv"
1313
directory: "/"
1414
schedule:
1515
interval: "daily"

.github/workflows/publish.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,20 @@ jobs:
1010
runs-on: ubuntu-latest
1111
permissions:
1212
id-token: write
13+
contents: read
1314
steps:
1415
- name: Dump GitHub context
1516
env:
1617
GITHUB_CONTEXT: ${{ toJson(github) }}
1718
run: echo "$GITHUB_CONTEXT"
1819
- uses: actions/checkout@v5
1920
- name: Set up Python
20-
uses: actions/setup-python@v5
21+
uses: actions/setup-python@v6
2122
with:
22-
python-version: "3.10"
23-
- name: Install build dependencies
24-
run: pip install build
23+
python-version-file: "pyproject.toml"
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v7
2526
- name: Build distribution
26-
run: python -m build
27+
run: uv build
2728
- name: Publish
28-
uses: pypa/gh-action-pypi-publish@v1.13.0
29+
run: uv publish

.github/workflows/test-redistribute.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
run: echo "$GITHUB_CONTEXT"
2020
- uses: actions/checkout@v5
2121
- name: Set up Python
22-
uses: actions/setup-python@v5
22+
uses: actions/setup-python@v6
2323
with:
24-
python-version: "3.10"
24+
python-version-file: "pyproject.toml"
2525
# Issue ref: https://github.com/actions/setup-python/issues/436
2626
# cache: "pip"
2727
# cache-dependency-path: pyproject.toml
@@ -36,9 +36,7 @@ jobs:
3636
- name: Install test dependencies
3737
run: |
3838
cd dist/fastapi_cloud_cli*/
39-
pip install -r requirements-tests.txt
40-
env:
41-
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
39+
pip install --group dev .
4240
- name: Run source distribution tests
4341
run: |
4442
cd dist/fastapi_cloud_cli*/

.github/workflows/test.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,34 +47,30 @@ jobs:
4747
run: echo "$GITHUB_CONTEXT"
4848
- uses: actions/checkout@v5
4949
- name: Set up Python
50-
uses: actions/setup-python@v5
50+
uses: actions/setup-python@v6
5151
with:
5252
python-version: ${{ matrix.python-version }}
5353
# Issue ref: https://github.com/actions/setup-python/issues/436
5454
# cache: "pip"
5555
# cache-dependency-path: pyproject.toml
56-
- uses: actions/cache@v4
57-
id: cache
58-
with:
59-
path: ${{ env.pythonLocation }}
60-
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-tests.txt') }}-{{ matrix.pydantic-version }}
56+
- name: Install uv
57+
uses: astral-sh/setup-uv@v7
6158
# Allow debugging with tmate
6259
- name: Setup tmate session
6360
uses: mxschmitt/action-tmate@v3
6461
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
6562
with:
6663
limit-access-to-actor: true
6764
- name: Install Dependencies
68-
if: steps.cache.outputs.cache-hit != 'true'
69-
run: pip install -r requirements-tests.txt
65+
run: uv sync --locked --all-extras --dev
7066
- name: Install Pydantic v1
7167
if: matrix.pydantic-version == 'v1'
72-
run: pip install "pydantic<2.0.0"
68+
run: uv pip install "pydantic<2.0.0"
7369
- name: Lint
74-
run: bash scripts/lint.sh
70+
run: uv run --no-sync scripts/lint.sh
7571
- run: mkdir coverage
7672
- name: Test
77-
run: bash scripts/test.sh
73+
run: uv run --no-sync scripts/test.sh
7874
env:
7975
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
8076
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
@@ -94,9 +90,9 @@ jobs:
9490
GITHUB_CONTEXT: ${{ toJson(github) }}
9591
run: echo "$GITHUB_CONTEXT"
9692
- uses: actions/checkout@v5
97-
- uses: actions/setup-python@v5
93+
- uses: actions/setup-python@v6
9894
with:
99-
python-version: '3.8'
95+
python-version-file: "pyproject.toml"
10096
# Issue ref: https://github.com/actions/setup-python/issues/436
10197
# cache: "pip"
10298
# cache-dependency-path: pyproject.toml

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.8

pyproject.toml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ classifiers = [
2828
"Programming Language :: Python :: 3.11",
2929
"Programming Language :: Python :: 3.12",
3030
"Programming Language :: Python :: 3.13",
31-
"License :: OSI Approved :: MIT License",
3231
]
3332
dependencies = [
3433
"typer >= 0.12.3",
@@ -44,6 +43,17 @@ dependencies = [
4443
[project.optional-dependencies]
4544
standard = ["uvicorn[standard] >= 0.15.0"]
4645

46+
[dependency-groups]
47+
dev = [
48+
"pre-commit>=2.17.0,<5.0.0",
49+
"pytest>=4.4.0,<9.0.0",
50+
"coverage[toml]>=6.2,<8.0",
51+
"mypy==1.14.1",
52+
"ruff==0.13.0",
53+
"respx==0.22.0",
54+
"time-machine==2.15.0",
55+
]
56+
4757
[project.urls]
4858
Homepage = "https://github.com/fastapilabs/fastapi-cloud-cli"
4959
Documentation = "https://fastapi.tiangolo.com/fastapi-cloud-cli/"
@@ -60,7 +70,7 @@ version = { source = "file", path = "src/fastapi_cloud_cli/__init__.py" }
6070
distribution = true
6171

6272
[tool.pdm.build]
63-
source-includes = ["tests/", "requirements*.txt", "scripts/"]
73+
source-includes = ["tests/", "scripts/"]
6474

6575
[tool.pytest.ini_options]
6676
addopts = ["--strict-config", "--strict-markers"]
@@ -109,10 +119,6 @@ ignore = [
109119
"W191", # indentation contains tabs
110120
]
111121

112-
# [tool.ruff.lint.per-file-ignores]
113-
# "__init__.py" = ["F401"]
114-
115-
116122
[tool.ruff.lint.isort]
117123
known-third-party = ["typer", "fastapi"]
118124

requirements-tests.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

requirements.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)