Skip to content

Commit 951e1da

Browse files
committed
⬆️ Migrate to uv
1 parent a51ebb8 commit 951e1da

File tree

12 files changed

+1998
-52
lines changed

12 files changed

+1998
-52
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ updates:
88
commit-message:
99
prefix:
1010
# Python
11-
- package-ecosystem: "pip"
11+
- package-ecosystem: "uv"
1212
directory: "/"
1313
schedule:
1414
interval: "daily"

.github/workflows/pre-commit.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,15 @@ jobs:
4040
- name: Set up Python
4141
uses: actions/setup-python@v6
4242
with:
43-
python-version: "3.14"
43+
python-version-file: ".python-version"
4444
- name: Setup uv
4545
uses: astral-sh/setup-uv@v7
4646
with:
4747
cache-dependency-glob: |
48-
requirements**.txt
4948
pyproject.toml
5049
uv.lock
5150
- name: Install Dependencies
52-
run: |
53-
uv venv
54-
uv pip install -r requirements.txt
51+
run: uv sync --locked
5552
- name: Run prek - pre-commit
5653
id: precommit
5754
run: uvx prek run --from-ref origin/${GITHUB_BASE_REF} --to-ref HEAD --show-diff-on-failure

.github/workflows/publish.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
- fastapi-cli
1616
permissions:
1717
id-token: write
18+
contents: read
1819
steps:
1920
- name: Dump GitHub context
2021
env:
@@ -24,15 +25,12 @@ jobs:
2425
- name: Set up Python
2526
uses: actions/setup-python@v6
2627
with:
27-
python-version: "3.10"
28-
# Issue ref: https://github.com/actions/setup-python/issues/436
29-
# cache: "pip"
30-
# cache-dependency-path: pyproject.toml
31-
- name: Install build dependencies
32-
run: pip install build
28+
python-version-file: ".python-version"
29+
- name: Install uv
30+
uses: astral-sh/setup-uv@v7
3331
- name: Build distribution
32+
run: uv build
3433
env:
3534
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
36-
run: python -m build
3735
- name: Publish
38-
uses: pypa/gh-action-pypi-publish@v1.13.0
36+
run: uv publish

.github/workflows/smokeshow.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ on:
88
permissions:
99
statuses: write
1010

11-
env:
12-
UV_SYSTEM_PYTHON: 1
13-
1411
jobs:
1512
smokeshow:
1613
runs-on: ubuntu-latest
@@ -22,21 +19,21 @@ jobs:
2219
- uses: actions/checkout@v6
2320
- uses: actions/setup-python@v6
2421
with:
25-
python-version: '3.13'
22+
python-version-file: ".python-version"
2623
- name: Setup uv
2724
uses: astral-sh/setup-uv@v7
2825
with:
2926
cache-dependency-glob: |
30-
requirements**.txt
3127
pyproject.toml
32-
- run: uv pip install -r requirements-github-actions.txt
28+
uv.lock
29+
- run: uv sync --locked --no-dev --group github-actions
3330
- uses: actions/download-artifact@v7
3431
with:
3532
name: coverage-html
3633
path: htmlcov
3734
github-token: ${{ secrets.GITHUB_TOKEN }}
3835
run-id: ${{ github.event.workflow_run.id }}
39-
- run: smokeshow upload htmlcov
36+
- run: uv run smokeshow upload htmlcov
4037
env:
4138
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
4239
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 100

.github/workflows/test-redistribute.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Set up Python
2727
uses: actions/setup-python@v6
2828
with:
29-
python-version: "3.10"
29+
python-version-file: ".python-version"
3030
# Issue ref: https://github.com/actions/setup-python/issues/436
3131
# cache: "pip"
3232
# cache-dependency-path: pyproject.toml
@@ -43,7 +43,7 @@ jobs:
4343
- name: Install test dependencies
4444
run: |
4545
cd dist/fastapi_cli*/
46-
pip install -r requirements-tests.txt
46+
pip install --group tests --editable .[standard]
4747
env:
4848
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
4949
- name: Run source distribution tests

.github/workflows/test.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ on:
2222
default: 'false'
2323

2424
env:
25-
UV_SYSTEM_PYTHON: 1
25+
UV_NO_SYNC: true
2626

