calkit-python 0.17.0__tar.gz → 0.17.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 (129) hide show
  1. {calkit_python-0.17.0 → calkit_python-0.17.2}/PKG-INFO +1 -1
  2. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/__init__.py +1 -1
  3. calkit_python-0.17.2/calkit/__main__.py +6 -0
  4. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/cli/main.py +59 -40
  5. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/cli/new.py +3 -3
  6. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/tests/cli/test_main.py +2 -3
  7. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/tests/cli/test_new.py +2 -2
  8. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/help.md +2 -2
  9. {calkit_python-0.17.0 → calkit_python-0.17.2}/.github/FUNDING.yml +0 -0
  10. {calkit_python-0.17.0 → calkit_python-0.17.2}/.github/workflows/docs.yml +0 -0
  11. {calkit_python-0.17.0 → calkit_python-0.17.2}/.github/workflows/publish-test.yml +0 -0
  12. {calkit_python-0.17.0 → calkit_python-0.17.2}/.github/workflows/publish.yml +0 -0
  13. {calkit_python-0.17.0 → calkit_python-0.17.2}/.gitignore +0 -0
  14. {calkit_python-0.17.0 → calkit_python-0.17.2}/LICENSE +0 -0
  15. {calkit_python-0.17.0 → calkit_python-0.17.2}/README.md +0 -0
  16. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/calc.py +0 -0
  17. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/check.py +0 -0
  18. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/cli/__init__.py +0 -0
  19. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/cli/check.py +0 -0
  20. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/cli/config.py +0 -0
  21. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/cli/core.py +0 -0
  22. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/cli/import_.py +0 -0
  23. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/cli/list.py +0 -0
  24. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/cli/notebooks.py +0 -0
  25. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/cli/office.py +0 -0
  26. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/cli/update.py +0 -0
  27. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/cloud.py +0 -0
  28. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/conda.py +0 -0
  29. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/config.py +0 -0
  30. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/core.py +0 -0
  31. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/datasets.py +0 -0
  32. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/docker.py +0 -0
  33. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/dvc.py +0 -0
  34. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/git.py +0 -0
  35. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/gui.py +0 -0
  36. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/jupyter.py +0 -0
  37. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/magics.py +0 -0
  38. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/models.py +0 -0
  39. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/office.py +0 -0
  40. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/ops.py +0 -0
  41. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/server.py +0 -0
  42. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/templates/__init__.py +0 -0
  43. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/templates/core.py +0 -0
  44. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/templates/latex/__init__.py +0 -0
  45. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/templates/latex/article/paper.tex +0 -0
  46. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/templates/latex/core.py +0 -0
  47. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/templates/latex/jfm/jfm.bst +0 -0
  48. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/templates/latex/jfm/jfm.cls +0 -0
  49. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/templates/latex/jfm/lineno-FLM.sty +0 -0
  50. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/templates/latex/jfm/paper.tex +0 -0
  51. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/templates/latex/jfm/upmath.sty +0 -0
  52. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/tests/__init__.py +0 -0
  53. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/tests/cli/__init__.py +0 -0
  54. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/tests/cli/test_list.py +0 -0
  55. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/tests/test_calc.py +0 -0
  56. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/tests/test_check.py +0 -0
  57. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/tests/test_conda.py +0 -0
  58. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/tests/test_core.py +0 -0
  59. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/tests/test_dvc.py +0 -0
  60. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/tests/test_jupyter.py +0 -0
  61. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/tests/test_magics.py +0 -0
  62. {calkit_python-0.17.0 → calkit_python-0.17.2}/calkit/tests/test_templates.py +0 -0
  63. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/CNAME +0 -0
  64. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/apps.md +0 -0
  65. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/calculations.md +0 -0
  66. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/calkit-yaml.md +0 -0
  67. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/cli-reference.md +0 -0
  68. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/cloud-integration.md +0 -0
  69. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/environments.md +0 -0
  70. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/examples.md +0 -0
  71. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/img/c-to-the-k-white.svg +0 -0
  72. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/img/calkit-no-bg.png +0 -0
  73. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/index.md +0 -0
  74. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/installation.md +0 -0
  75. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/pipeline/index.md +0 -0
  76. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/pipeline/manual-steps.md +0 -0
  77. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/references.md +0 -0
  78. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/adding-latex-pub-docker.md +0 -0
  79. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/conda-envs.md +0 -0
  80. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/first-project.md +0 -0
  81. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/latex-codespaces/building-codespace.png +0 -0
  82. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/latex-codespaces/codespaces-secrets-2.png +0 -0
  83. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/latex-codespaces/editor-split.png +0 -0
  84. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/latex-codespaces/go-to-linked-code.png +0 -0
  85. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/latex-codespaces/issue-from-selection.png +0 -0
  86. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/latex-codespaces/new-project.png +0 -0
  87. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/latex-codespaces/new-pub-2.png +0 -0
  88. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/latex-codespaces/new-token.png +0 -0
  89. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/latex-codespaces/paper.tex.png +0 -0
  90. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/latex-codespaces/project-home-3.png +0 -0
  91. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/latex-codespaces/push.png +0 -0
  92. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/latex-codespaces/stage.png +0 -0
  93. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/office/anakin-excel.jpg +0 -0
  94. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/office/chart-more-rows.png +0 -0
  95. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/office/create-project.png +0 -0
  96. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/office/elsevier-research-data-guidelines.png +0 -0
  97. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/office/excel-chart.png +0 -0
  98. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/office/excel-data.png +0 -0
  99. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/office/insert-link-to-file.png +0 -0
  100. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/office/needs-clone.png +0 -0
  101. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/office/new-stage.png +0 -0
  102. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/office/phd-comics-version-control.webp +0 -0
  103. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/office/pipeline-out-of-date.png +0 -0
  104. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/office/status-more-rows.png +0 -0
  105. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/office/uncommitted-changes.png +0 -0
  106. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/office/untracked-data.png +0 -0
  107. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/office/updated-publication.png +0 -0
  108. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/office/word-to-pdf-stage-2.png +0 -0
  109. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/office/workflow-page.png +0 -0
  110. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/openfoam/clone.png +0 -0
  111. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/openfoam/create-project.png +0 -0
  112. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/openfoam/datasets-page.png +0 -0
  113. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/openfoam/figure-on-website-updated.png +0 -0
  114. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/openfoam/figure-on-website.png +0 -0
  115. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/openfoam/new-token.png +0 -0
  116. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/openfoam/reclone.png +0 -0
  117. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/openfoam/status-after-import-dataset.png +0 -0
  118. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/img/run-proc.png +0 -0
  119. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/latex-codespaces.md +0 -0
  120. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/matlab.md +0 -0
  121. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/notebook-pipeline.md +0 -0
  122. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/office.md +0 -0
  123. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/openfoam.md +0 -0
  124. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/tutorials/procedures.md +0 -0
  125. {calkit_python-0.17.0 → calkit_python-0.17.2}/docs/version-control.md +0 -0
  126. {calkit_python-0.17.0 → calkit_python-0.17.2}/mkdocs.yml +0 -0
  127. {calkit_python-0.17.0 → calkit_python-0.17.2}/pyproject.toml +0 -0
  128. {calkit_python-0.17.0 → calkit_python-0.17.2}/test/pipeline.ipynb +0 -0
  129. {calkit_python-0.17.0 → calkit_python-0.17.2}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: calkit-python
