calkit-python 0.0.1__tar.gz → 0.0.3__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 (30) hide show
  1. {calkit_python-0.0.1 → calkit_python-0.0.3}/PKG-INFO +6 -4
  2. {calkit_python-0.0.1 → calkit_python-0.0.3}/calkit/__init__.py +1 -1
  3. {calkit_python-0.0.1 → calkit_python-0.0.3}/calkit/cli.py +61 -1
  4. {calkit_python-0.0.1 → calkit_python-0.0.3}/calkit/cloud.py +2 -0
  5. {calkit_python-0.0.1 → calkit_python-0.0.3}/calkit/config.py +2 -0
  6. {calkit_python-0.0.1 → calkit_python-0.0.3}/calkit/core.py +12 -0
  7. {calkit_python-0.0.1 → calkit_python-0.0.3}/calkit/data.py +8 -1
  8. {calkit_python-0.0.1 → calkit_python-0.0.3}/calkit/dvc.py +2 -0
  9. {calkit_python-0.0.1 → calkit_python-0.0.3}/calkit/git.py +2 -0
  10. {calkit_python-0.0.1 → calkit_python-0.0.3}/calkit/jupyter.py +2 -0
  11. calkit_python-0.0.3/calkit/models.py +74 -0
  12. {calkit_python-0.0.1 → calkit_python-0.0.3}/calkit/server.py +2 -0
  13. {calkit_python-0.0.1 → calkit_python-0.0.3}/pyproject.toml +26 -21
  14. {calkit_python-0.0.1 → calkit_python-0.0.3}/.github/FUNDING.yml +0 -0
  15. {calkit_python-0.0.1 → calkit_python-0.0.3}/.github/workflows/publish-test.yml +0 -0
  16. {calkit_python-0.0.1 → calkit_python-0.0.3}/.github/workflows/publish.yml +0 -0
  17. {calkit_python-0.0.1 → calkit_python-0.0.3}/.gitignore +0 -0
  18. {calkit_python-0.0.1 → calkit_python-0.0.3}/LICENSE +0 -0
  19. {calkit_python-0.0.1 → calkit_python-0.0.3}/README.md +0 -0
  20. {calkit_python-0.0.1 → calkit_python-0.0.3}/calkit/gui.py +0 -0
  21. {calkit_python-0.0.1 → calkit_python-0.0.3}/calkit/tests/__init__.py +0 -0
  22. {calkit_python-0.0.1 → calkit_python-0.0.3}/calkit/tests/test_core.py +0 -0
  23. {calkit_python-0.0.1 → calkit_python-0.0.3}/calkit/tests/test_jupyter.py +0 -0
  24. {calkit_python-0.0.1 → calkit_python-0.0.3}/examples/cfd-study/README.md +0 -0
  25. {calkit_python-0.0.1 → calkit_python-0.0.3}/examples/cfd-study/calkit.yaml +0 -0
  26. {calkit_python-0.0.1 → calkit_python-0.0.3}/examples/cfd-study/config/simulations/runs.csv +0 -0
  27. {calkit_python-0.0.1 → calkit_python-0.0.3}/examples/cfd-study/notebook.ipynb +0 -0
  28. {calkit_python-0.0.1 → calkit_python-0.0.3}/examples/ms-office/.gitignore +0 -0
  29. {calkit_python-0.0.1 → calkit_python-0.0.3}/examples/ms-office/README.md +0 -0
  30. {calkit_python-0.0.1 → calkit_python-0.0.3}/examples/ms-office/calkit.yaml +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: calkit-python
3
- Version: 0.0.1
4
- Summary: Reproducibility made easy.
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
@@ -1,4 +1,4 @@
1
- __version__ = "0.0.1"
1
+ __version__ = "0.0.3"
2
2
 
3
3
  from .core import *
4
4
  from . import git
@@ -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 calkit
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
@@ -1,5 +1,7 @@
1
1
  """The REST API client."""
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import os
4
6
  from functools import partial
5
7
  from typing import Literal
@@ -1,5 +1,7 @@
1
1
  """Configuration."""
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import os
4
6
  from typing import Literal
5
7
 
@@ -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."""
@@ -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
 
@@ -1,5 +1,7 @@
1
1
  """Working with DVC."""
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import logging
4
6
  import subprocess
5
7
 
@@ -1,5 +1,7 @@
1
1
  """Git-related functionality."""
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import git
4
6
 
5
7
 
@@ -1,5 +1,7 @@
1
1
  """Functionality for working with Jupyter."""
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import subprocess
4
6
 
5
7
  from pydantic import BaseModel
@@ -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] = []
@@ -1,5 +1,7 @@
1
1
  """A local server for interacting with project repos."""
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import os
4
6
 
5
7
  import dvc
@@ -1,33 +1,38 @@
1
1
  [build-system]
2
- requires = ["hatchling"]
3
2
  build-backend = "hatchling.build"
3
+ requires = ["hatchling"]
4
4
 
5
5
  [project]
6
- name = "calkit-python"
7
- dynamic = ["version"]
8
6
  authors = [
9
- { name="Pete Bachant", email="petebachant@gmail.com" },
7
+ {name = "Pete Bachant", email = "petebachant@gmail.com"},
10
8
  ]
11
- description = "Reproducibility made easy."
12
- readme = "README.md"
13
- requires-python = ">=3.8"
14
9
  classifiers = [
15
- "Programming Language :: Python :: 3",
16
- "License :: OSI Approved :: MIT License",
17
- "Operating System :: OS Independent",
10
+ "Programming Language :: Python :: 3",
11
+ "License :: OSI Approved :: MIT License",
12
+ "Operating System :: OS Independent",
18
13
  ]
19
14
  dependencies = [
20
- "dvc",
21
- "fastapi",
22
- "gitpython",
23
- "keyring",
24
- "pandas",
25
- "polars",
26
- "pydantic[email]",
27
- "pydantic-settings",
28
- "pyjwt",
29
- "requests",
30
- "typer",
15
+ "dvc",
16
+ "eval-type-backport; python_version < '3.10'",
17
+ "fastapi",
18
+ "gitpython",
19
+ "keyring",
20
+ "pydantic[email]",
21
+ "pydantic-settings",
22
+ "pyjwt",
23
+ "requests",
24
+ "typer",
25
+ ]
26
+ description = "Reproducibility simplified."
27
+ dynamic = ["version"]
28
+ name = "calkit-python"
29
+ readme = "README.md"
30
+ requires-python = ">=3.8"
31
+
32
+ [project.optional-dependencies]
33
+ data = [
34
+ "pandas",
35
+ "polars",
31
36
  ]
32
37
 
33
38
  [project.urls]
File without changes
File without changes
File without changes