calkit-python 0.0.1__py3-none-any.whl → 0.0.3__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 +1 -1
- calkit/cli.py +61 -1
- calkit/cloud.py +2 -0
- calkit/config.py +2 -0
- calkit/core.py +12 -0
- calkit/data.py +8 -1
- calkit/dvc.py +2 -0
- calkit/git.py +2 -0
- calkit/jupyter.py +2 -0
- calkit/models.py +74 -0
- calkit/server.py +2 -0
- {calkit_python-0.0.1.dist-info → calkit_python-0.0.3.dist-info}/METADATA +6 -4
- calkit_python-0.0.3.dist-info/RECORD +20 -0
- calkit_python-0.0.1.dist-info/RECORD +0 -19
- {calkit_python-0.0.1.dist-info → calkit_python-0.0.3.dist-info}/WHEEL +0 -0
- {calkit_python-0.0.1.dist-info → calkit_python-0.0.3.dist-info}/entry_points.txt +0 -0
- {calkit_python-0.0.1.dist-info → calkit_python-0.0.3.dist-info}/licenses/LICENSE +0 -0
calkit/__init__.py
CHANGED
calkit/cli.py
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
"""The command line interface."""
|
|
2
2
|
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
3
5
|
import os
|
|
4
6
|
import pty
|
|
5
7
|
import subprocess
|
|
6
8
|
import sys
|
|
7
9
|
|
|
10
|
+
import git
|
|
8
11
|
import typer
|
|
9
12
|
from typing_extensions import Annotated, Optional
|
|
10
13
|
|
|
11
|
-
import
|
|
14
|
+
from calkit.core import ryaml
|
|
12
15
|
|
|
13
16
|
from . import config
|
|
14
17
|
from .dvc import configure_remote, set_remote_auth
|
|
15
18
|
|
|
16
19
|
app = typer.Typer()
|
|
17
20
|
config_app = typer.Typer()
|
|
21
|
+
new_app = typer.Typer()
|
|
18
22
|
app.add_typer(config_app, name="config", help="Configure Calkit.")
|
|
23
|
+
app.add_typer(new_app, name="new", help="Add new Calkit object.")
|
|
19
24
|
|
|
20
25
|
|
|
21
26
|
@config_app.command(name="set")
|
|
@@ -100,6 +105,61 @@ def commit(
|
|
|
100
105
|
raise NotImplementedError
|
|
101
106
|
|
|
102
107
|
|
|
108
|
+
@new_app.command(name="figure")
|
|
109
|
+
def new_figure(
|
|
110
|
+
path: str,
|
|
111
|
+
title: Annotated[str, typer.Option("--title")],
|
|
112
|
+
description: Annotated[str, typer.Option("--desc")] = None,
|
|
113
|
+
commit: Annotated[bool, typer.Option("--commit")] = False,
|
|
114
|
+
):
|
|
115
|
+
"""Add a new figure to ``calkit.yaml``."""
|
|
116
|
+
if os.path.isfile("calkit.yaml"):
|
|
117
|
+
with open("calkit.yaml") as f:
|
|
118
|
+
ck_info = ryaml.load(f)
|
|
119
|
+
else:
|
|
120
|
+
ck_info = {}
|
|
121
|
+
figures = ck_info.get("figures", [])
|
|
122
|
+
paths = [f.get("path") for f in figures]
|
|
123
|
+
if path in paths:
|
|
124
|
+
raise ValueError(f"Figure at path {path} already exists")
|
|
125
|
+
obj = dict(path=path, title=title)
|
|
126
|
+
if description is not None:
|
|
127
|
+
obj["description"] = description
|
|
128
|
+
figures.append(obj)
|
|
129
|
+
ck_info["figures"] = figures
|
|
130
|
+
with open("calkit.yaml", "w") as f:
|
|
131
|
+
ryaml.dump(ck_info, f)
|
|
132
|
+
if commit:
|
|
133
|
+
repo = git.Repo()
|
|
134
|
+
repo.git.add("calkit.yaml")
|
|
135
|
+
repo.git.commit(["-m", f"Add figure {path}"])
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
@new_app.command("question")
|
|
139
|
+
def new_question(
|
|
140
|
+
question: str,
|
|
141
|
+
commit: Annotated[bool, typer.Option("--commit")] = False,
|
|
142
|
+
):
|
|
143
|
+
if os.path.isfile("calkit.yaml"):
|
|
144
|
+
with open("calkit.yaml") as f:
|
|
145
|
+
ck_info = ryaml.load(f)
|
|
146
|
+
else:
|
|
147
|
+
ck_info = {}
|
|
148
|
+
questions = ck_info.get("questions", [])
|
|
149
|
+
if question in questions:
|
|
150
|
+
raise ValueError("Question already exists")
|
|
151
|
+
if not question.endswith("?"):
|
|
152
|
+
raise ValueError("Questions must end with a question mark")
|
|
153
|
+
questions.append(question)
|
|
154
|
+
ck_info["questions"] = questions
|
|
155
|
+
with open("calkit.yaml", "w") as f:
|
|
156
|
+
ryaml.dump(ck_info, f)
|
|
157
|
+
if commit:
|
|
158
|
+
repo = git.Repo()
|
|
159
|
+
repo.git.add("calkit.yaml")
|
|
160
|
+
repo.git.commit(["-m", "Add question"])
|
|
161
|
+
|
|
162
|
+
|
|
103
163
|
@app.command(name="server")
|
|
104
164
|
def run_server():
|
|
105
165
|
import uvicorn
|
calkit/cloud.py
CHANGED
calkit/config.py
CHANGED
calkit/core.py
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
"""Core functionality."""
|
|
2
2
|
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
3
5
|
import glob
|
|
6
|
+
import logging
|
|
4
7
|
import os
|
|
5
8
|
|
|
9
|
+
import ruamel.yaml
|
|
6
10
|
from git import Repo
|
|
7
11
|
from git.exc import InvalidGitRepositoryError
|
|
8
12
|
|
|
13
|
+
logging.basicConfig(level=logging.INFO)
|
|
14
|
+
logger = logging.getLogger(__package__)
|
|
15
|
+
|
|
16
|
+
ryaml = ruamel.yaml.YAML()
|
|
17
|
+
ryaml.indent(mapping=2, sequence=4, offset=2)
|
|
18
|
+
ryaml.preserve_quotes = True
|
|
19
|
+
ryaml.width = 70
|
|
20
|
+
|
|
9
21
|
|
|
10
22
|
def find_project_dirs(relative=False, max_depth=3) -> list[str]:
|
|
11
23
|
"""Find all Calkit project directories."""
|
calkit/data.py
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
"""Functionality for working with datasets.
|
|
1
|
+
"""Functionality for working with datasets.
|
|
2
|
+
|
|
3
|
+
Since the dependencies here are optional, we need to ensure this isn't imported
|
|
4
|
+
by default, or otherwise ensure ``import calkit`` works when the data
|
|
5
|
+
dependencies are not installed.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
2
9
|
|
|
3
10
|
from typing import Literal, Union
|
|
4
11
|
|
calkit/dvc.py
CHANGED
calkit/git.py
CHANGED
calkit/jupyter.py
CHANGED
calkit/models.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"""Data models."""
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class _ImportedFrom(BaseModel):
|
|
9
|
+
project: str
|
|
10
|
+
path: str = None
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class _CalkitObject(BaseModel):
|
|
14
|
+
path: str
|
|
15
|
+
title: str
|
|
16
|
+
description: str
|
|
17
|
+
stage: str | None = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class Dataset(_CalkitObject):
|
|
21
|
+
pass
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class Figure(_CalkitObject):
|
|
25
|
+
pass
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class Publication(_CalkitObject):
|
|
29
|
+
kind: Literal[
|
|
30
|
+
"journal-article",
|
|
31
|
+
"conference-paper",
|
|
32
|
+
"presentation",
|
|
33
|
+
"poster",
|
|
34
|
+
"report",
|
|
35
|
+
"blog",
|
|
36
|
+
]
|
|
37
|
+
is_published: bool = False
|
|
38
|
+
doi: str = None
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class ReferenceFile(BaseModel):
|
|
42
|
+
path: str
|
|
43
|
+
key: str
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class ReferenceCollection(BaseModel):
|
|
47
|
+
path: str
|
|
48
|
+
files: list[ReferenceFile] = []
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class Environment(BaseModel):
|
|
52
|
+
name: str
|
|
53
|
+
kind: Literal["conda", "docker", "pip", "poetry", "npm", "yarn"]
|
|
54
|
+
path: str
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class Software(BaseModel):
|
|
58
|
+
title: str
|
|
59
|
+
path: str
|
|
60
|
+
description: str
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class ProjectInfo(BaseModel):
|
|
64
|
+
"""All of the project's information or metadata, written to the
|
|
65
|
+
``calkit.yaml`` file.
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
questions: list[str] = []
|
|
69
|
+
datasets: list[Dataset] = []
|
|
70
|
+
figures: list[Figure] = []
|
|
71
|
+
publications: list[Publication] = []
|
|
72
|
+
references: list[ReferenceCollection] = []
|
|
73
|
+
environments: list[Environment] = []
|
|
74
|
+
software: list[Software] = []
|
calkit/server.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: calkit-python
|
|
3
|
-
Version: 0.0.
|
|
4
|
-
Summary: Reproducibility
|
|
3
|
+
Version: 0.0.3
|
|
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
|
|
7
7
|
Author-email: Pete Bachant <petebachant@gmail.com>
|
|
@@ -11,16 +11,18 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Requires-Python: >=3.8
|
|
13
13
|
Requires-Dist: dvc
|
|
14
|
+
Requires-Dist: eval-type-backport; python_version < '3.10'
|
|
14
15
|
Requires-Dist: fastapi
|
|
15
16
|
Requires-Dist: gitpython
|
|
16
17
|
Requires-Dist: keyring
|
|
17
|
-
Requires-Dist: pandas
|
|
18
|
-
Requires-Dist: polars
|
|
19
18
|
Requires-Dist: pydantic-settings
|
|
20
19
|
Requires-Dist: pydantic[email]
|
|
21
20
|
Requires-Dist: pyjwt
|
|
22
21
|
Requires-Dist: requests
|
|
23
22
|
Requires-Dist: typer
|
|
23
|
+
Provides-Extra: data
|
|
24
|
+
Requires-Dist: pandas; extra == 'data'
|
|
25
|
+
Requires-Dist: polars; extra == 'data'
|
|
24
26
|
Description-Content-Type: text/markdown
|
|
25
27
|
|
|
26
28
|
# Calkit
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
calkit/__init__.py,sha256=WCAC5nhZD6Wzwgm3VMpKFCm3aGvtYoHqy3pt7kIgI9k,142
|
|
2
|
+
calkit/cli.py,sha256=DpYo_EKLBbLZfbFFihGo3L3uXlKURWwv_QUOgSkCUoo,4901
|
|
3
|
+
calkit/cloud.py,sha256=CnQKms4mBQo4X8jVLIa-70-3jPDl38zRNFyK5TjiaHM,2209
|
|
4
|
+
calkit/config.py,sha256=NPFRk5inn66Wy44pyx8WppyqvIzkW1sO6VjXwIcCacE,2044
|
|
5
|
+
calkit/core.py,sha256=qLNjBwlECzMitL85pMGIHzne4j7FpQAR9-ukYtdIMig,1225
|
|
6
|
+
calkit/data.py,sha256=DZDkj-BLFWXz56R-A9XZeSKSgXpm3aKtiqD6JstfmnY,1631
|
|
7
|
+
calkit/dvc.py,sha256=tX5172Ahw0mHcuJIrMenz1oGYxCrMzMURJJMHEHenbg,1506
|
|
8
|
+
calkit/git.py,sha256=NLd7A32dPbfVnZLa8xbmviJ-ChGZcdkcd6wcOOnsSKQ,350
|
|
9
|
+
calkit/gui.py,sha256=2UCrMyosc5v4CLlDcHO7oDwW9eLn5_WbNaLaG5bjMTc,23
|
|
10
|
+
calkit/jupyter.py,sha256=S6HUOVafaLQJ7_ZfC1ddBwF3fT5q3GcbouLHdlH-oSo,1034
|
|
11
|
+
calkit/models.py,sha256=TYllDbTutcODMUCLK2oCKivbJrtjwDu9t-5GyON9dq0,1339
|
|
12
|
+
calkit/server.py,sha256=gq3643ABKTQu1eVR_OqJ-SdQh2dPLHSFsipmmAK5ttA,5959
|
|
13
|
+
calkit/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
+
calkit/tests/test_core.py,sha256=CdRqvYnq3MidyTknvfIbkmmhMfydpyKtTW9hakAvzsc,167
|
|
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,,
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
calkit/__init__.py,sha256=3QZKwXecsbiUn-TsKW90NGAxGaVKOjG1q_EhB9lF_7Q,142
|
|
2
|
-
calkit/cli.py,sha256=G23OBAAEHt-gE9lEDQFJ45RGobPyC-tt_xHnCh8GNvs,2993
|
|
3
|
-
calkit/cloud.py,sha256=DLhds45nFFuXE9k6VpWMh4toxKZdy4yp2jfdAkl6Nzg,2173
|
|
4
|
-
calkit/config.py,sha256=UqgWHrsQgM_bODCrmOEJZY6gxpBs_jFbEdT-ZQLjLSQ,2008
|
|
5
|
-
calkit/core.py,sha256=44S3Ql3x6uJraoss9ha-FWbZeSfW2YOxU81p16k80h0,954
|
|
6
|
-
calkit/data.py,sha256=G_dFLUCE7tMqGfg7NV7-197NrOYATSgI1eTdcz2HCyI,1411
|
|
7
|
-
calkit/dvc.py,sha256=a5X8MeAr9rDmY70MZo4BHh2LfHocj0u4WAiqPXGGEos,1470
|
|
8
|
-
calkit/git.py,sha256=2BcfdyGaCxoN25S5aFGMRMmIfWHCrCoFY3hNrGsu2yM,314
|
|
9
|
-
calkit/gui.py,sha256=2UCrMyosc5v4CLlDcHO7oDwW9eLn5_WbNaLaG5bjMTc,23
|
|
10
|
-
calkit/jupyter.py,sha256=VYONwhc_2orwjlki0oNYxy1dYkDBFWvi02Tl8-Tnw-c,998
|
|
11
|
-
calkit/server.py,sha256=NgJuUcc8tZOY5wIH86xFA7Bs1Ji61JYcMUEB7VXlwkw,5923
|
|
12
|
-
calkit/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
-
calkit/tests/test_core.py,sha256=CdRqvYnq3MidyTknvfIbkmmhMfydpyKtTW9hakAvzsc,167
|
|
14
|
-
calkit/tests/test_jupyter.py,sha256=YTL6zI740UM2KUjskSipzvSKxsyQ8rVPFQIX5cb2tMQ,114
|
|
15
|
-
calkit_python-0.0.1.dist-info/METADATA,sha256=ryO4XQ0MNWArJsunUIEAWjM_oFcqUJ3VO7BIToD8jrk,2334
|
|
16
|
-
calkit_python-0.0.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
17
|
-
calkit_python-0.0.1.dist-info/entry_points.txt,sha256=tiPfbDDZNB-YStw5YVO_4Gww0W3Dcdy8Mh6muX_GWnY,42
|
|
18
|
-
calkit_python-0.0.1.dist-info/licenses/LICENSE,sha256=9ZamCaSUTZk9rcrnf-sWFKLOHr3ws-S_dgKMegW4nw8,1056
|
|
19
|
-
calkit_python-0.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|