3
- Version: 0.17.0
3
+ Version: 0.17.2
4
4
  Summary: Reproducibility simplified.
5
5
  Project-URL: Homepage, https://calkit.org
6
6
  Project-URL: Issues, https://github.com/calkit/calkit/issues
@@ -1,4 +1,4 @@
1
- __version__ = "0.17.0"
1
+ __version__ = "0.17.2"
2
2
 
3
3
  from .core import *
4
4
  from . import git
@@ -0,0 +1,6 @@
1
+ """Main entrypoint if running as a module."""
2
+
3
+ from calkit.cli import run
4
+
5
+ if __name__ == "__main__":
6
+ run()
@@ -50,6 +50,11 @@ app.add_typer(office_app, name="office", help="Work with Microsoft Office.")
50
50
  app.add_typer(update_app, name="update", help="Update objects.")
51
51
  app.add_typer(check_app, name="check", help="Check things.")
52
52
 
53
+ # Constants for version control auto-ignore
54
+ AUTO_IGNORE_SUFFIXES = [".DS_Store", ".env"]
55
+ AUTO_IGNORE_PATHS = [os.path.join(".dvc", "config.local")]
56
+ AUTO_IGNORE_PREFIXES = [".venv"]
57
+
53
58
 
54
59
  def _to_shell_cmd(cmd: list[str]) -> str:
