Skip to content

Commit 91845ce

Browse files
authored
Modernize package. (#46)
1 parent 306b124 commit 91845ce

File tree

7 files changed

+78
-91
lines changed

7 files changed

+78
-91
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
fail-fast: false
2828
matrix:
2929
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
30-
python-version: ['3.8', '3.9', '3.10', '3.11']
30+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
3131

3232
steps:
3333
- uses: actions/checkout@v4
@@ -44,10 +44,6 @@ jobs:
4444
tox-conda
4545
cache-environment: true
4646

47-
- name: Install core dependencies.
48-
shell: bash -l {0}
49-
run: mamba install -c conda-forge tox-conda coverage mamba
50-
5147
# Unit, integration, and end-to-end tests.
5248

5349
- name: Run unit tests and doctests.

.pre-commit-config.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ repos:
1717
- id: python-no-log-warn
1818
- id: python-use-type-annotations
1919
- id: text-unicode-replacement-char
20-
- repo: https://github.com/asottile/setup-cfg-fmt
21-
rev: v2.5.0
22-
hooks:
23-
- id: setup-cfg-fmt
2420
- repo: https://github.com/astral-sh/ruff-pre-commit
2521
rev: v0.3.7
2622
hooks:
@@ -55,12 +51,6 @@ repos:
5551
types-setuptools
5652
]
5753
pass_filenames: false
58-
- repo: https://github.com/mgedmin/check-manifest
59-
rev: "0.49"
60-
hooks:
61-
- id: check-manifest
62-
args: [--no-build-isolation]
63-
additional_dependencies: [setuptools-scm, wheel, toml]
6454
- repo: meta
6555
hooks:
6656
- id: check-hooks-apply

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ chronological order. Releases follow [semantic versioning](https://semver.org/)
55
releases are available on [PyPI](https://pypi.org/project/pytask-r) and
66
[Anaconda.org](https://anaconda.org/conda-forge/pytask-r).
77

8+
## 0.4.1 - 2024-xx-xx
9+
10+
- {pull}`46` modernizes the package.
11+
812
## 0.4.0 - 2023-10-08
913

1014
- {pull}`42` makes the package compatible with pytask v0.4.0.

pyproject.toml

Lines changed: 66 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,65 @@
1+
[project]
2+
name = "pytask_r"
3+
description = "Run R scripts with pytask."
4+
classifiers = [
5+
"Development Status :: 4 - Beta",
6+
"License :: OSI Approved :: MIT License",
7+
"Operating System :: OS Independent",
8+
"Programming Language :: Python :: 3",
9+
"Programming Language :: Python :: 3 :: Only",
10+
"Programming Language :: R",
11+
]
12+
requires-python = ">=3.8"
13+
dependencies = ["click", "pluggy>=1.0.0", "pytask>=0.4.0"]
14+
dynamic = ["version"]
15+
16+
[[project.authors]]
17+
name = "Tobias Raabe"
18+
19+
20+
[project.readme]
21+
file = "README.md"
22+
content-type = "text/markdown"
23+
24+
[project.license]
25+
text = "MIT"
26+
27+
[project.urls]
28+
Homepage = "https://github.com/pytask-dev/pytask-r"
29+
Changelog = "https://github.com/pytask-dev/pytask-r/blob/main/CHANGES.md"
30+
Documentation = "https://github.com/pytask-dev/pytask-r"
31+
Github = "https://github.com/pytask-dev/pytask-r"
32+
Tracker = "https://github.com/pytask-dev/pytask-r/issues"
33+
34+
[project.entry-points.pytask]
35+
pytask_r = "pytask_r.plugin"
36+
37+
[project.optional-dependencies]
38+
test = ["pytask-parallel", "pytest", "pytest-cov", "pytest-xdist", "pyyaml"]
39+
40+
[tool.rye]
41+
managed = true
42+
143
[build-system]
2-
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"]
3-
build-backend = "setuptools.build_meta"
44+
requires = ["hatchling", "hatch-vcs"]
45+
build-backend = "hatchling.build"
46+
47+
[tool.hatch.build.hooks.vcs]
48+
version-file = "src/pytask_r/_version.py"
49+
50+
[tool.hatch.build.targets.sdist]
51+
exclude = ["tests"]
52+
only-packages = true
53+
54+
[tool.hatch.build.targets.wheel]
55+
exclude = ["tests"]
56+
only-packages = true
57+
58+
[tool.hatch.version]
59+
source = "vcs"
460

5-
[tool.setuptools_scm]
6-
write_to = "src/pytask_r/_version.py"
61+
[tool.hatch.metadata]
62+
allow-direct-references = true
763

864
[tool.mypy]
965
files = ["src", "tests"]
@@ -27,21 +83,16 @@ unsafe-fixes = true
2783

2884
[tool.ruff.lint]
2985
extend-ignore = [
30-
"S101", # raise errors for asserts.
31-
"B905", # strict parameter for zip that was implemented in py310.
32-
"ANN101", # type annotating self
33-
"ANN102", # type annotating cls
34-
"FBT", # flake8-boolean-trap
35-
"EM", # flake8-errmsg
36-
"ANN401", # flake8-annotate typing.Any
37-
"PD", # pandas-vet
38-
"COM812", # Comply with ruff-format
39-
"ISC001", # Comply with ruff-format
86+
"ANN101", # type annotating self
87+
"ANN102", # type annotating cls
88+
"ANN401",
89+
"COM812", # Comply with ruff-format
90+
"ISC001", # Comply with ruff-format
4091
]
4192
select = ["ALL"]
4293

4394
[tool.ruff.lint.per-file-ignores]
44-
"tests/*" = ["D", "ANN"]
95+
"tests/*" = ["D", "ANN", "S101"]
4596

4697
[tool.ruff.lint.pydocstyle]
4798
convention = "numpy"

setup.cfg

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

src/pytask_r/execute.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ def pytask_execute_task_setup(task: PTask) -> None:
2727
)
2828
raise RuntimeError(msg)
2929

30-
assert len(marks) == 1
30+
if len(marks) > 1:
31+
msg = "Only one R marker is allowed per task."
32+
raise ValueError(msg)
3133

32-
_, _, serializer, suffix = r(**marks[0].kwargs)
33-
assert serializer
34-
assert suffix
34+
_, _, serializer, _ = r(**marks[0].kwargs)
3535

3636
serialized_node: PythonNode = task.depends_on["_serialized"] # type: ignore[assignment]
3737
serialized_node.value.parent.mkdir(parents=True, exist_ok=True) # type: ignore[union-attr]

tox.ini

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,17 @@
22
envlist = pytest
33

44
[testenv]
5+
# Cannot use package = editable, because tox-conda does not support tox v4.
56
usedevelop = true
67

7-
[testenv:pytest]
8+
[testenv:test]
9+
extras = test
810
conda_channels =
911
conda-forge
10-
conda-forge/label/pytask_rc
11-
conda-forge/label/pytask_parallel_rc
1212
nodefaults
1313
conda_deps =
14-
pytask >=0.4.0
15-
pytask-parallel >=0.4.0
16-
17-
# Optional dependencies.
18-
pyyaml
1914
r-base >=4
2015
r-jsonlite
2116
r-yaml
22-
23-
pytest
24-
pytest-cov
25-
pytest-xdist
2617
commands =
2718
pytest {posargs}

0 commit comments

Comments
 (0)