calkit-python 0.25.0__tar.gz → 0.25.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 (162) hide show
  1. {calkit_python-0.25.0 → calkit_python-0.25.2}/PKG-INFO +1 -1
  2. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/__init__.py +1 -1
  3. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/cli/main.py +115 -27
  4. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/cli/new.py +10 -0
  5. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/models/pipeline.py +5 -2
  6. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/pipeline.py +5 -1
  7. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/tests/cli/test_new.py +1 -1
  8. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/tests/models/test_pipeline.py +2 -2
  9. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/tests/test_pipeline.py +1 -1
  10. calkit_python-0.25.2/docs/notebooks.md +236 -0
  11. {calkit_python-0.25.0 → calkit_python-0.25.2}/mkdocs.yml +1 -0
  12. {calkit_python-0.25.0 → calkit_python-0.25.2}/.github/FUNDING.yml +0 -0
  13. {calkit_python-0.25.0 → calkit_python-0.25.2}/.github/workflows/docs.yml +0 -0
  14. {calkit_python-0.25.0 → calkit_python-0.25.2}/.github/workflows/format.yml +0 -0
  15. {calkit_python-0.25.0 → calkit_python-0.25.2}/.github/workflows/publish-test.yml +0 -0
  16. {calkit_python-0.25.0 → calkit_python-0.25.2}/.github/workflows/publish.yml +0 -0
  17. {calkit_python-0.25.0 → calkit_python-0.25.2}/.github/workflows/test.yml +0 -0
  18. {calkit_python-0.25.0 → calkit_python-0.25.2}/.gitignore +0 -0
  19. {calkit_python-0.25.0 → calkit_python-0.25.2}/.pre-commit-config.yaml +0 -0
  20. {calkit_python-0.25.0 → calkit_python-0.25.2}/.python-version +0 -0
  21. {calkit_python-0.25.0 → calkit_python-0.25.2}/CONTRIBUTING.md +0 -0
  22. {calkit_python-0.25.0 → calkit_python-0.25.2}/LICENSE +0 -0
  23. {calkit_python-0.25.0 → calkit_python-0.25.2}/Makefile +0 -0
  24. {calkit_python-0.25.0 → calkit_python-0.25.2}/README.md +0 -0
  25. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/__main__.py +0 -0
  26. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/calc.py +0 -0
  27. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/check.py +0 -0
  28. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/cli/__init__.py +0 -0
  29. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/cli/check.py +0 -0
  30. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/cli/cloud.py +0 -0
  31. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/cli/config.py +0 -0
  32. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/cli/core.py +0 -0
  33. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/cli/import_.py +0 -0
  34. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/cli/list.py +0 -0
  35. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/cli/notebooks.py +0 -0
  36. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/cli/office.py +0 -0
  37. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/cli/overleaf.py +0 -0
  38. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/cli/update.py +0 -0
  39. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/cloud.py +0 -0
  40. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/conda.py +0 -0
  41. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/config.py +0 -0
  42. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/core.py +0 -0
  43. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/datasets.py +0 -0
  44. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/docker.py +0 -0
  45. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/dvc.py +0 -0
  46. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/environments.py +0 -0
  47. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/git.py +0 -0
  48. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/github.py +0 -0
  49. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/gui.py +0 -0
  50. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/jupyter.py +0 -0
  51. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/magics.py +0 -0
  52. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/matlab.py +0 -0
  53. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/models/__init__.py +0 -0
  54. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/models/core.py +0 -0
  55. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/models/io.py +0 -0
  56. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/models/iteration.py +0 -0
  57. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/notebooks.py +0 -0
  58. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/office.py +0 -0
  59. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/ops.py +0 -0
  60. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/releases.py +0 -0
  61. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/server.py +0 -0
  62. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/templates/__init__.py +0 -0
  63. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/templates/core.py +0 -0
  64. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/templates/latex/__init__.py +0 -0
  65. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/templates/latex/article/paper.tex +0 -0
  66. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/templates/latex/core.py +0 -0
  67. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/templates/latex/jfm/jfm.bst +0 -0
  68. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/templates/latex/jfm/jfm.cls +0 -0
  69. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/templates/latex/jfm/lineno-FLM.sty +0 -0
  70. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/templates/latex/jfm/paper.tex +0 -0
  71. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/templates/latex/jfm/upmath.sty +0 -0
  72. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/tests/__init__.py +0 -0
  73. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/tests/cli/__init__.py +0 -0
  74. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/tests/cli/test_config.py +0 -0
  75. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/tests/cli/test_list.py +0 -0
  76. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/tests/cli/test_main.py +0 -0
  77. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/tests/models/__init__.py +0 -0
  78. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/tests/test_calc.py +0 -0
  79. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/tests/test_check.py +0 -0
  80. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/tests/test_conda.py +0 -0
  81. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/tests/test_core.py +0 -0
  82. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/tests/test_dvc.py +0 -0
  83. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/tests/test_jupyter.py +0 -0
  84. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/tests/test_magics.py +0 -0
  85. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/tests/test_notebooks.py +0 -0
  86. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/tests/test_templates.py +0 -0
  87. {calkit_python-0.25.0 → calkit_python-0.25.2}/calkit/zenodo.py +0 -0
  88. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/CNAME +0 -0
  89. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/apps.md +0 -0
  90. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/calculations.md +0 -0
  91. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/calkit-yaml.md +0 -0
  92. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/cli-reference.md +0 -0
  93. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/cloud-integration.md +0 -0
  94. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/datasets.md +0 -0
  95. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/dependencies.md +0 -0
  96. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/environments.md +0 -0
  97. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/examples.md +0 -0
  98. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/help.md +0 -0
  99. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/img/c-to-the-k-white.svg +0 -0
  100. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/img/calkit-no-bg.png +0 -0
  101. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/img/connect-zenodo.png +0 -0
  102. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/index.md +0 -0
  103. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/installation.md +0 -0
  104. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/local-server.md +0 -0
  105. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/overleaf.md +0 -0
  106. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/pipeline/index.md +0 -0
  107. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/pipeline/manual-steps.md +0 -0
  108. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/references.md +0 -0
  109. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/releases.md +0 -0
  110. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/adding-latex-pub-docker.md +0 -0
  111. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/conda-envs.md +0 -0
  112. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/existing-project.md +0 -0
  113. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/first-project.md +0 -0
  114. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/latex-codespaces/building-codespace.png +0 -0
  115. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/latex-codespaces/codespaces-secrets-2.png +0 -0
  116. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/latex-codespaces/editor-split.png +0 -0
  117. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/latex-codespaces/go-to-linked-code.png +0 -0
  118. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/latex-codespaces/issue-from-selection.png +0 -0
  119. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/latex-codespaces/new-project.png +0 -0
  120. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/latex-codespaces/new-pub-2.png +0 -0
  121. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/latex-codespaces/new-token.png +0 -0
  122. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/latex-codespaces/paper.tex.png +0 -0
  123. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/latex-codespaces/project-home-3.png +0 -0
  124. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/latex-codespaces/push.png +0 -0
  125. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/latex-codespaces/stage.png +0 -0
  126. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/office/anakin-excel.jpg +0 -0
  127. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/office/chart-more-rows.png +0 -0
  128. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/office/create-project.png +0 -0
  129. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/office/elsevier-research-data-guidelines.png +0 -0
  130. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/office/excel-chart.png +0 -0
  131. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/office/excel-data.png +0 -0
  132. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/office/insert-link-to-file.png +0 -0
  133. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/office/needs-clone.png +0 -0
  134. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/office/new-stage.png +0 -0
  135. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/office/phd-comics-version-control.webp +0 -0
  136. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/office/pipeline-out-of-date.png +0 -0
  137. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/office/status-more-rows.png +0 -0
  138. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/office/uncommitted-changes.png +0 -0
  139. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/office/untracked-data.png +0 -0
  140. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/office/updated-publication.png +0 -0
  141. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/office/word-to-pdf-stage-2.png +0 -0
  142. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/office/workflow-page.png +0 -0
  143. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/openfoam/clone.png +0 -0
  144. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/openfoam/create-project.png +0 -0
  145. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/openfoam/datasets-page.png +0 -0
  146. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/openfoam/figure-on-website-updated.png +0 -0
  147. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/openfoam/figure-on-website.png +0 -0
  148. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/openfoam/new-token.png +0 -0
  149. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/openfoam/reclone.png +0 -0
  150. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/openfoam/status-after-import-dataset.png +0 -0
  151. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/img/run-proc.png +0 -0
  152. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/index.md +0 -0
  153. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/latex-codespaces.md +0 -0
  154. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/matlab.md +0 -0
  155. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/notebook-pipeline.md +0 -0
  156. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/office.md +0 -0
  157. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/openfoam.md +0 -0
  158. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/tutorials/procedures.md +0 -0
  159. {calkit_python-0.25.0 → calkit_python-0.25.2}/docs/version-control.md +0 -0
  160. {calkit_python-0.25.0 → calkit_python-0.25.2}/pyproject.toml +0 -0
  161. {calkit_python-0.25.0 → calkit_python-0.25.2}/test/pipeline.ipynb +0 -0
  162. {calkit_python-0.25.0 → calkit_python-0.25.2}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: calkit-python
