-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrun_spec0_update.py
More file actions
41 lines (32 loc) · 1.28 KB
/
run_spec0_update.py
File metadata and controls
41 lines (32 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from spec0_action import update_pyproject_toml, read_toml, write_toml, read_schedule
from pathlib import Path
from argparse import ArgumentParser
if __name__ == "__main__":
parser = ArgumentParser(
description="A script to update your project dependencies to be in line with the scientific python SPEC 0 support schedule",
)
parser.add_argument(
"toml_path",
default="pyproject.toml",
help="Path to the project file that lists the dependencies. defaults to 'pyproject.toml'.",
)
parser.add_argument(
"schedule_path",
default="schedule.json",
help="Path to the schedule json payload. defaults to 'schedule.json'",
)
args = parser.parse_args()
toml_path = Path(args.toml_path)
schedule_path = Path(args.schedule_path)
if not toml_path.exists():
raise ValueError(
f"{toml_path} was supplied as path to project file but it did not exist"
)
if not schedule_path.exists():
raise ValueError(
f"{schedule_path} was supplied as path to schedule file but it did not exist"
)
project_data = read_toml(toml_path)
schedule_data = read_schedule(schedule_path)
update_pyproject_toml(project_data, schedule_data)
write_toml(toml_path, project_data)