2727
jobs:
2828
test:
@@ -45,6 +45,8 @@ jobs:
4545
os: windows-latest
4646
fail-fast: false
4747
runs-on: ${{ matrix.os }}
48+
env:
49+
UV_PYTHON: ${{ matrix.python-version }}
4850
steps:
4951
- name: Dump GitHub context
5052
env:
@@ -58,22 +60,21 @@ jobs:
5860
- name: Setup uv
5961
uses: astral-sh/setup-uv@v7
6062
with:
61-
version: "0.4.15"
6263
enable-cache: true
6364
cache-dependency-glob: |
64-
requirements**.txt
6565
pyproject.toml
66+
uv.lock
6667
# Allow debugging with tmate
6768
- name: Setup tmate session
6869
uses: mxschmitt/action-tmate@v3
6970
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
7071
with:
7172
limit-access-to-actor: true
7273
- name: Install Dependencies
73-
run: uv pip install -r requirements-tests.txt
74+
run: uv sync --locked --no-dev --group tests --extra standard
7475
- run: mkdir coverage
7576
- name: Test
76-
run: bash scripts/test.sh
77+
run: uv run bash scripts/test.sh
7778
env:
7879
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
7980
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
@@ -95,32 +96,32 @@ jobs:
9596
- uses: actions/checkout@v6
9697
- uses: actions/setup-python@v6
9798
with:
98-
python-version: '3.9'
99+
python-version-file: ".python-version"
99100
- name: Setup uv
100101
uses: astral-sh/setup-uv@v7
101102
with:
102-
version: "0.4.15"
103103
enable-cache: true
104104
cache-dependency-glob: |
105-
requirements**.txt
106105
pyproject.toml
106+
uv.lock
107107
- name: Get coverage files
108108
uses: actions/download-artifact@v7
109109
with:
110110
pattern: coverage-*
111111
path: coverage
112112
merge-multiple: true
113-
- run: uv pip install -r requirements-tests.txt
113+
- name: Install dependencies
114+
run: uv sync --locked --no-dev --group tests --extra standard
114115
- run: ls -la coverage
115-
- run: coverage combine coverage
116-
- run: coverage html --title "Coverage for ${{ github.sha }}"
116+
- run: uv run coverage combine coverage
117+
- run: uv run coverage html --title "Coverage for ${{ github.sha }}"
117118
- name: Store coverage HTML
118119
uses: actions/upload-artifact@v6
119120
with:
120121
name: coverage-html
121122
path: htmlcov
122123
include-hidden-files: true
123-
- run: coverage report --fail-under=100
124+
- run: uv run coverage report --fail-under=100
124125

125126
# https://github.com/marketplace/actions/alls-green#why
126127
check: # This job does nothing and is only used for the branch protection

.python-version

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

pyproject.toml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,23 @@ Repository = "https://github.com/fastapi/fastapi-cli"
5757
Issues = "https://github.com/fastapi/fastapi-cli/issues"
5858
Changelog = "https://github.com/fastapi/fastapi-cli/blob/main/release-notes.md"
5959

60+
[dependency-groups]
61+
dev = [
62+
{ include-group = "tests" },
63+
"prek>=0.2.24,<1.0.0",
64+
]
65+
github-actions = [
66+
"smokeshow>=0.5.0",
67+
]
68+
tests = [
69+
"coverage[toml]>=6.2,<8.0",
70+
"fastapi-slim>=0.128.0",
71+
"mypy==1.19.1",
72+
"pytest>=4.4.0,<10.0.0",
73+
"ruff==0.14.10",
74+
"uvicorn>=0.39.0",
75+
]
76+
6077
[build-system]
6178
requires = ["pdm-backend"]
6279
build-backend = "pdm.backend"
@@ -69,9 +86,8 @@ distribution = true
6986
[tool.pdm.build]
7087
source-includes = [
7188
"tests/",
72-
"requirements*.txt",
7389
"scripts/",
74-
]
90+
]
7591

7692
[tool.tiangolo._internal-slim-build.packages.fastapi-cli-slim.project]
7793
name = "fastapi-cli-slim"

requirements-github-actions.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements-tests.txt

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

0 commit comments

Comments
 (0)