Skip to content

Commit 30199ec

Browse files
authored
Use upstream setup-uv with uv python (#305)
1 parent 3ce64d0 commit 30199ec

File tree

2 files changed

+34
-38
lines changed

2 files changed

+34
-38
lines changed

.github/workflows/check.yml

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,23 @@ jobs:
3333
- macos-latest
3434

3535
steps:
36+
- uses: actions/checkout@v4
37+
with:
38+
fetch-depth: 0
3639
- name: Install the latest version of uv
3740
uses: astral-sh/setup-uv@v3
3841
with:
3942
enable-cache: true
43+
cache-dependency-glob: "pyproject.toml"
4044
github-token: ${{ secrets.GITHUB_TOKEN }}
41-
- name: Setup python hatch
42-
uses: actions/setup-python@v5
43-
with:
44-
python-version: "3.12"
45+
- name: Add .local/bin to Windows PATH
46+
if: runner.os == 'Windows'
47+
shell: bash
48+
run: echo "$USERPROFILE/.local/bin" >> $GITHUB_PATH
4549
- name: install hatch
46-
run: uv pip install --system --python 3.12 hatch
47-
- name: Setup python for test ${{ matrix.py }}
48-
uses: actions/setup-python@v5
49-
with:
50-
python-version: ${{ matrix.py }}
51-
allow-prereleases: true
52-
- uses: actions/checkout@v4
53-
with:
54-
fetch-depth: 0
50+
run: uv tool install --python-preference only-managed --python 3.13 hatch
51+
- name: install Python
52+
run: uv python install --python-preference only-managed ${{ matrix.py }}
5553
- name: Pick environment to run
5654
run: |
5755
import codecs; import os
@@ -92,20 +90,17 @@ jobs:
9290
steps:
9391
- name: Let us have colors
9492
run: echo "FORCE_COLOR=true" >> "$GITHUB_ENV"
93+
- uses: actions/checkout@v4
94+
with:
95+
fetch-depth: 0
9596
- name: Install the latest version of uv
9697
uses: astral-sh/setup-uv@v3
9798
with:
9899
enable-cache: true
100+
cache-dependency-glob: "pyproject.toml"
99101
github-token: ${{ secrets.GITHUB_TOKEN }}
100-
- name: Setup python hatch
101-
uses: actions/setup-python@v5
102-
with:
103-
python-version: "3.12"
104102
- name: install hatch
105-
run: uv pip install --system --python 3.12 hatch
106-
- uses: actions/checkout@v4
107-
with:
108-
fetch-depth: 0
103+
run: uv tool install --python-preference only-managed --python 3.13 hatch
109104
- name: Setup coverage tool
110105
run: |
111106
hatch -v env create coverage
@@ -139,20 +134,21 @@ jobs:
139134
- { "name": "docs", "target": "build" }
140135
- { "name": "readme", "target": "run" }
141136
steps:
137+
- uses: actions/checkout@v4
138+
with:
139+
fetch-depth: 0
142140
- name: Install the latest version of uv
143141
uses: astral-sh/setup-uv@v3
144142
with:
145143
enable-cache: true
144+
cache-dependency-glob: "pyproject.toml"
146145
github-token: ${{ secrets.GITHUB_TOKEN }}
147-
- name: Setup python hatch
148-
uses: actions/setup-python@v5
149-
with:
150-
python-version: "3.12"
146+
- name: Add .local/bin to Windows PATH
147+
if: runner.os == 'Windows'
148+
shell: bash
149+
run: echo "$USERPROFILE/.local/bin" >> $GITHUB_PATH
151150
- name: install hatch
152-
run: uv pip install --system --python 3.12 hatch
153-
- uses: actions/checkout@v4
154-
with:
155-
fetch-depth: 0
151+
run: uv tool install --python-preference only-managed --python 3.13 hatch
156152
- name: Setup ${{ matrix.env.name }}
157153
run: |
158154
hatch -v env create ${{ matrix.env.name }}

.github/workflows/release.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ jobs:
1212
permissions:
1313
id-token: write
1414
steps:
15-
- name: Setup python to build package
16-
uses: actions/setup-python@v5
17-
with:
18-
python-version: "3.12"
19-
- name: setup uv for tox
20-
uses: yezz123/setup-uv@v4
21-
- name: Install build
22-
run: uv pip install build[uv] --system
2315
- uses: actions/checkout@v4
2416
with:
2517
fetch-depth: 0
18+
- name: Install the latest version of uv
19+
uses: astral-sh/setup-uv@v3
20+
with:
21+
enable-cache: true
22+
cache-dependency-glob: "pyproject.toml"
23+
github-token: ${{ secrets.GITHUB_TOKEN }}
2624
- name: Build package
27-
run: pyproject-build --installer uv --sdist --wheel . --outdir dist
25+
run: uv build --python 3.13 --python-preference only-managed --sdist --wheel . --out-dir dist
2826
- name: Publish to PyPI
2927
uses: pypa/[email protected]
28+
with:
29+
attestations: true

0 commit comments

Comments
 (0)