55
60
  """Join a command to be compatible with running at the shell.
@@ -190,6 +195,9 @@ def add(
190
195
  help="Automatically commit and use this as a message.",
191
196
  ),
192
197
  ] = None,
198
+ disable_auto_ignore: Annotated[
199
+ bool, typer.Option("--no-auto-ignore", help="Disable auto-ignore.")
200
+ ] = False,
193
201
  push_commit: Annotated[
194
202
  bool, typer.Option("--push", help="Push after committing.")
195
203
  ] = False,
@@ -212,7 +220,17 @@ def add(
212
220
  try:
213
221
  repo = git.Repo()
214
222
  except InvalidGitRepositoryError:
215
- raise_error("Not currently in a Git repo; run `calkit init` first")
223
+ # Prompt user if they want to run git init here
224
+ warn("Current directory is not a Git repo")
225
+ auto_init = typer.confirm(
226
+ "Do you want to initialize the current directory with Git?",
227
+ default=False,
228
+ )
229
+ if auto_init:
230
+ subprocess.check_call(["git", "init"])
231
+ else:
232
+ raise_error("Not currently in a Git repo; run `calkit init` first")
233
+ repo = git.Repo()
216
234
  try:
217
235
  dvc_repo = dvc.repo.Repo()
218
236
  except NotDvcRepoError:
@@ -245,8 +263,45 @@ def add(
245
263
  dvc_paths = [
246
264
  obj.get("path") for obj in dvc_repo.ls(".", dvc_only=True)
247
265
  ]
248
- if "." in paths and to is None:
249
- raise_error("Cannot add '.' with calkit; use git or dvc")
266
+ if "." in paths:
267
+ paths.remove(".")
268
+ # TODO: There is some copy/paste from the `save` function here
269
+ dvc_status = dvc_repo.data_status()
270
+ for dvc_uncommitted in dvc_status["uncommitted"].get(
271
+ "modified", []
272
+ ):
273
+ typer.echo(f"Adding {dvc_uncommitted} to DVC")
274
+ dvc_repo.commit(dvc_uncommitted, force=True)
275
+ untracked_git_files = repo.untracked_files
276
+ if not disable_auto_ignore:
277
+ for untracked_file in untracked_git_files:
278
+ if (
279
+ any(
280
+ [
281
+ untracked_file.endswith(suffix)
282
+ for suffix in AUTO_IGNORE_SUFFIXES
283
+ ]
284
+ )
285
+ or any(
286
+ [
287
+ untracked_file.startswith(prefix)
288
+ for prefix in AUTO_IGNORE_PREFIXES
289
+ ]
290
+ )
291
+ or untracked_file in AUTO_IGNORE_PATHS
292
+ ):
293
+ typer.echo(f"Automatically ignoring {untracked_file}")
294
+ with open(".gitignore", "a") as f:
295
+ f.write("\n" + untracked_file + "\n")
296
+ if ".gitignore" not in paths:
297
+ paths.append(".gitignore")
298
+ # TODO: Figure out if we should group large folders for dvc
299
+ # Now add untracked files automatically
300
+ for untracked_file in repo.untracked_files:
301
+ paths.append(untracked_file)
302
+ # Now add changed files
303
+ for changed_file in [d.a_path for d in repo.index.diff(None)]:
304
+ paths.append(changed_file)
250
305
  for path in paths:
251
306
  # Detect if this file should be tracked with Git or DVC
252
307
  # First see if it's in Git
@@ -354,43 +409,7 @@ def save(
354
409
  if paths is not None:
355
410
  add(paths, to=to)
356
411
  elif save_all:
357
- # First check to see if we should commit anything to DVC
358
- dvc_repo = dvc.repo.Repo()
359
- dvc_status = dvc_repo.data_status()
360
- for dvc_uncommitted in dvc_status["uncommitted"].get("modified", []):
361
- typer.echo(f"Adding {dvc_uncommitted} to DVC")
362
- dvc_repo.commit(dvc_uncommitted, force=True)
363
- repo = git.Repo()
364
- untracked_git_files = repo.untracked_files
365
- auto_ignore_suffixes = [".DS_Store", ".env"]
366
- auto_ignore_paths = [os.path.join(".dvc", "config.local")]
367
- auto_ignore_prefixes = [".venv"]
368
- for untracked_file in untracked_git_files:
369
- if (
370
- any(
371
- [
372
- untracked_file.endswith(suffix)
373
- for suffix in auto_ignore_suffixes
374
- ]
375
- )
376
- or any(
377
- [
378
- untracked_file.startswith(prefix)
379
- for prefix in auto_ignore_prefixes
380
- ]
381
- )
382
- or untracked_file in auto_ignore_paths
383
- ):
384
- typer.echo(f"Automatically ignoring {untracked_file}")
385
- with open(".gitignore", "a") as f:
386
- f.write("\n" + untracked_file + "\n")
387
- # TODO: Figure out if we should group large folders for dvc
388
- # Now add untracked files automatically
389
- for untracked_file in repo.untracked_files:
390
- add(paths=[untracked_file])
391
- # Now add changed files
392
- for changed_file in [d.a_path for d in repo.index.diff(None)]:
393
- repo.git.add(changed_file)
412
+ add(paths=["."])
394
413
  if message is None:
395
414
  typer.echo("No message provided; entering interactive mode")
396
415
  typer.echo("Creating a commit including the following paths:")
@@ -877,11 +877,11 @@ def new_publication(
877
877
  # Create stage if applicable
878
878
  if stage_name is not None and template_type == "latex":
879
879
  cmd = (
880
- f"cd {path} && latexmk -interaction=nonstopmode "
881
- f"-pdf {template_obj.target}"
880
+ "latexmk -cd -interaction=nonstopmode -pdf "
881
+ f"{path}/{template_obj.target}"
882
882
  )
883
883
  if env_name is not None:
884
- cmd = f'calkit xenv -n {env_name} "{cmd}"'
884
+ cmd = f"calkit xenv -n {env_name} -- {cmd}"
885
885
  target_dep = os.path.join(path, template_obj.target)
886
886
  dvc_cmd = [
887
887
  "dvc",
@@ -274,6 +274,5 @@ def test_add(tmp_dir):
274
274
  subprocess.check_call(["calkit", "add", "data"])
275
275
  assert "data.dvc" in calkit.git.get_staged_files()
276
276
  assert "data" in calkit.dvc.list_paths()
277
- # Check that we can't run `calkit add .`
278
- with pytest.raises(subprocess.CalledProcessError):
279
- subprocess.check_call(["calkit", "add", "."])
277
+ # Check that we can run `calkit add .`
278
+ subprocess.check_call(["calkit", "add", "."])
@@ -166,8 +166,8 @@ def test_new_publication(tmp_dir):
166
166
  print(dvc_pipeline)
167
167
  stage = dvc_pipeline["stages"]["build-latex-article"]
168
168
  assert stage["cmd"] == (
169
- "calkit xenv -n my-latex-env "
170
- '"cd my-paper && latexmk -interaction=nonstopmode -pdf paper.tex"'
169
+ "calkit xenv -n my-latex-env -- "
170
+ "latexmk -cd -interaction=nonstopmode -pdf my-paper/paper.tex"
171
171
  )
172
172
 
173
173
 
@@ -10,5 +10,5 @@ or the
10
10
  [Discord server](https://discord.gg/QHEDz7G6).
11
11
 
12
12
  If you want to get in touch directly,
13
- you can
14
- [send us an email](mailto:help@calkit.io).
13
+ feel free to
14
+ [send an email](mailto:help@calkit.io).
File without changes
File without changes
File without changes