Skip to content

Commit 8c58a35

Browse files
Replace references to uv pip install with uv sync
1 parent cc929b7 commit 8c58a35

File tree

5 files changed

+20
-29
lines changed

5 files changed

+20
-29
lines changed
Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: Install requirements
2-
description: Install a version of python then call pip install and report what was installed
2+
description: Install uv, use it to install dependencies and report what was installed
33
inputs:
44
python-version:
55
description: Python version to install, default is from Dockerfile
66
default: "dev"
7-
pip-install:
8-
description: Parameters to pass to uv pip install
9-
default: "$([ -f dev-requirements.txt ] && echo '-c dev-requirements.txt') -e .[dev]"
7+
uv-sync:
8+
description: Parameters to pass to uv sync
9+
default: "--locked --no-dev"
1010

1111
runs:
1212
using: composite
@@ -28,17 +28,8 @@ runs:
2828
cache-dependency-glob: "uv.lock"
2929

3030
- name: Install packages
31-
run: uv pip install ${{ inputs.pip-install }}
31+
run: uv sync ${{ inputs.uv-sync }}
3232
shell: bash
3333

3434
- name: Report what was installed
35-
run: uv pip list
36-
shell: bash
37-
38-
- name: Add venv path to Github environment
39-
run: echo "VENV_PATH=.venv" >> $GITHUB_ENV
40-
shell: bash
41-
42-
- name: Add venv path to Github Path
43-
run: echo "${{ env.VENV_PATH }}/bin:$PATH" >> $GITHUB_PATH
44-
shell: bash
35+
run: uv pip freeze

.github/workflows/_dist.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ jobs:
2727
run: pipx run twine check --strict dist/*
2828

2929
- name: Install produced wheel
30-
uses: ./.github/actions/install_requirements
31-
with:
32-
pip-install: dist/*.whl
30+
run: pipx run pip install dist/*.whl
3331

3432
- name: Test module --version works using the installed wheel
3533
# If more than one module in src/ replace with module name to test

.github/workflows/_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
uses: ./.github/actions/install_requirements
4949
with:
5050
python-version: ${{ inputs.python-version }}
51-
pip-install: ".[dev]"
51+
uv-sync: "--locked"
5252

5353
- name: Run tests
5454
run: tox -e tests

template/pyproject.toml.jinja

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ license.file = "LICENSE"
1818
readme = "README.md"
1919
requires-python = ">=3.11"
2020

21-
[project.optional-dependencies]
21+
[dependency-groups]
2222
dev = [
2323
"build",
2424
"copier",
@@ -49,9 +49,6 @@ GitHub = "{{ repo_url }}"
4949
email = "{{ author_email }}"
5050
name = "{{ author_name }}"
5151

52-
[tool.uv]
53-
default-groups = []
54-
5552
[tool.setuptools_scm]
5653
version_file = "src/{{ package_name }}/_version.py"
5754
{% if type_checker=="pyright" %}

tests/test_example.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,16 @@ def run_pipe(cmd: str, cwd=None):
3838

3939
def make_venv(project_path: Path) -> callable:
4040
venv_path = project_path / ".venv"
41-
run_pipe(f"uv venv {venv_path}")
4241
run = functools.partial(run_pipe, cwd=str(project_path))
43-
# install to this env (hence the -p)
44-
run(f"uv pip install -e .[dev] -p {venv_path}/bin/python")
45-
# run("ls -la .venv/bin >&2")
42+
run("uv sync") # Create a lockfile and install packages
43+
44+
for exe_path in [
45+
venv_path / "bin" / "tox",
46+
venv_path / "bin" / "python",
47+
venv_path / "bin" / "uv",
48+
]:
49+
assert exe_path.exists(), f"UV created a venv but did not install {exe_path}"
50+
4651
return run
4752

4853

@@ -60,8 +65,8 @@ def test_template_defaults(tmp_path: Path):
6065
# Only run linkcheck if not on a tag, as the CI might not have pushed
6166
# the docs for this tag yet, so we will fail
6267
run(".venv/bin/tox -p -e docs -- -b linkcheck")
63-
run(".venv/bin/uv pip install build twine")
64-
run(".venv/bin/python -m build")
68+
run(".venv/bin/uv pip install twine")
69+
run(".venv/bin/uv build")
6570
run(".venv/bin/twine check --strict dist/*")
6671

6772

0 commit comments

Comments
 (0)