calkit-python 0.0.3__py3-none-any.whl → 0.0.4__py3-none-any.whl

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.
calkit/__init__.py CHANGED
@@ -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
calkit/cli.py CHANGED
@@ -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()
calkit/models.py CHANGED
@@ -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] = []
@@ -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
@@ -1,5 +1,5 @@
1
- calkit/__init__.py,sha256=WCAC5nhZD6Wzwgm3VMpKFCm3aGvtYoHqy3pt7kIgI9k,142
2
- calkit/cli.py,sha256=DpYo_EKLBbLZfbFFihGo3L3uXlKURWwv_QUOgSkCUoo,4901
1
+ calkit/__init__.py,sha256=ZhTSlSvcKFHVv921t4q9zBBPNWHaT4h43s3G26KldNo,142
2
+ calkit/cli.py,sha256=FkZGfQNSjWKRjWDX10GMDTh3NM9E7cW9DJch2h_F75Q,7930
3
3
  calkit/cloud.py,sha256=CnQKms4mBQo4X8jVLIa-70-3jPDl38zRNFyK5TjiaHM,2209
4
4
  calkit/config.py,sha256=NPFRk5inn66Wy44pyx8WppyqvIzkW1sO6VjXwIcCacE,2044
5
5
  calkit/core.py,sha256=qLNjBwlECzMitL85pMGIHzne4j7FpQAR9-ukYtdIMig,1225
@@ -8,13 +8,13 @@ calkit/dvc.py,sha256=tX5172Ahw0mHcuJIrMenz1oGYxCrMzMURJJMHEHenbg,1506
8
8
  calkit/git.py,sha256=NLd7A32dPbfVnZLa8xbmviJ-ChGZcdkcd6wcOOnsSKQ,350
9
9
  calkit/gui.py,sha256=2UCrMyosc5v4CLlDcHO7oDwW9eLn5_WbNaLaG5bjMTc,23
10
10
  calkit/jupyter.py,sha256=S6HUOVafaLQJ7_ZfC1ddBwF3fT5q3GcbouLHdlH-oSo,1034
11
- calkit/models.py,sha256=TYllDbTutcODMUCLK2oCKivbJrtjwDu9t-5GyON9dq0,1339
11
+ calkit/models.py,sha256=ejl032XIrbaCFkO-4VbCaKVQyHqNl7N4WWU20RjeAfc,1447
12
12
  calkit/server.py,sha256=gq3643ABKTQu1eVR_OqJ-SdQh2dPLHSFsipmmAK5ttA,5959
13
13
  calkit/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  calkit/tests/test_core.py,sha256=CdRqvYnq3MidyTknvfIbkmmhMfydpyKtTW9hakAvzsc,167
15
15
  calkit/tests/test_jupyter.py,sha256=YTL6zI740UM2KUjskSipzvSKxsyQ8rVPFQIX5cb2tMQ,114
16
- calkit_python-0.0.3.dist-info/METADATA,sha256=NDjQb1WNaMJcEx-s4RTJyB-hNkGS3O7xy2Q6eCCn67Q,2449
17
- calkit_python-0.0.3.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
18
- calkit_python-0.0.3.dist-info/entry_points.txt,sha256=tiPfbDDZNB-YStw5YVO_4Gww0W3Dcdy8Mh6muX_GWnY,42
19
- calkit_python-0.0.3.dist-info/licenses/LICENSE,sha256=9ZamCaSUTZk9rcrnf-sWFKLOHr3ws-S_dgKMegW4nw8,1056
20
- calkit_python-0.0.3.dist-info/RECORD,,
16
+ calkit_python-0.0.4.dist-info/METADATA,sha256=yAlvKleBuX6xFXFH3u7UHZVJILjlC-RIOSeQEXcNx8A,4004
17
+ calkit_python-0.0.4.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
18
+ calkit_python-0.0.4.dist-info/entry_points.txt,sha256=tiPfbDDZNB-YStw5YVO_4Gww0W3Dcdy8Mh6muX_GWnY,42
19
+ calkit_python-0.0.4.dist-info/licenses/LICENSE,sha256=9ZamCaSUTZk9rcrnf-sWFKLOHr3ws-S_dgKMegW4nw8,1056
20
+ calkit_python-0.0.4.dist-info/RECORD,,