calkit-python 0.0.3__tar.gz → 0.0.4__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 (31) hide show
  1. {calkit_python-0.0.3 → calkit_python-0.0.4}/PKG-INFO +36 -4
  2. calkit_python-0.0.4/README.md +81 -0
  3. {calkit_python-0.0.3 → calkit_python-0.0.4}/calkit/__init__.py +1 -1
  4. {calkit_python-0.0.3 → calkit_python-0.0.4}/calkit/cli.py +103 -13
  5. {calkit_python-0.0.3 → calkit_python-0.0.4}/calkit/models.py +7 -0
  6. {calkit_python-0.0.3 → calkit_python-0.0.4}/pyproject.toml +1 -0
  7. calkit_python-0.0.3/README.md +0 -50
  8. {calkit_python-0.0.3 → calkit_python-0.0.4}/.github/FUNDING.yml +0 -0
  9. {calkit_python-0.0.3 → calkit_python-0.0.4}/.github/workflows/publish-test.yml +0 -0
  10. {calkit_python-0.0.3 → calkit_python-0.0.4}/.github/workflows/publish.yml +0 -0
  11. {calkit_python-0.0.3 → calkit_python-0.0.4}/.gitignore +0 -0
  12. {calkit_python-0.0.3 → calkit_python-0.0.4}/LICENSE +0 -0
  13. {calkit_python-0.0.3 → calkit_python-0.0.4}/calkit/cloud.py +0 -0
  14. {calkit_python-0.0.3 → calkit_python-0.0.4}/calkit/config.py +0 -0
  15. {calkit_python-0.0.3 → calkit_python-0.0.4}/calkit/core.py +0 -0
  16. {calkit_python-0.0.3 → calkit_python-0.0.4}/calkit/data.py +0 -0
  17. {calkit_python-0.0.3 → calkit_python-0.0.4}/calkit/dvc.py +0 -0
  18. {calkit_python-0.0.3 → calkit_python-0.0.4}/calkit/git.py +0 -0
  19. {calkit_python-0.0.3 → calkit_python-0.0.4}/calkit/gui.py +0 -0
  20. {calkit_python-0.0.3 → calkit_python-0.0.4}/calkit/jupyter.py +0 -0
  21. {calkit_python-0.0.3 → calkit_python-0.0.4}/calkit/server.py +0 -0
  22. {calkit_python-0.0.3 → calkit_python-0.0.4}/calkit/tests/__init__.py +0 -0
  23. {calkit_python-0.0.3 → calkit_python-0.0.4}/calkit/tests/test_core.py +0 -0
  24. {calkit_python-0.0.3 → calkit_python-0.0.4}/calkit/tests/test_jupyter.py +0 -0
  25. {calkit_python-0.0.3 → calkit_python-0.0.4}/examples/cfd-study/README.md +0 -0
  26. {calkit_python-0.0.3 → calkit_python-0.0.4}/examples/cfd-study/calkit.yaml +0 -0
  27. {calkit_python-0.0.3 → calkit_python-0.0.4}/examples/cfd-study/config/simulations/runs.csv +0 -0
  28. {calkit_python-0.0.3 → calkit_python-0.0.4}/examples/cfd-study/notebook.ipynb +0 -0
  29. {calkit_python-0.0.3 → calkit_python-0.0.4}/examples/ms-office/.gitignore +0 -0
  30. {calkit_python-0.0.3 → calkit_python-0.0.4}/examples/ms-office/README.md +0 -0
  31. {calkit_python-0.0.3 → calkit_python-0.0.4}/examples/ms-office/calkit.yaml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: calkit-python
3
- Version: 0.0.3
3
+ Version: 0.0.4
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
@@ -15,6 +15,7 @@ Requires-Dist: eval-type-backport; python_version < '3.10'
15
15
  Requires-Dist: fastapi
16
16
  Requires-Dist: gitpython
17
17
  Requires-Dist: keyring
18
+ Requires-Dist: nbconvert
18
19
  Requires-Dist: pydantic-settings
19
20
  Requires-Dist: pydantic[email]
20
21
  Requires-Dist: pyjwt
@@ -27,12 +28,43 @@ Description-Content-Type: text/markdown
27
28
 
28
29
  # Calkit
29
30
 
