calkit-python 0.0.6__tar.gz → 0.0.7__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.
- {calkit_python-0.0.6 → calkit_python-0.0.7}/PKG-INFO +1 -1
- {calkit_python-0.0.6 → calkit_python-0.0.7}/calkit/__init__.py +1 -1
- {calkit_python-0.0.6 → calkit_python-0.0.7}/calkit/cli.py +93 -17
- {calkit_python-0.0.6 → calkit_python-0.0.7}/.github/FUNDING.yml +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/.github/workflows/publish-test.yml +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/.github/workflows/publish.yml +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/.gitignore +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/LICENSE +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/README.md +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/calkit/cloud.py +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/calkit/config.py +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/calkit/core.py +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/calkit/data.py +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/calkit/dvc.py +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/calkit/git.py +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/calkit/gui.py +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/calkit/jupyter.py +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/calkit/models.py +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/calkit/server.py +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/calkit/tests/__init__.py +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/calkit/tests/test_core.py +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/calkit/tests/test_jupyter.py +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/examples/cfd-study/README.md +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/examples/cfd-study/calkit.yaml +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/examples/cfd-study/config/simulations/runs.csv +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/examples/cfd-study/notebook.ipynb +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/examples/ms-office/.gitignore +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/examples/ms-office/README.md +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/examples/ms-office/calkit.yaml +0 -0
- {calkit_python-0.0.6 → calkit_python-0.0.7}/pyproject.toml +0 -0
|
@@ -21,6 +21,7 @@ app = typer.Typer(
|
|
|
21
21
|
invoke_without_command=True,
|
|
22
22
|
no_args_is_help=True,
|
|
23
23
|
context_settings=dict(help_option_names=["-h", "--help"]),
|
|
24
|
+
pretty_exceptions_show_locals=False,
|
|
24
25
|
)
|
|
25
26
|
config_app = typer.Typer(no_args_is_help=True)
|
|
26
27
|
new_app = typer.Typer(no_args_is_help=True)
|
|
@@ -104,33 +105,108 @@ def get_status():
|
|
|
104
105
|
|
|
105
106
|
|
|
106
107
|
@app.command(name="add")
|
|
107
|
-
def add(
|
|
108
|
+
def add(
|
|
109
|
+
paths: list[str],
|
|
110
|
+
commit_message: Annotated[
|
|
111
|
+
str,
|
|
112
|
+
typer.Option(
|
|
113
|
+
"-m",
|
|
114
|
+
"--commit-message",
|
|
115
|
+
help="Automatically commit and use this as a message.",
|
|
116
|
+
),
|
|
117
|
+
] = None,
|
|
118
|
+
push_commit: Annotated[
|
|
119
|
+
bool, typer.Option("--push", help="Push after committing.")
|
|
120
|
+
] = False,
|
|
121
|
+
to: Annotated[
|
|
122
|
+
str,
|
|
123
|
+
typer.Option(
|
|
124
|
+
"--to", "-t", help="System with which to add (git or dvc)."
|
|
125
|
+
),
|
|
126
|
+
] = None,
|
|
127
|
+
):
|
|
108
128
|
"""Add paths to the repo.
|
|
109
129
|
|
|
110
130
|
Code will be added to Git and data will be added to DVC.
|
|
131
|
+
|
|
132
|
+
Note: This will enable the 'autostage' feature of DVC, automatically
|
|
133
|
+
adding any .dvc files to Git when adding to DVC.
|
|
111
134
|
"""
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
135
|
+
if to is not None and to not in ["git", "dvc"]:
|
|
136
|
+
typer.echo(f"Invalid option for 'to': {to}")
|
|
137
|
+
raise typer.Exit(1)
|
|
138
|
+
# Ensure autostage is enabled for DVC
|
|
139
|
+
subprocess.call(["dvc", "config", "core.autostage", "true"])
|
|
140
|
+
subprocess.call(["git", "add", ".dvc/config"])
|
|
141
|
+
if to is not None:
|
|
142
|
+
subprocess.call([to, "add"] + paths)
|
|
143
|
+
else:
|
|
144
|
+
dvc_extensions = [
|
|
145
|
+
".png",
|
|
146
|
+
".h5",
|
|
147
|
+
".parquet",
|
|
148
|
+
".pickle",
|
|
149
|
+
".mp4",
|
|
150
|
+
".avi",
|
|
151
|
+
".webm",
|
|
152
|
+
".pdf",
|
|
153
|
+
]
|
|
154
|
+
dvc_size_thresh_bytes = 1_000_000
|
|
155
|
+
if "." in paths and to is None:
|
|
156
|
+
typer.echo("Cannot add '.' with calkit; use git or dvc")
|
|
157
|
+
raise typer.Exit(1)
|
|
158
|
+
if to is None:
|
|
159
|
+
for path in paths:
|
|
160
|
+
if os.path.isdir(path):
|
|
161
|
+
typer.echo("Cannot auto-add directories; use git or dvc")
|
|
162
|
+
raise typer.Exit(1)
|
|
163
|
+
for path in paths:
|
|
164
|
+
# Detect if this file should be tracked with Git or DVC
|
|
165
|
+
if os.path.splitext(path)[-1] in dvc_extensions:
|
|
166
|
+
typer.echo(f"Adding {path} to DVC per its extension")
|
|
167
|
+
subprocess.call(["dvc", "add", path])
|
|
168
|
+
continue
|
|
169
|
+
if os.path.getsize(path) > dvc_size_thresh_bytes:
|
|
170
|
+
typer.echo(
|
|
171
|
+
f"Adding {path} to DVC since it's greater than 1 MB"
|
|
172
|
+
)
|
|
173
|
+
subprocess.call(["dvc", "add", path])
|
|
174
|
+
continue
|
|
175
|
+
typer.echo(f"Adding {path} to Git")
|
|
176
|
+
subprocess.call(["git", "add", path])
|
|
177
|
+
if commit_message is not None:
|
|
178
|
+
subprocess.call(["git", "commit", "-m", commit_message])
|
|
179
|
+
if push_commit:
|
|
180
|
+
push()
|
|
124
181
|
|
|
125
182
|
|
|
126
183
|
@app.command(name="commit")
|
|
127
184
|
def commit(
|
|
128
|
-
all: Annotated[
|
|
129
|
-
|
|
185
|
+
all: Annotated[
|
|
186
|
+
Optional[bool],
|
|
187
|
+
typer.Option(
|
|
188
|
+
"--all", "-a", help="Automatically stage all changed files."
|
|
189
|
+
),
|
|
190
|
+
] = False,
|
|
191
|
+
message: Annotated[
|
|
192
|
+
Optional[str], typer.Option("--message", "-m", help="Commit message.")
|
|
193
|
+
] = None,
|
|
194
|
+
push_commit: Annotated[
|
|
195
|
+
bool,
|
|
196
|
+
typer.Option(
|
|
197
|
+
"--push", help="Push to both Git and DVC after committing."
|
|
198
|
+
),
|
|
199
|
+
] = False,
|
|
130
200
|
):
|
|
131
201
|
"""Commit a change to the repo."""
|
|
132
|
-
|
|
133
|
-
|
|
202
|
+
cmd = ["git", "commit"]
|
|
203
|
+
if all:
|
|
204
|
+
cmd.append("-a")
|
|
205
|
+
if message:
|
|
206
|
+
cmd += ["-m", message]
|
|
207
|
+
subprocess.call(cmd)
|
|
208
|
+
if push_commit:
|
|
209
|
+
push()
|
|
134
210
|
|
|
135
211
|
|
|
136
212
|
@app.command(name="pull", help="Pull with both Git and DVC.")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|