calkit-python 0.2.1__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. {calkit_python-0.2.1 → calkit_python-0.2.2}/PKG-INFO +1 -1
  2. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/__init__.py +1 -1
  3. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/cli/new.py +13 -3
  4. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/tests/cli/test_new.py +4 -0
  5. {calkit_python-0.2.1 → calkit_python-0.2.2}/.github/FUNDING.yml +0 -0
  6. {calkit_python-0.2.1 → calkit_python-0.2.2}/.github/workflows/publish-test.yml +0 -0
  7. {calkit_python-0.2.1 → calkit_python-0.2.2}/.github/workflows/publish.yml +0 -0
  8. {calkit_python-0.2.1 → calkit_python-0.2.2}/.gitignore +0 -0
  9. {calkit_python-0.2.1 → calkit_python-0.2.2}/LICENSE +0 -0
  10. {calkit_python-0.2.1 → calkit_python-0.2.2}/README.md +0 -0
  11. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/cli/__init__.py +0 -0
  12. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/cli/config.py +0 -0
  13. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/cli/core.py +0 -0
  14. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/cli/import_.py +0 -0
  15. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/cli/list.py +0 -0
  16. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/cli/main.py +0 -0
  17. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/cli/notebooks.py +0 -0
  18. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/cloud.py +0 -0
  19. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/config.py +0 -0
  20. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/core.py +0 -0
  21. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/data.py +0 -0
  22. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/docker.py +0 -0
  23. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/dvc.py +0 -0
  24. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/git.py +0 -0
  25. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/gui.py +0 -0
  26. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/jupyter.py +0 -0
  27. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/models.py +0 -0
  28. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/server.py +0 -0
  29. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/tests/__init__.py +0 -0
  30. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/tests/cli/__init__.py +0 -0
  31. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/tests/cli/test_list.py +0 -0
  32. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/tests/cli/test_main.py +0 -0
  33. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/tests/test_core.py +0 -0
  34. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/tests/test_dvc.py +0 -0
  35. {calkit_python-0.2.1 → calkit_python-0.2.2}/calkit/tests/test_jupyter.py +0 -0
  36. {calkit_python-0.2.1 → calkit_python-0.2.2}/examples/cfd-study/README.md +0 -0
  37. {calkit_python-0.2.1 → calkit_python-0.2.2}/examples/cfd-study/calkit.yaml +0 -0
  38. {calkit_python-0.2.1 → calkit_python-0.2.2}/examples/cfd-study/config/simulations/runs.csv +0 -0
  39. {calkit_python-0.2.1 → calkit_python-0.2.2}/examples/cfd-study/notebook.ipynb +0 -0
  40. {calkit_python-0.2.1 → calkit_python-0.2.2}/examples/ms-office/.gitignore +0 -0
  41. {calkit_python-0.2.1 → calkit_python-0.2.2}/examples/ms-office/README.md +0 -0
  42. {calkit_python-0.2.1 → calkit_python-0.2.2}/examples/ms-office/calkit.yaml +0 -0
  43. {calkit_python-0.2.1 → calkit_python-0.2.2}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: calkit-python
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Reproducibility simplified.
5
5
  Project-URL: Homepage, https://github.com/calkit/calkit
6
6
  Project-URL: Issues, https://github.com/calkit/calkit/issues
@@ -1,4 +1,4 @@
1
- __version__ = "0.2.1"
1
+ __version__ = "0.2.2"
2
2
 
3
3
  from .core import *
4
4
  from . import git
@@ -21,7 +21,7 @@ new_app = typer.Typer(no_args_is_help=True)
21
21
  def new_figure(
22
22
  path: str,
23
23
  title: Annotated[str, typer.Option("--title")],
24
- description: Annotated[str, typer.Option("--description")] = None,
24
+ description: Annotated[str, typer.Option("--description")],
25
25
  stage_name: Annotated[
26
26
  str,
27
27
  typer.Option(
@@ -71,6 +71,8 @@ def new_figure(
71
71
  paths = [f.get("path") for f in figures]
72
72
  if not overwrite and path in paths:
73
73
  raise_error(f"Figure at path {path} already exists")
74
+ elif overwrite and path in paths:
75
+ figures = [fig for fig in figures if fig.get("path") != path]
74
76
  if cmd is not None and stage_name is None:
75
77
  raise_error("Stage name must be provided if command is specified")
76
78
  if (deps or outs or outs_from_stage) and not cmd:
@@ -88,7 +90,13 @@ def new_figure(
88
90
  stages = pipeline.get("stages", {})
89
91
  if outs_from_stage not in stages:
90
92
  raise_error(f"Stage {outs_from_stage} does not exist")
91
- deps += stages[outs_from_stage].get("outs", [])
93
+ stage = stages[outs_from_stage]
94
+ if "foreach" in stage:
95
+ for val in stage["foreach"]:
96
+ for out in stage.get("do", {}).get("outs", []):
97
+ deps.append(out.replace("${item}", val))
98
+ else:
99
+ deps += stage.get("outs", [])
92
100
  if path not in outs:
93
101
  outs.append(path)
94
102
  deps_cmd = []
@@ -99,6 +107,7 @@ def new_figure(
99
107
  outs_cmd += ["-o", out]
100
108
  subprocess.check_call(
101
109
  ["dvc", "stage", "add", "-n", stage_name]
110
+ + (["-f"] if overwrite else [])
102
111
  + deps_cmd
103
112
  + outs_cmd
104
113
  + [cmd]
@@ -112,7 +121,8 @@ def new_figure(
112
121
  repo.git.add("calkit.yaml")
113
122
  if cmd:
114
123
  repo.git.add("dvc.yaml")
115
- repo.git.commit(["-m", f"Add figure {path}"])
124
+ if repo.git.diff("--staged"):
125
+ repo.git.commit(["-m", f"Add figure {path}"])
116
126
 
117
127
 
118
128
  @new_app.command("question")
@@ -91,6 +91,8 @@ def test_new_figure(tmp_dir):
91
91
  "figure",
92
92
  "--title",
93
93
  "This is a cool figure 2",
94
+ "--description",
95
+ "This is the description.",
94
96
  "myfigure2.png",
95
97
  "--stage",
96
98
  "create-figure",
@@ -116,6 +118,8 @@ def test_new_figure(tmp_dir):
116
118
  "myfigure3.png",
117
119
  "--title",
118
120
  "This is a cool figure 3",
121
+ "--description",
122
+ "This is the description.",
119
123
  "--stage",
120
124
  "create-figure3",
121
125
  "--cmd",
File without changes
File without changes
File without changes