Skip to content

Commit fe90c1c

Browse files
authored
Switch pytask-r from pixi to uv (#75)
1 parent 4c7ee56 commit fe90c1c

14 files changed

Lines changed: 842 additions & 14076 deletions

.github/workflows/main.yml

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,46 +23,39 @@ jobs:
2323

2424
steps:
2525
- uses: actions/checkout@v5
26-
- uses: prefix-dev/setup-pixi@v0.9.2
26+
- uses: astral-sh/setup-uv@v7
2727
with:
28-
cache: true
29-
environments: typing
30-
- run: pixi run typing
28+
enable-cache: true
29+
- name: Install just
30+
uses: extractions/setup-just@v3
31+
- name: Run type checking
32+
run: just typing
3133

3234
run-tests:
3335

34-
name: Run tests for ${{ matrix.os }} on ${{ matrix.environment }}
36+
name: Run tests for ${{ matrix.os }} on ${{ matrix.python-version }}
3537
runs-on: ${{ matrix.os }}
3638

3739
strategy:
3840
fail-fast: false
3941
matrix:
4042
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
41-
environment: ['py310', 'py311', 'py312', 'py313', 'py314']
43+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
4244

4345
steps:
4446
- uses: actions/checkout@v5
45-
- uses: prefix-dev/setup-pixi@v0.9.2
47+
- uses: r-lib/actions/setup-r@v2
48+
- name: Install R packages
49+
run: Rscript -e 'install.packages(c("jsonlite", "yaml"), repos="https://cloud.r-project.org")'
50+
- uses: astral-sh/setup-uv@v7
4651
with:
47-
cache: true
48-
environments: ${{ matrix.environment }}
52+
python-version: ${{ matrix.python-version }}
53+
enable-cache: true
54+
- name: Install just
55+
uses: extractions/setup-just@v3
4956

50-
# Unit, integration, and end-to-end tests.
57+
- name: Run tests
58+
run: just test-cov
5159

52-
- name: Run unit tests and doctests.
53-
shell: bash -l {0}
54-
run: pixi run -e ${{ matrix.environment }} test -m "unit or (not integration and not end_to_end)" --cov-report=xml -n auto
55-
56-
- name: Upload unit test coverage reports to Codecov with GitHub Action
57-
uses: codecov/codecov-action@v5
58-
with:
59-
flags: unit
60-
61-
- name: Run end-to-end tests.
62-
shell: bash -l {0}
63-
run: pixi run -e ${{ matrix.environment }} test -m end_to_end --cov-report=xml -n auto
64-
65-
- name: Upload end_to_end test coverage reports to Codecov with GitHub Action
60+
- name: Upload test coverage reports to Codecov with GitHub Action
6661
uses: codecov/codecov-action@v5
67-
with:
68-
flags: end_to_end

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,4 @@ src/pytask_r/_version.py
2121
.mypy_cache
2222
.ruff_cache
2323
.pytest_cache
24-
# pixi environments
25-
.pixi
2624
*.egg-info

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ repos:
44
hooks:
55
- id: check-added-large-files
66
args: ['--maxkb=25']
7+
exclude: ^uv\.lock$
78
- id: check-case-conflict
89
- id: check-merge-conflict
910
- id: check-vcs-permalinks

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ releases are available on [PyPI](https://pypi.org/project/pytask-r) and
77

88
## 0.4.2 - 2024-xx-xx
99

10+
- {pull}`75` switches CI and development tooling from pixi to uv.
1011
- {pull}`50` uses pixi to install R and uses uuid4 to generate more robust file names
1112
for serialized arguments.
1213
- {pull}`51` reenables testing with different Python versions.

justfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Install all dependencies
2+
install:
3+
uv sync --all-groups
4+
5+
# Run tests
6+
test *FLAGS:
7+
uv run --group test pytest {{FLAGS}}
8+
9+
# Run tests with coverage
10+
test-cov *FLAGS:
11+
uv run --group test pytest --cov=src --cov=tests --cov-report=xml -n auto {{FLAGS}}
12+
13+
# Run type checking
14+
typing:
15+
uv run --group typing --group test ty check src/ tests/
16+
17+
# Run linting
18+
lint:
19+
uvx prek run -a
20+
21+
# Run all checks (format, lint, typing, test)
22+
check: lint typing test

pixi.lock

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

pyproject.toml

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Tracker = "https://github.com/pytask-dev/pytask-r/issues"
3434
[project.entry-points.pytask]
3535
pytask_r = "pytask_r.plugin"
3636

37-
[project.optional-dependencies]
37+
[dependency-groups]
3838
test = ["pytask-parallel", "pytest", "pytest-cov", "pytest-xdist", "pyyaml"]
3939
typing = ["ty>=0.0.7"]
4040

@@ -60,7 +60,6 @@ source = "vcs"
6060
allow-direct-references = true
6161

6262
[tool.ruff]
63-
target-version = "py310"
6463
fix = true
6564
unsafe-fixes = true
6665

@@ -105,57 +104,5 @@ unused-ignore-comment = "ignore"
105104
[tool.pytest.ini_options]
106105
testpaths = ["tests"]
107106
markers = [
108-
"wip: Tests that are work-in-progress.",
109-
"unit: Flag for unit tests which target mainly a single function.",
110-
"integration: Flag for integration tests which may comprise of multiple unit tests.",
111-
"end_to_end: Flag for tests that cover the whole program.",
112107
]
113108
norecursedirs = [".idea", ".tox"]
114-
115-
[tool.pixi.workspace]
116-
channels = ["conda-forge"]
117-
platforms = ["win-64", "linux-64", "osx-64", "osx-arm64"]
118-
119-
[tool.pixi.target.osx-64.dependencies]
120-
libgfortran5 = ">=14.2.0"
121-
122-
[tool.pixi.target.osx-arm64.dependencies]
123-
libgfortran5 = ">=14.2.0"
124-
125-
[tool.pixi.pypi-dependencies]
126-
pytask_r = { path = ".", editable = true }
127-
128-
[tool.pixi.environments]
129-
default = { solve-group = "default" }
130-
test = { features = ["test"], solve-group = "default" }
131-
typing = { features = ["test", "typing"], solve-group = "default" }
132-
py310 = { features = ["py310", "test"]}
133-
py311 = { features = ["py311", "test"]}
134-
py312 = { features = ["py312", "test"]}
135-
py313 = { features = ["py313", "test"]}
136-
py314 = { features = ["py314", "test"]}
137-
138-
[tool.pixi.feature.py310.dependencies]
139-
python = "3.10.*"
140-
[tool.pixi.feature.py311.dependencies]
141-
python = "3.11.*"
142-
[tool.pixi.feature.py312.dependencies]
143-
python = "3.12.*"
144-
[tool.pixi.feature.py313.dependencies]
145-
python = "3.13.*"
146-
[tool.pixi.feature.py314.dependencies]
147-
python = "3.14.*"
148-
149-
[tool.pixi.feature.test.dependencies]
150-
r-base = ">=4.0.0"
151-
r-jsonlite = "*"
152-
r-yaml = "*"
153-
154-
[tool.pixi.feature.test.tasks]
155-
test = "pytest --cov src --cov tests"
156-
157-
[tool.pixi.feature.typing.dependencies]
158-
ty = ">=0.0.7"
159-
160-
[tool.pixi.feature.typing.tasks]
161-
typing = "ty check src/ tests/"

tests/test_collect.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from pytask_r.serialization import SERIALIZERS
1111

1212

13-
@pytest.mark.unit
1413
@pytest.mark.parametrize(
1514
("args", "kwargs", "expectation", "expected"),
1615
[
@@ -44,7 +43,6 @@ def test_r(args, kwargs, expectation, expected):
4443
assert result == expected
4544

4645

47-
@pytest.mark.unit
4846
@pytest.mark.parametrize(
4947
(
5048
"mark",

tests/test_config.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
from __future__ import annotations
22

3-
import pytest
43
from pytask import build
54

65

7-
@pytest.mark.end_to_end
86
def test_marker_is_configured(tmp_path):
97
session = build(paths=tmp_path)
108
assert "r" in session.config["markers"]

tests/test_execute.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from tests.conftest import parametrize_parse_code_serializer_suffix
1616

1717

18-
@pytest.mark.unit
1918
def test_pytask_execute_task_setup(monkeypatch):
2019
"""Make sure that the task setup raises errors."""
2120
# Act like r is installed since we do not test this.
@@ -33,7 +32,6 @@ def test_pytask_execute_task_setup(monkeypatch):
3332

3433

3534
@needs_rscript
36-
@pytest.mark.end_to_end
3735
@parametrize_parse_code_serializer_suffix
3836
@pytest.mark.parametrize(
3937
"depends_on",
@@ -75,7 +73,6 @@ def task_run_r_script(
7573

7674

7775
@needs_rscript
78-
@pytest.mark.end_to_end
7976
@parametrize_parse_code_serializer_suffix
8077
def test_run_r_script_w_task_decorator(
8178
runner, tmp_path, parse_config_code, serializer, suffix
@@ -105,7 +102,6 @@ def run_r_script(produces=Path("out.txt")): ...
105102

106103

107104
@needs_rscript
108-
@pytest.mark.end_to_end
109105
@parametrize_parse_code_serializer_suffix
110106
def test_raise_error_if_rscript_is_not_found(
111107
tmp_path, monkeypatch, parse_config_code, serializer, suffix
@@ -139,7 +135,6 @@ def task_run_r_script(produces=Path("out.txt")): ...
139135

140136

141137
@needs_rscript
142-
@pytest.mark.end_to_end
143138
@parametrize_parse_code_serializer_suffix
144139
def test_run_r_script_w_saving_workspace(
145140
runner, tmp_path, parse_config_code, serializer, suffix
@@ -174,7 +169,6 @@ def task_run_r_script(produces=Path("out.txt")): ...
174169

175170

176171
@needs_rscript
177-
@pytest.mark.end_to_end
178172
@parametrize_parse_code_serializer_suffix
179173
def test_run_r_script_w_wrong_cmd_option(
180174
runner, tmp_path, parse_config_code, serializer, suffix
@@ -209,7 +203,6 @@ def task_run_r_script(produces=Path("out.txt")): ...
209203

210204

211205
@needs_rscript
212-
@pytest.mark.end_to_end
213206
def test_run_r_script_w_custom_serializer(runner, tmp_path):
214207
task_source = """
215208
import pytask
@@ -239,7 +232,6 @@ def task_run_r_script(produces=Path("out.txt")): ...
239232

240233

241234
@needs_rscript
242-
@pytest.mark.end_to_end
243235
def test_run_r_script_fails_w_multiple_markers(runner, tmp_path):
244236
task_source = """
245237
import pytask
@@ -259,7 +251,6 @@ def task_run_r_script(produces=Path("out.txt")): ...
259251

260252

261253
@needs_rscript
262-
@pytest.mark.end_to_end
263254
def test_run_r_script_with_capital_extension(runner, tmp_path):
264255
task_source = """
265256
import pytask
@@ -287,7 +278,6 @@ def task_run_r_script(produces=Path("out.txt")): ...
287278

288279

289280
@needs_rscript
290-
@pytest.mark.end_to_end
291281
@parametrize_parse_code_serializer_suffix
292282
def test_run_r_script_w_nested_inputs(
293283
runner, tmp_path, parse_config_code, serializer, suffix

0 commit comments

Comments
 (0)