calkit-python 0.8.0__tar.gz → 0.8.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 (58) hide show
  1. {calkit_python-0.8.0 → calkit_python-0.8.2}/PKG-INFO +1 -1
  2. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/__init__.py +1 -1
  3. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/cli/config.py +18 -1
  4. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/cli/main.py +5 -1
  5. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/conda.py +1 -1
  6. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/core.py +10 -1
  7. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/magics.py +28 -7
  8. {calkit_python-0.8.0 → calkit_python-0.8.2}/.github/FUNDING.yml +0 -0
  9. {calkit_python-0.8.0 → calkit_python-0.8.2}/.github/workflows/publish-test.yml +0 -0
  10. {calkit_python-0.8.0 → calkit_python-0.8.2}/.github/workflows/publish.yml +0 -0
  11. {calkit_python-0.8.0 → calkit_python-0.8.2}/.gitignore +0 -0
  12. {calkit_python-0.8.0 → calkit_python-0.8.2}/LICENSE +0 -0
  13. {calkit_python-0.8.0 → calkit_python-0.8.2}/README.md +0 -0
  14. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/cli/__init__.py +0 -0
  15. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/cli/core.py +0 -0
  16. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/cli/import_.py +0 -0
  17. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/cli/list.py +0 -0
  18. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/cli/new.py +0 -0
  19. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/cli/notebooks.py +0 -0
  20. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/cli/office.py +0 -0
  21. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/cloud.py +0 -0
  22. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/config.py +0 -0
  23. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/data.py +0 -0
  24. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/docker.py +0 -0
  25. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/dvc.py +0 -0
  26. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/git.py +0 -0
  27. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/gui.py +0 -0
  28. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/jupyter.py +0 -0
  29. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/models.py +0 -0
  30. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/office.py +0 -0
  31. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/server.py +0 -0
  32. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/templates/__init__.py +0 -0
  33. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/templates/core.py +0 -0
  34. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/templates/latex/__init__.py +0 -0
  35. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/templates/latex/article/paper.tex +0 -0
  36. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/templates/latex/core.py +0 -0
  37. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/templates/latex/jfm/jfm.bst +0 -0
  38. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/templates/latex/jfm/jfm.cls +0 -0
  39. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/templates/latex/jfm/lineno-FLM.sty +0 -0
  40. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/templates/latex/jfm/paper.tex +0 -0
  41. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/templates/latex/jfm/upmath.sty +0 -0
  42. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/tests/__init__.py +0 -0
  43. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/tests/cli/__init__.py +0 -0
  44. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/tests/cli/test_list.py +0 -0
  45. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/tests/cli/test_main.py +0 -0
  46. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/tests/cli/test_new.py +0 -0
  47. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/tests/test_core.py +0 -0
  48. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/tests/test_dvc.py +0 -0
  49. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/tests/test_jupyter.py +0 -0
  50. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/tests/test_magics.py +0 -0
  51. {calkit_python-0.8.0 → calkit_python-0.8.2}/calkit/tests/test_templates.py +0 -0
  52. {calkit_python-0.8.0 → calkit_python-0.8.2}/docs/tutorials/adding-latex-pub-docker.md +0 -0
  53. {calkit_python-0.8.0 → calkit_python-0.8.2}/docs/tutorials/conda-envs.md +0 -0
  54. {calkit_python-0.8.0 → calkit_python-0.8.2}/docs/tutorials/img/run-proc.png +0 -0
  55. {calkit_python-0.8.0 → calkit_python-0.8.2}/docs/tutorials/notebook-pipeline.md +0 -0
  56. {calkit_python-0.8.0 → calkit_python-0.8.2}/docs/tutorials/procedures.md +0 -0
  57. {calkit_python-0.8.0 → calkit_python-0.8.2}/pyproject.toml +0 -0
  58. {calkit_python-0.8.0 → calkit_python-0.8.2}/test/pipeline.ipynb +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: calkit-python
3
- Version: 0.8.0
3
+ Version: 0.8.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.8.0"
1
+ __version__ = "0.8.2"
2
2
 