3
- Version: 0.25.0
3
+ Version: 0.25.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.25.0"
1
+ __version__ = "0.25.2"
2
2
 
3
3
  from .core import * # noqa: F403, I001
4
4
  from . import git # noqa: F401
@@ -66,7 +66,7 @@ app.add_typer(overleaf_app, name="overleaf", help="Interact with Overleaf.")
66
66
  app.add_typer(cloud_app, name="cloud", help="Interact with a Calkit Cloud.")
67
67
 
68
68
  # Constants for version control auto-ignore
69
- AUTO_IGNORE_SUFFIXES = [".DS_Store", ".env", ".pyc"]
69
+ AUTO_IGNORE_SUFFIXES = [".DS_Store", ".env", ".pyc", ".synctex.gz"]
70
70
  AUTO_IGNORE_PATHS = [os.path.join(".dvc", "config.local")]
71
71
  AUTO_IGNORE_PREFIXES = [".venv", "__pycache__"]
72
72
  # Constants for version control auto-add to DVC
@@ -675,45 +675,127 @@ def run_local_server():
675
675
  )
676
676
 
677
677
 
678
- @app.command(
679
- name="run",
680
- add_help_option=False,
681
- )
678
+ @app.command(name="run")
682
679
  def run(
683
- targets: Optional[list[str]] = typer.Argument(default=None),
684
- help: Annotated[bool, typer.Option("-h", "--help")] = False,
685
- quiet: Annotated[bool, typer.Option("-q", "--quiet")] = False,
686
- verbose: Annotated[bool, typer.Option("-v", "--verbose")] = False,
687
- force: Annotated[bool, typer.Option("-f", "--force")] = False,
688
- interactive: Annotated[bool, typer.Option("-i", "--interactive")] = False,
689
- single_item: Annotated[bool, typer.Option("-s", "--single-item")] = False,
680
+ targets: Optional[list[str]] = typer.Argument(
681
+ default=None, help="Stages to run."
682
+ ),
683
+ quiet: Annotated[
684
+ bool, typer.Option("-q", "--quiet", help="Be quiet.")
685
+ ] = False,
686
+ verbose: Annotated[
687
+ bool, typer.Option("-v", "--verbose", help="Print verbose output.")
688
+ ] = False,
689
+ force: Annotated[
690
+ bool,
691
+ typer.Option(
692
+ "-f",
693
+ "--force",
694
+ help="Run even if stages or inputs have not changed.",
695
+ ),
696
+ ] = False,
697
+ interactive: Annotated[
698
+ bool,
699
+ typer.Option(
700
+ "-i",
701
+ "--interactive",
702
+ help="Ask for confirmation before running each stage.",
703
+ ),
704
+ ] = False,
705
+ single_item: Annotated[
706
+ bool,
707
+ typer.Option(
708
+ "-s",
709
+ "--single-item",
710
+ help="Run only a single stage without any dependents.",
711
+ ),
712
+ ] = False,
690
713
  pipeline: Annotated[
691
714
  Optional[str], typer.Option("-p", "--pipeline")
692
715
  ] = None,
693
716
  all_pipelines: Annotated[
694
- bool, typer.Option("-P", "--all-pipelines")
717
+ bool,
718
+ typer.Option(
719
+ "-P", "--all-pipelines", help="Run all pipelines in the repo."
720
+ ),
721
+ ] = False,
722
+ recursive: Annotated[
723
+ bool,
724
+ typer.Option(
725
+ "-R", "--recursive", help="Run pipelines in subdirectories."
726
+ ),
695
727
  ] = False,
696
- recursive: Annotated[bool, typer.Option("-R", "--recursive")] = False,
697
728
  downstream: Annotated[
698
- Optional[list[str]], typer.Option("--downstream")
729
+ Optional[list[str]],
730
+ typer.Option(
731
+ "--downstream",
732
+ help="Start from the specified stage and run all downstream.",
733
+ ),
699
734
  ] = None,
700
735
  force_downstream: Annotated[
701
- bool, typer.Option("--force-downstream")
736
+ bool,
737
+ typer.Option(
738
+ "--force-downstream",
739
+ help=(
740
+ "Force downstream stages to run even if "
741
+ "they are still up-to-date."
742
+ ),
743
+ ),
744
+ ] = False,
745
+ pull: Annotated[
746
+ bool,
747
+ typer.Option("--pull", help="Try automatically pulling missing data."),
702
748
  ] = False,
703
- pull: Annotated[bool, typer.Option("--pull")] = False,
704
- allow_missing: Annotated[bool, typer.Option("--allow-missing")] = False,
705
- dry: Annotated[bool, typer.Option("--dry")] = False,
706
- keep_going: Annotated[bool, typer.Option("--keep-going", "-k")] = False,
707
- ignore_errors: Annotated[bool, typer.Option("--ignore-errors")] = False,
708
- glob: Annotated[bool, typer.Option("--glob")] = False,
709
- no_commit: Annotated[bool, typer.Option("--no-commit")] = False,
710
- no_run_cache: Annotated[bool, typer.Option("--no-run-cache")] = False,
749
+ allow_missing: Annotated[
750
+ bool,
751
+ typer.Option("--allow-missing", help="Skip stages with missing data."),
752
+ ] = False,
753
+ dry: Annotated[
754
+ bool,
755
+ typer.Option("--dry", help="Only print commands that would execute."),
756
+ ] = False,
757
+ keep_going: Annotated[
758
+ bool,
759
+ typer.Option(
760
+ "--keep-going",
761
+ "-k",
762
+ help=(
763
+ "Continue executing, skipping stages with failed "
764
+ "inputs from other stages."
765
+ ),
766
+ ),
767
+ ] = False,
768
+ ignore_errors: Annotated[
769
+ bool,
770
+ typer.Option("--ignore-errors", help="Ignore errors from stages."),
771
+ ] = False,
772
+ glob: Annotated[
773
+ bool,
774
+ typer.Option("--glob", help="Match stages with glob-style patterns."),
775
+ ] = False,
776
+ no_commit: Annotated[
777
+ bool, typer.Option("--no-commit", help="Do not save to the run cache.")
778
+ ] = False,
779
+ no_run_cache: Annotated[
780
+ bool, typer.Option("--no-run-cache", help="Ignore the run cache.")
781
+ ] = False,
782
+ save_after_run: Annotated[
783
+ bool,
784
+ typer.Option("--save", "-S", help="Save the project after running."),
785
+ ] = False,
786
+ save_message: Annotated[
787
+ str | None,
788
+ typer.Option(
789
+ "--save-message", "-m", help="Commit message for saving."
790
+ ),
791
+ ] = None,
711
792
  ):
