Skip to content

Commit 9ae05f5

Browse files
authored
Release v0.4.0. (#24)
1 parent ad5c098 commit 9ae05f5

19 files changed

+273
-569
lines changed

.github/workflows/main.yml

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,17 @@ 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
34-
- uses: mamba-org/setup-micromamba@v1
34+
- uses: julia-actions/setup-julia@v1
35+
- uses: actions/setup-python@v4
3536
with:
36-
environment-name: gha-testing
37-
condarc: |
38-
channels:
39-
- nodefaults
40-
- conda-forge
41-
create-args: >-
42-
python=${{ matrix.python-version }}
43-
mamba
44-
tox-conda
45-
cache-environment: true
46-
47-
- name: Install core dependencies.
48-
shell: bash -l {0}
49-
run: mamba install -c conda-forge tox-conda coverage mamba
37+
python-version: ${{ matrix.python-version }}
38+
cache: pip
39+
allow-prereleases: true
40+
- run: pip install tox
5041

5142
# Unit, integration, and end-to-end tests.
5243

@@ -55,7 +46,7 @@ jobs:
5546
run: tox -e pytest -- -m "unit or (not integration and not end_to_end)" --cov=./ --cov-report=xml -n auto
5647

5748
- name: Upload coverage report for unit tests and doctests.
58-
if: runner.os == 'Linux' && matrix.python-version == '3.8'
49+
if: runner.os == 'Linux' && matrix.python-version == '3.10'
5950
shell: bash -l {0}
6051
run: bash <(curl -s https://codecov.io/bash) -F unit -c
6152

@@ -64,6 +55,6 @@ jobs:
6455
run: tox -e pytest -- -m end_to_end --cov=./ --cov-report=xml -n auto
6556

6657
- name: Upload coverage reports of end-to-end tests.
67-
if: runner.os == 'Linux' && matrix.python-version == '3.8'
58+
if: runner.os == 'Linux' && matrix.python-version == '3.10'
6859
shell: bash -l {0}
6960
run: bash <(curl -s https://codecov.io/bash) -F end_to_end -c

.pre-commit-config.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,10 @@ repos:
6464
rev: 'v1.5.1'
6565
hooks:
6666
- id: mypy
67-
args: [
68-
--no-strict-optional,
69-
--ignore-missing-imports,
70-
]
7167
additional_dependencies: [
7268
attrs>=21.3.0,
7369
click,
70+
pytask>=0.4.0,
7471
types-PyYAML,
7572
types-setuptools
7673
]

CHANGES.md

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

8-
## 0.3.0 - 2023-xx-xx
8+
## 0.4.0 - 2023-10-08
9+
10+
- {pull}`24` prepares the release of pytask v0.4.0.
11+
12+
## 0.3.0 - 2023-01-24
913

1014
- {pull}`16` adds mypy, refurb, and ruff.
1115
- {pull}`18` deprecates INI configurations and aligns the package with pytask v0.3.

README.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ task module to the Julia script.
5050

5151
```python
5252
import pytask
53+
from pathlib import Path
54+
from pytask import task
5355

5456

57+
@task(kwargs={"path": Path("out.csv")})
5558
@pytask.mark.julia(script="script.jl")
56-
@pytask.mark.produces("out.csv")
5759
def task_run_jl_script():
5860
pass
5961
```
@@ -64,11 +66,12 @@ more information.
6466

6567
### Dependencies and Products
6668

67-
Dependencies and products can be added as with a normal pytask task using the
68-
`@pytask.mark.depends_on` and `@pytask.mark.produces` decorators. which is explained in
69-
this
69+
Dependencies and products can be added as usual. Read this
7070
[tutorial](https://pytask-dev.readthedocs.io/en/stable/tutorials/defining_dependencies_products.html).
7171

72+
For example, with the `@pytask.task` decorator as shown before. (The choice of the kwarg
73+
name, here `path`, is arbitrary.)
74+
7275
### Accessing dependencies and products in the script
7376

7477
To access the paths of dependencies and products in the script, pytask-julia stores the
@@ -82,21 +85,19 @@ path_to_json = ARGS[1] # Contains the path to the .json file.
8285

8386
config = JSON.parse(read(path_to_json, String)) # A dictionary.
8487

85-
config["produces"] # Is the path to the output file "../out.csv".
88+
config["path"] # Is the path to the output file "../out.csv".
8689
```
8790

8891
The `.json` file is stored in the same folder as the task in a `.pytask` directory.
8992

9093
To parse the JSON file, you need to install
9194
[JSON.jl](https://github.com/JuliaIO/JSON.jl).
9295

93-
You can also pass any other information to your script by using the `@pytask.mark.task`
94-
decorator.
96+
You can also pass any other information to your script by using the `@task` decorator.
9597

9698
```python
97-
@pytask.mark.task(kwargs={"number": 1})
99+
@task(kwargs={"path": Path("out.csv"), "number": 1})
98100
@pytask.mark.julia(script="script.jl")
99-
@pytask.mark.produces("out.csv")
100101
def task_run_jl_script():
101102
pass
102103
```
@@ -141,8 +142,8 @@ You can also define environments for each task which will overwrite any other de
141142
with the `project` keyword argument. Pass a path to the task module.
142143

143144
```python
145+
@task(kwargs={"path": Path("out.csv")})
144146
@pytask.mark.julia(script="script.jl", project=".")
145-
@pytask.mark.produces("out.csv")
146147
def task_run_jl_script():
147148
pass
148149
```
@@ -152,8 +153,8 @@ def task_run_jl_script():
152153
Command line options can be pass via the `options` keyword argument.
153154

154155
```python
156+
@task(kwargs={"path": Path("out.csv")})
155157
@pytask.mark.julia(script="script.jl", options=["--threads", "2"])
156-
@pytask.mark.produces("out.csv")
157158
def task_run_jl_script():
158159
pass
159160
```
@@ -171,22 +172,20 @@ produce different outputs.
171172
```python
172173
for i in range(2):
173174

174-
@pytask.mark.task
175+
@task(kwargs={"path": Path(f"out_{i}.csv")})
175176
@pytask.mark.julia(script=f"script_{i}.jl")
176-
@pytask.mark.produces(f"out_{i}.csv")
177177
def task_execute_julia_script():
178178
pass
179179
```
180180

181181
If you want to pass different inputs to the same Julia script, pass these arguments with
182-
the `kwargs` keyword of the `@pytask.mark.task` decorator.
182+
the `kwargs` keyword of the `@task` decorator.
183183

184184
```python
185185
for i in range(2):
186186

187-
@pytask.mark.task(kwargs={"i": i})
187+
@task(kwargs={"path": Path(f"out_{i}.csv"), "i": i})
188188
@pytask.mark.julia(script="script.jl")
189-
@pytask.mark.produces(f"output_{i}.csv")
190189
def task_execute_julia_script():
191190
pass
192191
```
@@ -200,7 +199,7 @@ path_to_json = ARGS[1] # Contains the path to the .json file.
200199

201200
config = JSON.parse(read(path_to_json, String)) # A dictionary.
202201

203-
config["produces"] # Is the path to the output file "../output_{i}.csv".
202+
config["path"] # Is the path to the output file "../output_{i}.csv".
204203

205204
config["i"] # Is the number.
206205
```

environment.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: pytask-julia
22

33
channels:
44
- conda-forge
5+
- conda-forge/label/pytask_rc
6+
- conda-forge/label/pytask_parallel_rc
57
- nodefaults
68

79
dependencies:
@@ -12,8 +14,8 @@ dependencies:
1214

1315
# Package dependencies
1416
- julia
15-
- pytask >=0.3
16-
- pytask-parallel >=0.3
17+
- pytask >=0.4.0
18+
- pytask-parallel >=0.4.0
1719

1820
# Optional package dependencies
1921
- pyyaml

pyproject.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,14 @@ extend-ignore = [
6262

6363
[tool.ruff.pydocstyle]
6464
convention = "numpy"
65+
66+
[tool.pytest.ini_options]
67+
# Do not add src since it messes with the loading of pytask-parallel as a plugin.
68+
testpaths = ["tests"]
69+
markers = [
70+
"wip: Tests that are work-in-progress.",
71+
"unit: Flag for unit tests which target mainly a single function.",
72+
"integration: Flag for integration tests which may comprise of multiple unit tests.",
73+
"end_to_end: Flag for tests that cover the whole program.",
74+
]
75+
norecursedirs = [".idea", ".tox"]

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ project_urls =
2424
[options]
2525
packages = find:
2626
install_requires =
27-
pybaum>=0.1.1
28-
pytask>=0.3
27+
pluggy>=1.0.0
28+
pytask>=0.4.0
2929
python_requires = >=3.8
3030
include_package_data = True
3131
package_dir = =src

0 commit comments

Comments
 (0)