Skip to content

Commit b8129b8

Browse files
authored
Deprecate INI configurations and align with pytask v0.3. (#18)
1 parent 2211f4d commit b8129b8

File tree

13 files changed

+84
-121
lines changed

13 files changed

+84
-121
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040

4141
- name: Install core dependencies.
4242
shell: bash -l {0}
43-
run: conda install -c conda-forge tox-conda coverage mamba
43+
run: mamba install -c conda-forge tox-conda coverage mamba
4444

4545
# Unit, integration, and end-to-end tests.
4646

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-julia) and
66
[Anaconda.org](https://anaconda.org/conda-forge/pytask-julia).
77

8+
## 0.3.0 - 2023-xx-xx
9+
10+
- {pull}`18` deprecates INI configurations and aligns the package with pytask v0.3.
11+
812
## 0.2.1 - 2022-04-16
913

1014
- {pull}`12` includes `pyproject.toml` in the package.

Manifest.toml

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# This file is machine-generated - editing it directly is not advised
22

3-
julia_version = "1.7.1"
3+
julia_version = "1.8.5"
44
manifest_format = "2.0"
5+
project_hash = "df1f4ff6ff5c9fd1541ff7a0d1e10d339e63d6ac"
56

67
[[deps.ArgTools]]
78
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
9+
version = "1.1.1"
810

911
[[deps.Artifacts]]
1012
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
@@ -19,6 +21,7 @@ uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
1921
[[deps.Downloads]]
2022
deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"]
2123
uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
24+
version = "1.6.0"
2225

2326
[[deps.FileWatching]]
2427
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
@@ -42,10 +45,12 @@ version = "0.21.3"
4245
[[deps.LibCURL]]
4346
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
4447
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
48+
version = "0.6.3"
4549

4650
[[deps.LibCURL_jll]]
4751
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"]
4852
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"
53+
version = "7.84.0+0"
4954

5055
[[deps.LibGit2]]
5156
deps = ["Base64", "NetworkOptions", "Printf", "SHA"]
@@ -54,15 +59,16 @@ uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
5459
[[deps.LibSSH2_jll]]
5560
deps = ["Artifacts", "Libdl", "MbedTLS_jll"]
5661
uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8"
62+
version = "1.10.2+0"
5763

5864
[[deps.Libdl]]
5965
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
6066

6167
[[deps.Libiconv_jll]]
6268
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
63-
git-tree-sha1 = "42b62845d70a619f063a7da093d995ec8e15e778"
69+
git-tree-sha1 = "c7cb1f5d892775ba13767a87c7ada0b980ea0a71"
6470
uuid = "94ce4f54-9a6c-5748-9c1c-f9c7231a4531"
65-
version = "1.16.1+1"
71+
version = "1.16.1+2"
6672

6773
[[deps.Logging]]
6874
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
@@ -74,31 +80,35 @@ uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
7480
[[deps.MbedTLS_jll]]
7581
deps = ["Artifacts", "Libdl"]
7682
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
83+
version = "2.28.0+0"
7784

7885
[[deps.Mmap]]
7986
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
8087

8188
[[deps.MozillaCACerts_jll]]
8289
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
90+
version = "2022.2.1"
8391

8492
[[deps.NetworkOptions]]
8593
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
94+
version = "1.2.0"
8695

8796
[[deps.Parsers]]
88-
deps = ["Dates"]
89-
git-tree-sha1 = "13468f237353112a01b2d6b32f3d0f80219944aa"
97+
deps = ["Dates", "SnoopPrecompile"]
98+
git-tree-sha1 = "6466e524967496866901a78fca3f2e9ea445a559"
9099
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
91-
version = "2.2.2"
100+
version = "2.5.2"
92101

93102
[[deps.Pkg]]
94103
deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
95104
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
105+
version = "1.8.0"
96106

97107
[[deps.Preferences]]
98108
deps = ["TOML"]
99-
git-tree-sha1 = "2cf929d64681236a2e074ffafb8d568733d2e6af"
109+
git-tree-sha1 = "47e5f437cc0e7ef2ce8406ce1e7e24d44915f88d"
100110
uuid = "21216c6a-2e73-6563-6e65-726566657250"
101-
version = "1.2.3"
111+
version = "1.3.0"
102112

103113
[[deps.Printf]]
104114
deps = ["Unicode"]
@@ -114,10 +124,16 @@ uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
114124

115125
[[deps.SHA]]
116126
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
127+
version = "0.7.0"
117128

118129
[[deps.Serialization]]
119130
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
120131

132+
[[deps.SnoopPrecompile]]
133+
git-tree-sha1 = "f604441450a3c0569830946e5b33b78c928e1a85"
134+
uuid = "66db9d55-30c0-4569-8b51-7e840670fc0c"
135+
version = "1.0.1"
136+
121137
[[deps.Sockets]]
122138
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
123139

@@ -130,10 +146,12 @@ version = "0.3.5"
130146
[[deps.TOML]]
131147
deps = ["Dates"]
132148
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
149+
version = "1.0.0"
133150

134151
[[deps.Tar]]
135152
deps = ["ArgTools", "SHA"]
136153
uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
154+
version = "1.10.1"
137155

138156
[[deps.UUIDs]]
139157
deps = ["Random", "SHA"]
@@ -144,18 +162,21 @@ uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
144162

145163
[[deps.YAML]]
146164
deps = ["Base64", "Dates", "Printf", "StringEncodings"]
147-
git-tree-sha1 = "3c6e8b9f5cdaaa21340f841653942e1a6b6561e5"
165+
git-tree-sha1 = "dbc7f1c0012a69486af79c8bcdb31be820670ba2"
148166
uuid = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"
149-
version = "0.4.7"
167+
version = "0.4.8"
150168

151169
[[deps.Zlib_jll]]
152170
deps = ["Libdl"]
153171
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
172+
version = "1.2.12+3"
154173

155174
[[deps.nghttp2_jll]]
156175
deps = ["Artifacts", "Libdl"]
157176
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
177+
version = "1.48.0+0"
158178

159179
[[deps.p7zip_jll]]
160180
deps = ["Artifacts", "Libdl"]
161181
uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"
182+
version = "17.4.0+0"

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![image](https://img.shields.io/conda/vn/conda-forge/pytask-julia.svg)](https://anaconda.org/conda-forge/pytask-julia)
66
[![image](https://img.shields.io/conda/pn/conda-forge/pytask-julia.svg)](https://anaconda.org/conda-forge/pytask-julia)
77
[![PyPI - License](https://img.shields.io/pypi/l/pytask-julia)](https://pypi.org/project/pytask-julia)
8-
[![image](https://img.shields.io/github/workflow/status/pytask-dev/pytask-julia/main/main)](https://github.com/pytask-dev/pytask-julia/actions?query=branch%3Amain)
8+
[![image](https://img.shields.io/github/actions/workflow/status/pytask-dev/pytask-julia/main.yml?branch=main)](https://github.com/pytask-dev/pytask-julia/actions?query=branch%3Amain)
99
[![image](https://codecov.io/gh/pytask-dev/pytask-julia/branch/main/graph/badge.svg)](https://codecov.io/gh/pytask-dev/pytask-julia)
1010
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/pytask-dev/pytask-julia/main.svg)](https://results.pre-commit.ci/latest/github/pytask-dev/pytask-julia/main)
1111
[![image](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
@@ -296,3 +296,16 @@ julia_project = "environment"
296296
## Changes
297297

298298
Consult the [release notes](CHANGES.md) to find out about what is new.
299+
300+
## Development
301+
302+
After setting up the environment, enter
303+
304+
```console
305+
$ julia
306+
$ ]
307+
$ pkg> activate .
308+
$ pkg> instantiate
309+
```
310+
311+
to set up the Julia environment.

environment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ dependencies:
1212

1313
# Package dependencies
1414
- julia
15-
- pytask >=0.2
16-
- pytask-parallel >=0.1
15+
- pytask >=0.3
16+
- pytask-parallel >=0.3
1717

1818
# Optional package dependencies
1919
- pyyaml

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ project_urls =
2525
packages = find:
2626
install_requires =
2727
pybaum>=0.1.1
28-
pytask>=0.2
28+
pytask>=0.3
2929
python_requires = >=3.7
3030
include_package_data = True
3131
package_dir = =src

src/pytask_julia/collect.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from pytask import produces
1515
from pytask import remove_marks
1616
from pytask import Task
17-
from pytask_julia.serialization import SERIALIZER
17+
from pytask_julia.serialization import SERIALIZERS
1818
from pytask_julia.shared import julia
1919
from pytask_julia.shared import parse_relative_path
2020

@@ -122,9 +122,9 @@ def _parse_julia_mark(
122122

123123
if (
124124
isinstance(parsed_kwargs["serializer"], str)
125-
and parsed_kwargs["serializer"] in SERIALIZER
125+
and parsed_kwargs["serializer"] in SERIALIZERS
126126
):
127-
proposed_suffix = SERIALIZER[parsed_kwargs["serializer"]]["suffix"]
127+
proposed_suffix = SERIALIZERS[parsed_kwargs["serializer"]]["suffix"]
128128
else:
129129
proposed_suffix = default_suffix
130130
parsed_kwargs["suffix"] = suffix if suffix else proposed_suffix

src/pytask_julia/config.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,39 @@
11
"""Configure pytask."""
22
from __future__ import annotations
33

4+
from typing import Any
5+
46
from pytask import hookimpl
7+
from pytask_julia.serialization import SERIALIZERS
58
from pytask_julia.shared import parse_relative_path
69

710

811
@hookimpl
9-
def pytask_parse_config(config, config_from_file):
12+
def pytask_parse_config(config):
1013
"""Register the julia marker."""
1114
config["markers"]["julia"] = "Tasks which are executed with Julia."
12-
config["julia_serializer"] = config_from_file.get("julia_serializer", "json")
13-
config["julia_suffix"] = config_from_file.get("julia_suffix", "")
15+
config["julia_serializer"] = config.get("julia_serializer", "json")
16+
if config["julia_serializer"] not in SERIALIZERS:
17+
raise ValueError(
18+
f"'julia_serializer' is {config['julia_serializer']} and not one of "
19+
f"{list(SERIALIZERS)}."
20+
)
21+
config["julia_suffix"] = config.get("julia_suffix", "")
1422
config["julia_options"] = _parse_value_or_whitespace_option(
15-
config_from_file.get("julia_options")
23+
config.get("julia_options")
1624
)
17-
project = config_from_file.get("julia_project")
25+
project = config.get("julia_project")
1826
if project is None:
1927
config["julia_project"] = project
2028
else:
2129
config["julia_project"] = parse_relative_path(project, config["root"])
2230

2331

24-
def _parse_value_or_whitespace_option(value: str | None) -> None | str | list[str]:
32+
def _parse_value_or_whitespace_option(value: Any) -> None | list[str]:
2533
"""Parse option which can hold a single value or values separated by new lines."""
26-
if value in ["none", "None", None, ""]:
34+
if value is None:
2735
return None
28-
elif isinstance(value, list):
36+
if isinstance(value, list):
2937
return list(map(str, value))
30-
elif isinstance(value, str):
31-
return [v.strip() for v in value.split(" ") if v.strip()]
3238
else:
33-
raise ValueError(f"Input {value!r} is neither a 'str' nor 'None'.")
39+
raise ValueError(f"'julia_options' is {value} and not a list.")

src/pytask_julia/serialization.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
_HIDDEN_FOLDER = ".pytask"
1313

1414

15-
SERIALIZER = {
15+
SERIALIZERS = {
1616
"json": {"serializer": json.dumps, "suffix": ".json"},
1717
}
1818

@@ -21,8 +21,8 @@
2121
except ImportError: # pragma: no cover
2222
pass
2323
else:
24-
SERIALIZER["yaml"] = {"serializer": yaml.dump, "suffix": ".yaml"}
25-
SERIALIZER["yml"] = {"serializer": yaml.dump, "suffix": ".yml"}
24+
SERIALIZERS["yaml"] = {"serializer": yaml.dump, "suffix": ".yaml"}
25+
SERIALIZERS["yml"] = {"serializer": yaml.dump, "suffix": ".yml"}
2626

2727

2828
def create_path_to_serialized(task: Task, suffix: str) -> Path:
@@ -57,8 +57,8 @@ def serialize_keyword_arguments(
5757
) -> None:
5858
if callable(serializer):
5959
serializer_func = serializer
60-
elif isinstance(serializer, str) and serializer in SERIALIZER:
61-
serializer_func = SERIALIZER[serializer]["serializer"]
60+
elif isinstance(serializer, str) and serializer in SERIALIZERS:
61+
serializer_func = SERIALIZERS[serializer]["serializer"]
6262
else: # pragma: no cover
6363
raise ValueError(f"Serializer {serializer!r} is not known.")
6464

src/pytask_julia/shared.py

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,8 @@
66
from typing import Sequence
77

88

9-
_ERROR_MSG = """The old syntax for @pytask.mark.julia was suddenly deprecated starting \
10-
with pytask-julia v0.2 to provide a better user experience. Thank you for your \
11-
understanding!
12-
13-
It is recommended to upgrade to the new syntax, so you enjoy all the benefits of v0.2 of
14-
pytask and pytask-julia which are
15-
16-
- Access to 'depends_on' and 'produces', and other kwargs inside the Julia script.
17-
- Support for Julia environments for running scripts with certain packages.
18-
19-
You can find a manual here: \
20-
https://github.com/pytask-dev/pytask-julia/blob/v0.2.0/README.md
21-
22-
Upgrading can be as easy as rewriting your current task from
23-
24-
@pytask.mark.julia(["--threads", 2, "--", "path_to_dependency.txt"])
25-
@pytask.mark.depends_on("script.jl")
26-
@pytask.mark.produces("out.csv")
27-
def task_julia():
28-
...
29-
30-
to
31-
32-
@pytask.mark.julia(script="script.jl", options=("--threads", 2))
33-
@pytask.mark.depends_on("path_to_dependency.txt")
34-
@pytask.mark.produces("out.csv")
35-
def task_julia():
36-
...
37-
38-
You can also fix the version of pytask and pytask-julia to <0.2, so you do not have to \
39-
to upgrade. At the same time, you will not enjoy the improvements released with \
40-
version v0.2 of pytask and pytask-julia.
41-
42-
"""
43-
44-
459
def julia(
46-
*args,
47-
script: str | Path | None = None,
10+
script: str | Path,
4811
options: str | Iterable[str] | None = None,
4912
serializer: str | Callable[..., str] | str | None = None,
5013
suffix: str | None = None,
@@ -60,7 +23,7 @@ def julia(
6023
6124
Parameters
6225
----------
63-
script : str | Path | None
26+
script : str | Path
6427
The path to the Julia script which is executed.
6528
options : str | Iterable[str] | None
6629
One or multiple command line options passed to the interpreter for Julia.
@@ -76,9 +39,6 @@ def julia(
7639
A path to an Julia environment used to execute this task.
7740
7841
"""
79-
if args or script is None:
80-
raise RuntimeError(_ERROR_MSG)
81-
8242
options = [] if options is None else list(map(str, _to_list(options)))
8343
return script, options, serializer, suffix, project
8444

0 commit comments

Comments
 (0)