712
793
  """Check dependencies and run the pipeline."""
713
794
  os.environ["CALKIT_PIPELINE_RUNNING"] = "1"
714
795
  dotenv.load_dotenv(dotenv_path=".env", verbose=verbose)
715
796
  # First check any system-level dependencies exist
716
- typer.echo("Checking system-level dependencies")
797
+ if not quiet:
798
+ typer.echo("Checking system-level dependencies")
717
799
  try:
718
800
  calkit.check_system_deps()
719
801
  except Exception as e:
@@ -722,7 +804,8 @@ def run(
722
804
  # Compile the pipeline
723
805
  ck_info = calkit.load_calkit_info()
724
806
  if ck_info.get("pipeline", {}):
725
- typer.echo("Compiling DVC pipeline")
807
+ if not quiet:
808
+ typer.echo("Compiling DVC pipeline")
726
809
  try:
727
810
  calkit.pipeline.to_dvc(ck_info=ck_info, write=True)
728
811
  except Exception as e:
@@ -733,7 +816,6 @@ def run(
733
816
  args = targets
734
817
  # Extract any boolean args
735
818
  for name in [
736
- "help",
737
819
  "quiet",
738
820
  "verbose",
739
821
  "force",
@@ -762,6 +844,12 @@ def run(
762
844
  os.environ.pop("CALKIT_PIPELINE_RUNNING", None)
763
845
  raise_error("DVC pipeline failed")
764
846
  os.environ.pop("CALKIT_PIPELINE_RUNNING", None)
847
+ if save_after_run or save_message is not None:
848
+ if save_message is None:
849
+ save_message = "Run pipeline"
850
+ if not quiet:
851
+ typer.echo("Saving the project after successful run")
852
+ save(save_all=True, message=save_message)
765
853
 
766
854
 
767
855
  @app.command(name="manual-step", help="Execute a manual step.")
@@ -30,6 +30,13 @@ from calkit.models.pipeline import LatexStage, StageIteration
30
30
  new_app = typer.Typer(no_args_is_help=True)
31
31
 
32
32
 
33
+ def _check_path_dir(path: str):
34
+ """If path is in a subdirectory, check that it exists."""
35
+ dirname = os.path.dirname(path)
36
+ if dirname:
37
+ os.makedirs(dirname, exist_ok=True)
38
+
39
+
33
40
  @new_app.command(name="project")
34
41
  def new_project(
35
42
  path: Annotated[str, typer.Argument(help="Where to create the project.")],
@@ -1075,6 +1082,7 @@ def new_conda_env(
1075
1082
  project_name = os.path.basename(os.getcwd())
1076
1083
  conda_name = calkit.to_kebab_case(project_name) + "-" + name
1077
1084
  # Write environment to path
1085
+ _check_path_dir(path)
1078
1086
  conda_env = dict(
1079
1087
  name=conda_name, channels=["conda-forge"], dependencies=packages
1080
1088
  )
@@ -1174,6 +1182,7 @@ def new_uv_venv(
1174
1182
  )
1175
1183
  packages_txt = "\n".join(packages)
1176
1184
  # Write environment to path
1185
+ _check_path_dir(path)
1177
1186
  with open(path, "w") as f:
1178
1187
  f.write(packages_txt)
1179
1188
  repo.git.add(path)
@@ -1259,6 +1268,7 @@ def new_venv(
1259
1268
  )
1260
1269
  packages_txt = "\n".join(packages)
1261
1270
  # Write environment to path
1271
+ _check_path_dir(path)
1262
1272
  with open(path, "w") as f:
1263
1273
  f.write(packages_txt)
1264
1274
  repo.git.add(path)
@@ -132,16 +132,19 @@ class PythonScriptStage(Stage):
132
132
  class LatexStage(Stage):
133
133
  kind: Literal["latex"] = "latex"
134
134
  target_path: str
135
- silent: bool = False
135
+ verbose: bool = False
136
136
  force: bool = False
137
+ synctex: bool = True
137
138
 
138
139
  @property
139
140
  def dvc_cmd(self) -> str:
140
141
  cmd = f"{self.xenv_cmd} -- latexmk -cd -interaction=nonstopmode"
141
- if self.silent:
142
+ if not self.verbose:
142
143
  cmd += " -silent"
143
144
  if self.force:
144
145
  cmd += " -f"
146
+ if self.synctex:
147
+ cmd += " -synctex=1"
145
148
  cmd += f" -pdf {self.target_path}"
146
149
  return cmd
147
150
 
@@ -44,9 +44,13 @@ def to_dvc(
44
44
  except Exception as e:
45
45
  raise ValueError(f"Pipeline is not defined properly: {e}")
46
46
  dvc_stages = {}
47
- # First, create stages for checking/exporting all environments
47
+ # First, create stages for checking/exporting all environments used in the
48
+ # pipeline
49
+ used_envs = set([stage.environment for stage in pipeline.stages.values()])
48
50
  env_lock_fpaths = {}
49
51
  for env_name, env in ck_info.get("environments", {}).items():
52
+ if env_name not in used_envs:
53
+ continue
50
54
  env_fpath = env.get("path")
51
55
  lock_fpath = get_env_lock_fpath(
52
56
  env=env, env_name=env_name, as_posix=True
@@ -548,7 +548,7 @@ def test_new_latex_stage(tmp_dir):
548
548
  pipeline = calkit.dvc.read_pipeline()
549
549
  assert pipeline["stages"]["build-paper"]["cmd"] == (
550
550
  "calkit xenv -n tex --no-check -- "
551
- "latexmk -cd -interaction=nonstopmode -pdf paper.tex"
551
+ "latexmk -cd -interaction=nonstopmode -silent -synctex=1 -pdf paper.tex"
552
552
  )
553
553
  assert set(pipeline["stages"]["build-paper"]["deps"]) == set(
554
554
  ["paper.tex", ".calkit/env-locks/tex.json"]
@@ -46,8 +46,8 @@ def test_wordtopdfstage():
46
46
 
47
47
  def test_latexstage():
48
48
  s = LatexStage(environment="tex", target_path="my-paper.tex")
49
- assert " -silent " not in s.dvc_cmd
50
- s.silent = True
51
49
  assert " -silent " in s.dvc_cmd
50
+ s.verbose = True
51
+ assert " -silent " not in s.dvc_cmd
52
52
  assert "my-paper.tex" in s.dvc_deps
53
53
  assert "my-paper.pdf" in s.dvc_outs
@@ -21,7 +21,7 @@ def test_to_dvc():
21
21
  "stages": {
22
22
  "get-data": {
23
23
  "kind": "python-script",
24
- "environment": "my-env",
24
+ "environment": "py",
25
25
  "script_path": "something/my-cool-script.py",
26
26
  "outputs": [
27
27
  "my-output.out",
@@ -0,0 +1,236 @@
1
+ # Working with notebooks
2
+
3
+ While working on a research project,
4
+ Jupyter notebooks can be useful for prototyping and data exploration.
5
+ If while working interactively in a notebook
6
+ you get an output you like, e.g., a figure,
7
+ it can be tempting to simply stop right there
8
+ and copy/paste it into a research article.
9
+ However, in order to keep the project reproducible,
10
+ we need to be able to go from raw data to research article
11
+ [with a single command](https://doi.org/10.1190/1.1822162),
12
+ which of course is not possible in the above scenario.
13
+
14
+ This is the primary notebook use case Calkit is concerned with:
15
+ generating evidence to back up conclusions or answers to research questions.
16
+ There are other use cases that are out of scope like using notebooks to build
17
+ documentation or interactive web apps for exploring results.
18
+ For building [apps](apps.md) (a different concept in a Calkit project),
19
+ there are probably better tools out there, e.g.,
20
+ [marimo](https://marimo.io/),
21
+ [Dash](https://dash.plotly.com/),
22
+ [Voila](https://voila.readthedocs.io/en/stable/),
23
+ or [Gradio](https://www.gradio.app/).
24
+
25
+ Here we'll talk about how to take advantage of the interactive nature
26
+ of Jupyter notebooks while incorporating them into a reproducible workflow,
27
+ avoiding some of the pitfalls that have caused a bit of a
28
+ [notebook reproducibility crisis](https://leomurta.github.io/papers/pimentel2019a.pdf).
29
+ Returning to the "one project, one command" requirement,
30
+ we can focus on three rules:
31
+
32
+ 1. The notebook must be kept in version control.
33
+ This happens naturally since any file included in a Calkit project is
34
+ kept in version control.
35
+ However, it's usually a good idea to exclude notebook output from
36
+ Git commits.
37
+ This can be done by installing `nbstripout` and running
38
+ `nbstripout --install` in the project directory.
39
+ 1. A notebook must run in one of the project's [environments](environments.md).
40
+ 1. Notebooks should be incorporated into the project's
41
+ [pipeline](pipeline/index.md).
42
+ It's fine to do some ad hoc work interactively to get the notebook
43
+ working properly, but
44
+ "official" outputs should be generated by calling `calkit run`.
45
+ This means notebooks need to be able to run from top-to-bottom with no
46
+ manual intervention. We'll see how below.
47
+
48
+ ## Creating an environment for a notebook
49
+
50
+ Assuming you want to run Python in the notebook, you can create an environment
51
+ for it with `uv`, `venv`, `conda`, or `pixi`.
52
+ For example, if we wanted to create a new `uv-venv` called `py` in our project,
53
+ we can execute:
54
+
55
+ ```sh
56
+ calkit new uv-venv \
57
+ --name py \
58
+ --prefix .venv \
59
+ --python 3.13 \
60
+ --path requirements.txt \
61
+ jupyter \
62
+ "pandas>=2" \
63
+ numpy \
64
+ plotly \
65
+ matplotlib \
66
+ polars
67
+ ```
68
+
69
+ You can then start JupyterLab in this environment with
70
+ `calkit xenv -n py jupyter lab`.
71
+
72
+ Note the environment only needs to be created once per project.
73
+ If the project is cloned onto a new machine,
74
+ the environment does not need to be recreated,
75
+ since that will be done automatically when the project is run.
76
+ Also note that it's totally fine and perhaps even preferable to create
77
+ a new environment for each notebook, so long as they have different
78
+ names, prefixes, and paths---there is no limit to the number
79
+ of environments a project can use, and they can be of any type.
80
+
81
+ ## Adding a notebook to the pipeline
82
+
83
+ A notebook can be added to the pipeline by editing the project's `calkit.yaml`
84
+ file directly, using a `jupyter-notebook` stage.
85
+ For example:
86
+
87
+ ```yaml
88
+ # In calkit.yaml
89
+ environments:
90
+ py:
91
+ kind: uv-venv
92
+ prefix: .venv
93
+ python: "3.13"
94
+ path: requirements.txt
95
+ pipeline:
96
+ stages:
97
+ my-notebook:
98
+ kind: jupyter-notebook
99
+ environment: py
100
+ notebook_path: notebooks/get-data.ipynb
101
+ inputs:
102
+ - config/my-params.json
103
+ outputs:
104
+ - data/raw/data.csv
105
+ html_storage: dvc
106
+ executed_ipynb_storage: null
107
+ cleaned_ipynb_storage: git
108
+ # Optional: Add to project notebooks so they can be viewed on Calkit Cloud
109
+ notebooks:
110
+ - path: notebooks/get-data.ipynb
111
+ title: Get data
112
+ stage: my-notebook
113
+ ```
114
+
115
+ For this example, we're declaring that the notebook
116
+ should use the `py` environment, and that it will read an input
117
+ file `config/my-params.json` and produce an output
118
+ file `data/raw/data.csv`.
119
+ These inputs and outputs will be tracked
120
+ along with the notebook and environment content,
121
+ to automatically determine if and when the notebook needs to be rerun.
122
+ Outputs will also be kept in DVC by default so others can pull them down
123
+ without bloating the Git repo.
124
+ Output storage is configurable, however, e.g., if you'd like to keep
125
+ smaller and/or text-based outputs in Git for simplicity's sake.
126
+
127
+ Copies of the notebook with and without outputs will be generated as the
128
+ notebook is executed, along with an HTML export of the latter.
129
+ Storage for these outputs can be controlled with the `html_storage`,
130
+ `executed_ipynb_storage`, `cleaned_ipynb_storage` properties,
131
+ and they will live inside the project's `.calkit` subdirectory.
132
+ The executed `.ipynb` can be rendered on GitHub or
133
+ [nbviewer.org](https://nbviewer.org),
134
+ and the HTML can be viewed on [calkit.io](https://calkit.io),
135
+ the latter of which allows some level of interactivity, e.g., Plotly figures.
136
+ The cleaned `.ipynb` can be useful for diffing with Git in cases where
137
+ `nbstripout` is not activated.
138
+
139
+ It's also possible to add a notebook to the pipeline
140
+ inside a notebook with the `declare_notebook` function,
141
+ which will update `calkit.yaml` automatically.
142
+
143
+ ```python
144
+ import calkit
145
+
146
+ calkit.declare_notebook(
147
+ path="notebooks/get-data.ipynb",
148
+ stage_name="my-notebook",
149
+ environment_name="py",
150
+ inputs=["config/my-params.json"],
151
+ outputs=["data/raw/data.csv"],
152
+ html_storage="dvc",
153
+ executed_ipynb_storage=None,
154
+ cleaned_ipynb_storage="git",
155
+ )
156
+ ```
157
+
158
+ Note that for this to run properly `calkit-python` must be installed in
159
+ the notebook's environment, which in this case is named `py` and whose
160
+ packages are listed in `requirements.txt`.
161
+ If we didn't include them when creating the environment,
162
+ we can simply add `calkit-python` to the `requirements.txt` file and rerun
163
+ `calkit xenv -n py jupyter lab`.
164
+ The environment will be updated before starting JupyterLab.
165
+
166
+ ## Working interactively
167
+
168
+ The main advantage of Jupyter notebooks is the ability to work interactively,
169
+ allowing us to quickly iterate on a smaller chunk of the process
170
+ while the rest remains constant.
171
+ For example, if you need to refine a figure,
172
+ you can keep updating and running the cell that generates the figure,
173
+ without needing to rerun the expensive cell above that generates
174
+ or processes the data for it.
175
+ In this case our notebook might look like this:
176
+
177
+ ```python
178
+ from some_package import run_data_processing
179
+
180
+ result = run_data_processing(param1=55)
181
+ ```
182
+
183
+ ```python
184
+ import matplotlib.pyplot as plt
185
+
186
+ fig, ax = plt.subplots()
187
+ ax.plot(result["x"], result["y"])
188
+ ```
189
+
190
+ ```python
191
+ fig.savefig("figures/my-plot.png")
192
+ ```
193
+
194
+ So, with a fresh Jupyter kernel we'll need to run cell 1 in order to generate
195
+ `result` so we can iterate on cell 2 to get the plot looking the way
196
+ we want it to.
197
+ But what if `run_data_processing`
198
+ takes minutes, hours, or even days, so therefore we don't want to run it
199
+ every time we restart the notebook?
200
+ Well, we can use the Calkit `%%stage` cell magic to automatically cache
201
+ and retrieve the result.
202
+
203
+ After adding a cell with:
204
+
205
+ ```python
206
+ %load_ext calkit.magics
207
+ ```
208
+
209
+ the first cell can be turned into a pipeline stage by changing it to:
210
+
211
+ ```python
212
+ %%stage --name run-nb-proc --environment py --out result
213
+
214
+ from some_package import run_data_processing
215
+
216
+ result = run_data_processing(param1=55)
217
+ ```
218
+
219
+ In the magic command we're giving the cell a unique name,
220
+ declaring which environment it should run in
221
+ (`py` above, but it can be any environment in the project),
222
+ and declaring an output from the cell that we want to be available to
223
+ cells below.
224
+
225
+ Now, the kernel can be restarted and we can use "run all cells above"
226
+ when working on the figure,
227
+ and we'll have `result` nearly instantaneously.
228
+ `result` will also be versioned with DVC and pushed to the cloud by default,
229
+ so our collaborators can also take advantage of the caching
230
+ without bloating the Git repo.
231
+ Execution as part of the project's pipeline will also take advantage of
232
+ the caching and will not rerun data processing unless something
233
+ about that cell's code or environment has changed.
234
+
235
+ For a more in-depth look at using the `%%stage` cell magic,
236
+ see [this tutorial](tutorials/notebook-pipeline.md).
@@ -45,6 +45,7 @@ nav:
45
45
  - The pipeline:
46
46
  - pipeline/index.md
47
47
  - pipeline/manual-steps.md
48
+ - Notebooks: notebooks.md
48
49
  - Datasets: datasets.md
49
50
  - References: references.md
50
51
  - Calculations: calculations.md
File without changes
File without changes
File without changes
File without changes