30
- [Calkit](https://calkit.io) makes reproducible research easy,
31
+ [Calkit](https://calkit.io) simplifies reproducibility,
31
32
  acting as a layer on top of
32
- [Git](https://git-scm.com/) and [DVC](https://dvc.org/), such that all
33
- all materials involved in the research process can be fully described in a
33
+ [Git](https://git-scm.com/), [DVC](https://dvc.org/),
34
+ [Zenodo](https://zenodo.org), and more,
35
+ such that all all aspects of the research process can be fully described in a
34
36
  single repository.
35
37
 
38
+ ## Why does reproducibility matter?
39
+
40
+ If your work is reproducible, that means that someone else can "run" it and
41
+ get the same results or outputs.
42
+ This is a major step towards addressing
43
+ [the replication crisis](https://en.wikipedia.org/wiki/Replication_crisis)
44
+ and has some major benefits for both you as an individual and the research
45
+ community:
46
+
47
+ 1. You will avoid mistakes caused by, e.g., running an old version of a script
48
+ and including a figure that wasn't created after fixing a bug in the data
49
+ processing pipeline.
50
+ 2. Since your project is "runnable," it's more likely that someone else will be
51
+ able to reuse part of your work to run it in a different context, thereby
52
+ producing a bigger impact and accelerating the pace of discovery.
53
+ If someone can take what you've done and use it to calculate a
54
+ prediction, you have just produced truly useful knowledge.
55
+
56
+ ## Why another tool/platform?
57
+
58
+ Git, GitHub, DVC, Zenodo et al. are amazing tools/platforms, but their
59
+ use involves multiple fairly difficult learning curves.
60
+ Our goal is to provide a single tool and platform to unify all of these so
61
+ that there is a single, gentle learning curve.
62
+ However, it is not our goal to hide or replace these underlying components.
63
+ Advanced users can use them directly, but new users aren't forced to, which
64
+ helps them get up and running with less effort and training.
65
+ Calkit should help users understand what is going on under the hood without
66
+ forcing them to work at that lower level of abstraction.
67
+
36
68
  ## Installation
37
69
 
38
70
  Simply run
@@ -0,0 +1,81 @@
1
+ # Calkit
2
+
3
+ [Calkit](https://calkit.io) simplifies reproducibility,
4
+ acting as a layer on top of
5
+ [Git](https://git-scm.com/), [DVC](https://dvc.org/),
6
+ [Zenodo](https://zenodo.org), and more,
7
+ such that all all aspects of the research process can be fully described in a
8
+ single repository.
9
+
10
+ ## Why does reproducibility matter?
11
+
12
+ If your work is reproducible, that means that someone else can "run" it and
13
+ get the same results or outputs.
14
+ This is a major step towards addressing
15
+ [the replication crisis](https://en.wikipedia.org/wiki/Replication_crisis)
16
+ and has some major benefits for both you as an individual and the research
17
+ community:
18
+
19
+ 1. You will avoid mistakes caused by, e.g., running an old version of a script
20
+ and including a figure that wasn't created after fixing a bug in the data
21
+ processing pipeline.
22
+ 2. Since your project is "runnable," it's more likely that someone else will be
23
+ able to reuse part of your work to run it in a different context, thereby
24
+ producing a bigger impact and accelerating the pace of discovery.
25
+ If someone can take what you've done and use it to calculate a
26
+ prediction, you have just produced truly useful knowledge.
27
+
28
+ ## Why another tool/platform?
29
+
30
+ Git, GitHub, DVC, Zenodo et al. are amazing tools/platforms, but their
31
+ use involves multiple fairly difficult learning curves.
32
+ Our goal is to provide a single tool and platform to unify all of these so
33
+ that there is a single, gentle learning curve.
34
+ However, it is not our goal to hide or replace these underlying components.
35
+ Advanced users can use them directly, but new users aren't forced to, which
36
+ helps them get up and running with less effort and training.
37
+ Calkit should help users understand what is going on under the hood without
38
+ forcing them to work at that lower level of abstraction.
39
+
40
+ ## Installation
41
+
42
+ Simply run
43
+
44
+ ```sh
45
+ pip install calkit-python
46
+ ```
47
+
48
+ ## Cloud integration
49
+
50
+ The Calkit cloud platform (https://calkit.io) serves as a project
51
+ management interface and a DVC remote for easily storing all versions of your
52
+ data/code/figures/publications, interacting with your collaborators,
53
+ reusing others' research artifacts, etc.
54
+
55
+ After signing up, visit the [settings](https://calkit.io/settings) page
56
+ and create a token.
57
+ Then run
58
+
59
+ ```sh
60
+ calkit config set token ${YOUR_TOKEN_HERE}
61
+ ```
62
+
63
+ Then, inside a project repo you'd like to connect to the cloud, run
64
+
65
+ ```sh
66
+ calkit config setup-remote
67
+ ```
68
+
69
+ This will setup the Calkit DVC remote, such that commands like `dvc push` will
70
+ allow you to push versions of your data or pipeline outputs to the cloud
71
+ for safe storage and sharing with your collaborators.
72
+
73
+ ## How it works
74
+
75
+ Calkit creates a simple human-readable "database" inside the `calkit.yaml`
76
+ file, which serves as a way to store important information about the project,
77
+ e.g., what question(s) it seeks to answer,
78
+ what files should be considered datasets, figures, publications, etc.
79
+ The Calkit cloud reads this database and registers the various entities
80
+ as part of the entire ecosystem such that if a project is made public,
81
+ other researchers can find and reuse your work to accelerate their own.
@@ -1,4 +1,4 @@
1
- __version__ = "0.0.3"
1
+ __version__ = "0.0.4"
2
2
 
3
3
  from .core import *
4
4
  from . import git
@@ -60,19 +60,26 @@ def get_status():
60
60
  """Get a unified Git and DVC status."""
61
61
 
62
62
  def print_sep(name: str):
63
- print(f"------------ {name} ------------")
63
+ width = 66
64
+ txt_width = len(name) + 2
65
+ buffer_width = (width - txt_width) // 2
66
+ buffer = "-" * buffer_width
67
+ typer.echo(f"{buffer} {name} {buffer}")
64
68
 
65
- print_sep("Code")
66
- if os.name == "nt":
67
- subprocess.call(["git", "status"])
68
- print()
69
- print_sep("data")
70
- subprocess.call(["dvc", "status"])
71
- else:
72
- pty.spawn(["git", "status"], lambda fd: os.read(fd, 1024))
73
- print()
74
- print_sep("Data")
75
- pty.spawn(["dvc", "status"], lambda fd: os.read(fd, 1024))
69
+ def run_cmd(cmd: list[str]):
70
+ if os.name == "nt":
71
+ subprocess.call(cmd)
72
+ else:
73
+ pty.spawn(cmd, lambda fd: os.read(fd, 1024))
74
+
75
+ print_sep("Code (Git)")
76
+ run_cmd(["git", "status"])
77
+ typer.echo()
78
+ print_sep("Data (DVC)")
79
+ run_cmd(["dvc", "data", "status"])
80
+ typer.echo()
81
+ print_sep("Pipeline (DVC)")
82
+ run_cmd(["dvc", "status"])
76
83
 
77
84
 
78
85
  @app.command(name="add")
@@ -105,6 +112,22 @@ def commit(
105
112
  raise NotImplementedError
106
113
 
107
114
 
115
+ @app.command(name="pull", help="Pull with both Git and DVC.")
116
+ def pull():
117
+ typer.echo("Git pulling")
118
+ subprocess.call(["git", "pull"])
119
+ typer.echo("DVC pulling")
120
+ subprocess.call(["dvc", "pull"])
121
+
122
+
123
+ @app.command(name="push", help="Push with both Git and DVC.")
124
+ def push():
125
+ typer.echo("Pushing to Git remote")
126
+ subprocess.call(["git", "push"])
127
+ typer.echo("Pushing to DVC remote")
128
+ subprocess.call(["dvc", "push"])
129
+
130
+
108
131
  @new_app.command(name="figure")
109
132
  def new_figure(
110
133
  path: str,
@@ -160,7 +183,7 @@ def new_question(
160
183
  repo.git.commit(["-m", "Add question"])
161
184
 
162
185
 
163
- @app.command(name="server")
186
+ @app.command(name="server", help="Run the local server.")
164
187
  def run_server():
165
188
  import uvicorn
166
189
 
@@ -173,5 +196,72 @@ def run_server():
173
196
  )
174
197
 
175
198
 
199
+ @app.command(
200
+ name="run",
201
+ add_help_option=False,
202
+ help="Run DVC pipeline (a wrapper for `dvc repro`).",
203
+ )
204
+ def run_dvc_repro(
205
+ targets: Optional[list[str]] = typer.Argument(default=None),
206
+ help: Annotated[bool, typer.Option("-h", "--help")] = False,
207
+ quiet: Annotated[bool, typer.Option("-q", "--quiet")] = False,
208
+ verbose: Annotated[bool, typer.Option("-v", "--verbose")] = False,
209
+ force: Annotated[bool, typer.Option("-f", "--force")] = False,
210
+ interactive: Annotated[bool, typer.Option("-i", "--interactive")] = False,
211
+ single_item: Annotated[bool, typer.Option("-s", "--single-item")] = False,
212
+ pipeline: Annotated[
213
+ Optional[str], typer.Option("-p", "--pipeline")
214
+ ] = None,
215
+ all_pipelines: Annotated[
216
+ bool, typer.Option("-P", "--all-pipelines")
217
+ ] = False,
218
+ recursive: Annotated[bool, typer.Option("-R", "--recursive")] = False,
219
+ downstream: Annotated[
220
+ Optional[list[str]], typer.Option("--downstream")
221
+ ] = None,
222
+ force_downstream: Annotated[
223
+ bool, typer.Option("--force-downstream")
224
+ ] = False,
225
+ pull: Annotated[bool, typer.Option("--pull")] = False,
226
+ allow_missing: Annotated[bool, typer.Option("--allow-missing")] = False,
227
+ dry: Annotated[bool, typer.Option("--dry")] = False,
228
+ keep_going: Annotated[bool, typer.Option("--keep-going", "-k")] = False,
229
+ ignore_errors: Annotated[bool, typer.Option("--ignore-errors")] = False,
230
+ glob: Annotated[bool, typer.Option("--glob")] = False,
231
+ no_commit: Annotated[bool, typer.Option("--no-commit")] = False,
232
+ no_run_cache: Annotated[bool, typer.Option("--no-run-cache")] = False,
233
+ ):
234
+ """A simple wrapper for ``dvc repro``."""
235
+ if targets is None:
236
+ targets = []
237
+ args = targets
238
+ # Extract any boolean args
239
+ for name in [
240
+ "help",
241
+ "quiet",
242
+ "verbose",
243
+ "force",
244
+ "interactive",
245
+ "single-item",
246
+ "all-pipelines",
247
+ "recursive",
248
+ "pull",
249
+ "allow-missing",
250
+ "dry",
251
+ "keep-going",
252
+ "force-downstream",
253
+ "glob",
254
+ "no-commit",
255
+ "no-run-cache",
256
+ ]:
257
+ if locals()[name.replace("-", "_")]:
258
+ args.append("--" + name)
259
+ if pipeline is not None:
260
+ args += ["--pipeline", pipeline]
261
+ if downstream is not None:
262
+ args += downstream
263
+ subprocess.call(["dvc", "repro"] + args)
264
+
265
+
176
266
  def run() -> None:
177
267
  app()
@@ -60,6 +60,12 @@ class Software(BaseModel):
60
60
  description: str
61
61
 
62
62
 
63
+ class Notebook(_CalkitObject):
64
+ """A Jupyter notebook."""
65
+
66
+ pass
67
+
68
+
63
69
  class ProjectInfo(BaseModel):
64
70
  """All of the project's information or metadata, written to the
65
71
  ``calkit.yaml`` file.
@@ -72,3 +78,4 @@ class ProjectInfo(BaseModel):
72
78
  references: list[ReferenceCollection] = []
73
79
  environments: list[Environment] = []
74
80
  software: list[Software] = []
81
+ notebooks: list[Notebook] = []
@@ -17,6 +17,7 @@ dependencies = [
17
17
  "fastapi",
18
18
  "gitpython",
19
19
  "keyring",
20
+ "nbconvert",
20
21
  "pydantic[email]",
21
22
  "pydantic-settings",
22
23
  "pyjwt",
@@ -1,50 +0,0 @@
1
- # Calkit
2
-
3
- [Calkit](https://calkit.io) makes reproducible research easy,
4
- acting as a layer on top of
5
- [Git](https://git-scm.com/) and [DVC](https://dvc.org/), such that all
6
- all materials involved in the research process can be fully described in a
7
- single repository.
8
-
9
- ## Installation
10
-
11
- Simply run
12
-
13
- ```sh
14
- pip install calkit-python
15
- ```
16
-
17
- ## Cloud integration
18
-
19
- The Calkit cloud platform (https://calkit.io) serves as a project
20
- management interface and a DVC remote for easily storing all versions of your
21
- data/code/figures/publications, interacting with your collaborators,
22
- reusing others' research artifacts, etc.
23
-
24
- After signing up, visit the [settings](https://calkit.io/settings) page
25
- and create a token.
26
- Then run
27
-
28
- ```sh
29
- calkit config set token ${YOUR_TOKEN_HERE}
30
- ```
31
-
32
- Then, inside a project repo you'd like to connect to the cloud, run
33
-
34
- ```sh
35
- calkit config setup-remote
36
- ```
37
-
38
- This will setup the Calkit DVC remote, such that commands like `dvc push` will
39
- allow you to push versions of your data or pipeline outputs to the cloud
40
- for safe storage and sharing with your collaborators.
41
-
42
- ## How it works
43
-
44
- Calkit creates a simple human-readable "database" inside the `calkit.yaml`
45
- file, which serves as a way to store important information about the project,
46
- e.g., what question(s) it seeks to answer,
47
- what files should be considered datasets, figures, publications, etc.
48
- The Calkit cloud reads this database and registers the various entities
49
- as part of the entire ecosystem such that if a project is made public,
50
- other researchers can find and reuse your work to accelerate their own.
File without changes
File without changes