3
3
  from .core import *
4
4
  from . import git
@@ -5,13 +5,14 @@ from __future__ import annotations
5
5
  import typer
6
6
 
7
7
  from calkit import config
8
- from calkit.dvc import configure_remote, set_remote_auth
8
+ from calkit.dvc import configure_remote, get_remotes, set_remote_auth
9
9
 
10
10
  config_app = typer.Typer(no_args_is_help=True)
11
11
 
12
12
 
13
13
  @config_app.command(name="set")
14
14
  def set_config_value(key: str, value: str):
15
+ """Set a value in the config."""
15
16
  try:
16
17
  cfg = config.read()
17
18
  cfg = config.Settings.model_validate(cfg.model_dump() | {key: value})
@@ -28,6 +29,7 @@ def set_config_value(key: str, value: str):
28
29
 
29
30
  @config_app.command(name="get")
30
31
  def get_config_value(key: str) -> None:
32
+ """Get and print a value from the config."""
31
33
  cfg = config.read()
32
34
  val = getattr(cfg, key)
33
35
  if val is not None:
@@ -38,5 +40,20 @@ def get_config_value(key: str) -> None:
38
40
 
39
41
  @config_app.command(name="setup-remote")
40
42
  def setup_remote():
43
+ """Setup the Calkit cloud as the default DVC remote and store a token in
44
+ the local config.
45
+ """
41
46
  configure_remote()
42
47
  set_remote_auth()
48
+
49
+
50
+ @config_app.command(name="setup-remote-auth")
51
+ def setup_remote_auth():
52
+ """Store a Calkit cloud token in the local DVC config for all Calkit
53
+ remotes.
54
+ """
55
+ remotes = get_remotes()
56
+ for name, url in remotes.items():
57
+ if name == "calkit" or name.startswith("calkit:"):
58
+ typer.echo(f"Setting up authentication for DVC remote: {name}")
59
+ set_remote_auth(remote_name=name)
@@ -9,7 +9,6 @@ import os
9
9
  import subprocess
10
10
  import sys
11
11
  import time
12
- from datetime import UTC, datetime, timedelta
13
12
 
14
13
  import git
15
14
  import typer
@@ -75,12 +74,17 @@ def clone(
75
74
  no_dvc_pull: Annotated[
76
75
  bool, typer.Option("--no-dvc-pull", help="Do not pull DVC objects.")
77
76
  ] = False,
77
+ recursive: Annotated[
78
+ bool, typer.Option("--recursive", help="Recursively clone submodules.")
79
+ ] = False,
78
80
  ):
79
81
  """Clone a Git repo and by default configure and pull from the DVC
80
82
  remote.
81
83
  """
82
84
  # Git clone
83
85
  cmd = ["git", "clone", url]
86
+ if recursive:
87
+ cmd.append("--recursive")
84
88
  if location is not None:
85
89
  cmd.append(location)
86
90
  try:
@@ -45,7 +45,7 @@ def check_env(
45
45
  if env_name not in existing_env_names:
46
46
  log_func(f"Environment {env_name} doesn't exist; creating")
47
47
  # Environment doesn't exist, so create it
48
- subprocess.check_call([conda, "env", "create", "-f", env_fpath])
48
+ subprocess.check_call([conda, "env", "create", "-y", "-f", env_fpath])
49
49
  env_needs_rebuild = False
50
50
  env_needs_export = True
51
51
  else:
@@ -7,7 +7,16 @@ import json
7
7
  import logging
8
8
  import os
9
9
  import pickle
10
- from datetime import UTC, datetime
10
+
11
+ try:
12
+ from datetime import UTC
13
+ except ImportError:
14
+ from datetime import timezone as _timezone
15
+
16
+ UTC = _timezone.utc
17
+
18
+ from datetime import datetime
19
+
11
20
  from typing import Literal
12
21
 
13
22
  import ruamel.yaml
@@ -10,12 +10,24 @@ from IPython.core.magic import Magics, cell_magic, magics_class
10
10
  import calkit
11
11
 
12
12
 
13
+ def _parse_string_arg(val: str):
14
+ try:
15
+ return ast.literal_eval(val)
16
+ except (ValueError, SyntaxError):
17
+ return val
18
+ return val
19
+
20
+
13
21
  @magics_class
14
22
  class Calkit(Magics):
15
23
 
16
24
  @magic_arguments.magic_arguments()
17
25
  @magic_arguments.argument(
18
- "-n", "--name", help="Stage name.", required=True
26
+ "-n",
27
+ "--name",
28
+ help="Stage name.",
29
+ required=True,
30
+ type=_parse_string_arg,
19
31
  )
20
32
  @magic_arguments.argument(
21
33
  "--dep",
@@ -28,6 +40,7 @@ class Calkit(Magics):
28
40
  "'my-stage:df:parquet:pandas'."
29
41
  ),
30
42
  nargs="+",
43
+ type=_parse_string_arg,
31
44
  )
32
45
  @magic_arguments.argument(
33
46
  "--out",
@@ -39,6 +52,7 @@ class Calkit(Magics):
39
52
  "specified like 'df:parquet:polars'."
40
53
  ),
41
54
  nargs="+",
55
+ type=_parse_string_arg,
42
56
  )
43
57
  @magic_arguments.argument(
44
58
  "--dep-path",
@@ -48,6 +62,7 @@ class Calkit(Magics):
48
62
  "the stage will be rerun."
49
63
  ),
50
64
  nargs="+",
65
+ type=_parse_string_arg,
51
66
  )
52
67
  @magic_arguments.argument(
53
68
  "--out-path",
@@ -57,6 +72,7 @@ class Calkit(Magics):
57
72
  "if a figure is saved to a file."
58
73
  ),
59
74
  nargs="+",
75
+ type=_parse_string_arg,
60
76
  )
61
77
  @magic_arguments.argument(
62
78
  "--out-type",
@@ -68,12 +84,17 @@ class Calkit(Magics):
68
84
  "path will be set as the output variable path. "
69
85
  "Note that there must only be one output to use this option."
70
86
  ),
87
+ type=_parse_string_arg,
71
88
  )
72
89
  @magic_arguments.argument(
73
- "--out-title", help="Title for Calkit output object."
90
+ "--out-title",
91
+ help="Title for Calkit output object.",
92
+ type=_parse_string_arg,
74
93
  )
75
94
  @magic_arguments.argument(
76
- "--out-desc", help="Description for Calkit output object."
95
+ "--out-desc",
96
+ help="Description for Calkit output object.",
97
+ type=_parse_string_arg,
77
98
  )
78
99
  @cell_magic
79
100
  def stage(self, line, cell):
@@ -102,9 +123,9 @@ class Calkit(Magics):
102
123
  # Parse calkit object parameters
103
124
  out_params = {}
104
125
  if args.out_title:
105
- out_params["title"] = ast.literal_eval(args.out_title)
126
+ out_params["title"] = args.out_title
106
127
  if args.out_desc:
107
- out_params["description"] = ast.literal_eval(args.out_desc)
128
+ out_params["description"] = args.out_desc
108
129
  # Ensure we have required keys
109
130
  # TODO: Use Pydantic here
110
131
  if "title" not in out_params:
@@ -204,7 +225,7 @@ class Calkit(Magics):
204
225
  ]
205
226
  if args.dep_path:
206
227
  for dep in args.dep_path:
207
- cmd += ["-d", f"'{dep}'"]
228
+ cmd += ["-d", dep]
208
229
  if args.out:
209
230
  for out in args.out:
210
231
  out_split = out.split(":")
@@ -218,7 +239,7 @@ class Calkit(Magics):
218
239
  ]
219
240
  if args.out_path:
220
241
  for path in args.out_path:
221
- cmd += ["-o", f"{path}"]
242
+ cmd += ["-o", path]
222
243
  cmd.append(f"python '{script_fpath}'")
223
244
  try:
224
245
  subprocess.run(cmd, check=True, capture_output=True, text=True)
File without changes
File without changes
File without changes