vantage6 4.13.0rc3__tar.gz → 4.13.3rc2__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.

Potentially problematic release.


This version of vantage6 might be problematic. Click here for more details.

Files changed (89) hide show
  1. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/PKG-INFO +25 -2
  2. vantage6-4.13.3rc2/vantage6/cli/__build__ +1 -0
  3. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/_version.py +1 -1
  4. vantage6-4.13.3rc2/vantage6/cli/algorithm/create.py +193 -0
  5. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6.egg-info/PKG-INFO +25 -2
  6. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6.egg-info/requires.txt +2 -2
  7. vantage6-4.13.0rc3/vantage6/cli/__build__ +0 -1
  8. vantage6-4.13.0rc3/vantage6/cli/algorithm/create.py +0 -69
  9. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/setup.cfg +0 -0
  10. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/setup.py +0 -0
  11. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/tests_cli/__init__.py +0 -0
  12. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/tests_cli/test_client_script.py +0 -0
  13. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/tests_cli/test_example.py +0 -0
  14. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/tests_cli/test_node_cli.py +0 -0
  15. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/tests_cli/test_server_cli.py +0 -0
  16. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/tests_cli/test_wizard.py +0 -0
  17. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/__init__.py +0 -0
  18. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/algorithm/update.py +0 -0
  19. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/algostore/attach.py +0 -0
  20. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/algostore/files.py +0 -0
  21. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/algostore/list.py +0 -0
  22. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/algostore/new.py +0 -0
  23. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/algostore/remove.py +0 -0
  24. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/algostore/start.py +0 -0
  25. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/algostore/stop.py +0 -0
  26. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/cli.py +0 -0
  27. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/common/decorator.py +0 -0
  28. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/common/start.py +0 -0
  29. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/common/utils.py +0 -0
  30. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/configuration_manager.py +0 -0
  31. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/configuration_wizard.py +0 -0
  32. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/context/__init__.py +0 -0
  33. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/context/algorithm_store.py +0 -0
  34. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/context/base_server.py +0 -0
  35. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/context/node.py +0 -0
  36. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/context/server.py +0 -0
  37. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/dev/create.py +0 -0
  38. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/dev/data/km_dataset.csv +0 -0
  39. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/dev/data/olympic_athletes_2016.csv +0 -0
  40. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/dev/remove.py +0 -0
  41. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/dev/start.py +0 -0
  42. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/dev/stop.py +0 -0
  43. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/dev/utils.py +0 -0
  44. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/globals.py +0 -0
  45. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/node/attach.py +0 -0
  46. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/node/clean.py +0 -0
  47. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/node/common/__init__.py +0 -0
  48. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/node/create_private_key.py +0 -0
  49. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/node/files.py +0 -0
  50. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/node/list.py +0 -0
  51. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/node/new.py +0 -0
  52. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/node/remove.py +0 -0
  53. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/node/restart.py +0 -0
  54. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/node/set_api_key.py +0 -0
  55. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/node/start.py +0 -0
  56. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/node/stop.py +0 -0
  57. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/node/version.py +0 -0
  58. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/prometheus/monitoring_manager.py +0 -0
  59. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/prometheus/prometheus.yml +0 -0
  60. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/rabbitmq/__init__.py +0 -0
  61. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/rabbitmq/definitions.py +0 -0
  62. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/rabbitmq/queue_manager.py +0 -0
  63. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/rabbitmq/rabbitmq.config +0 -0
  64. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/server/attach.py +0 -0
  65. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/server/common/__init__.py +0 -0
  66. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/server/files.py +0 -0
  67. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/server/import_.py +0 -0
  68. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/server/list.py +0 -0
  69. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/server/new.py +0 -0
  70. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/server/remove.py +0 -0
  71. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/server/shell.py +0 -0
  72. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/server/start.py +0 -0
  73. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/server/stop.py +0 -0
  74. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/server/version.py +0 -0
  75. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/template/algo_store_config.j2 +0 -0
  76. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/template/node_config.j2 +0 -0
  77. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/template/server_config.j2 +0 -0
  78. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/template/server_import_config.j2 +0 -0
  79. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/test/algo_test_scripts/algo_test_arguments.py +0 -0
  80. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/test/algo_test_scripts/algo_test_script.py +0 -0
  81. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/test/client_script.py +0 -0
  82. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/test/common/diagnostic_runner.py +0 -0
  83. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/test/feature_tester.py +0 -0
  84. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/test/integration_test.py +0 -0
  85. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6/cli/utils.py +0 -0
  86. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6.egg-info/SOURCES.txt +0 -0
  87. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6.egg-info/dependency_links.txt +0 -0
  88. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6.egg-info/entry_points.txt +0 -0
  89. {vantage6-4.13.0rc3 → vantage6-4.13.3rc2}/vantage6.egg-info/top_level.txt +0 -0
@@ -1,11 +1,34 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: vantage6
3
- Version: 4.13.0rc3
3
+ Version: 4.13.3rc2
4
4
  Summary: vantage6 command line interface
5
5
  Home-page: https://github.com/vantage6/vantage6
6
6
  Requires-Python: >=3.10
7
7
  Description-Content-Type: text/markdown
8
+ Requires-Dist: click==8.1.3
9
+ Requires-Dist: colorama==0.4.6
10
+ Requires-Dist: copier==9.9.1
11
+ Requires-Dist: docker==7.1.0
12
+ Requires-Dist: ipython==8.10.0
13
+ Requires-Dist: jinja2==3.1.6
14
+ Requires-Dist: pandas>=1.5.3
15
+ Requires-Dist: questionary==2.1.1
16
+ Requires-Dist: rich==13.5.2
17
+ Requires-Dist: schema==0.7.5
18
+ Requires-Dist: SQLAlchemy==1.4.46
19
+ Requires-Dist: vantage6-common==4.13.3rc2
20
+ Requires-Dist: vantage6-client==4.13.3rc2
8
21
  Provides-Extra: dev
22
+ Requires-Dist: coverage==6.4.4; extra == "dev"
23
+ Requires-Dist: black; extra == "dev"
24
+ Requires-Dist: pre-commit; extra == "dev"
25
+ Dynamic: description
26
+ Dynamic: description-content-type
27
+ Dynamic: home-page
28
+ Dynamic: provides-extra
29
+ Dynamic: requires-dist
30
+ Dynamic: requires-python
31
+ Dynamic: summary
9
32
 
10
33
  <h1 align="center">
11
34
  <br>
@@ -0,0 +1 @@
1
+ 2
@@ -7,7 +7,7 @@ with open(os.path.join(here, "__build__")) as fp:
7
7
  __build__ = json.load(fp)
8
8
 
9
9
  # Module version
10
- version_info = (4, 13, 0, "candidate", __build__, 0)
10
+ version_info = (4, 13, 3, "candidate", __build__, 0)
11
11
 
12
12
  # Module version stage suffix map
13
13
  _specifier_ = {"alpha": "a", "beta": "b", "candidate": "rc", "final": ""}
@@ -0,0 +1,193 @@
1
+ import os
2
+ import re
3
+ import subprocess
4
+ from pathlib import Path
5
+
6
+ import click
7
+ import questionary as q
8
+ from copier import run_copy
9
+
10
+ from vantage6.common import error, warning
11
+
12
+ from vantage6.cli import __version__
13
+ from vantage6.cli.globals import ALGORITHM_TEMPLATE_REPO
14
+ from vantage6.cli.utils import info
15
+
16
+
17
+ @click.command()
18
+ @click.option(
19
+ "-n", "--name", default=None, type=str, help="Name for your new algorithm"
20
+ )
21
+ @click.option(
22
+ "-d",
23
+ "--dir",
24
+ "directory",
25
+ default=None,
26
+ type=str,
27
+ help="Directory to put the algorithm into",
28
+ )
29
+ @click.option(
30
+ "--major-version",
31
+ default=None,
32
+ type=int,
33
+ help="Major version of the algorithm. By default, the current version is used.",
34
+ )
35
+ def cli_algorithm_create(name: str, directory: str, major_version: int | None) -> dict:
36
+ """Creates a personalized template for a new algorithm
37
+
38
+ By answering a number of questions, a template will be created that will
39
+ simplify the creation of a new algorithm. The goal is that the algorithm
40
+ developer only focuses on the algorithm code rather than fitting it to
41
+ the vantage6 infrastructure.
42
+
43
+ The created template will contain a Python package with a Dockerfile that
44
+ can be used to build an appropriate Docker image that can be used as a
45
+ vantage6 algorithm.
46
+ """
47
+ latest_tag_of_desired_major_version = None
48
+ if major_version is None:
49
+ major_version = int(__version__.split(".")[0])
50
+ latest_tag_of_desired_major_version = _get_latest_major_tag(major_version)
51
+
52
+ try:
53
+ name, directory = _get_user_input(name, directory)
54
+ except KeyboardInterrupt:
55
+ info("Aborted by user!")
56
+ return
57
+
58
+ # Create the template. The `unsafe` flag is used to allow running a Python script
59
+ # after creating the template that cleans up some things.
60
+ run_copy(
61
+ ALGORITHM_TEMPLATE_REPO,
62
+ directory,
63
+ data={"algorithm_name": name},
64
+ unsafe=True,
65
+ vcs_ref=latest_tag_of_desired_major_version,
66
+ )
67
+ info("Template created!")
68
+ info(f"You can find your new algorithm in: {directory}")
69
+
70
+
71
+ def _get_user_input(name: str, directory: str) -> None:
72
+ """Get user input for the algorithm creation
73
+
74
+ Parameters
75
+ ----------
76
+ name : str
77
+ Name for the new algorithm
78
+ directory : str
79
+ Directory to put the algorithm into
80
+ """
81
+ if not name:
82
+ name = q.text("Name of your new algorithm:").unsafe_ask()
83
+
84
+ if not directory:
85
+ default_dir = str(Path(os.getcwd()) / name)
86
+ directory = q.text(
87
+ "Directory to put the algorithm in:", default=default_dir
88
+ ).unsafe_ask()
89
+ return name, directory
90
+
91
+
92
+ def _get_latest_major_tag(major_version: int) -> str | None:
93
+ """Get the latest tag for the given major version"""
94
+ # get the tags from the algorithm template repository
95
+ try:
96
+ tags = _get_algo_template_tags(ALGORITHM_TEMPLATE_REPO)
97
+ except Exception as e:
98
+ error(f"Failed to fetch tags from {ALGORITHM_TEMPLATE_REPO}: {e}")
99
+ warning("Will use latest version instead.")
100
+ return None
101
+ # Filter tags for the given major version (e.g. 5.x.x)
102
+ tags_in_desired_major_version = [
103
+ tag
104
+ for tag in tags
105
+ if tag.startswith(f"{major_version}.")
106
+ and re.match(rf"^{major_version}\.\d+\.\d+", tag)
107
+ ]
108
+
109
+ # sort the tags in descending order
110
+ tags_in_desired_major_version.sort(key=lambda s: _gen_sort_key(s), reverse=True)
111
+ return _first_non_prerelease_tag(tags_in_desired_major_version)
112
+
113
+
114
+ def _first_non_prerelease_tag(tags: list[str]) -> str:
115
+ """Return the first non-prerelease tag from a list of tags"""
116
+ for tag in tags:
117
+ patch = tag.split(".")[2]
118
+ try:
119
+ int(patch)
120
+ return tag
121
+ except ValueError:
122
+ continue
123
+ # no non-prerelease tag found - return first in the list (sorted in descending
124
+ # order)
125
+ return tags[0] if tags else None
126
+
127
+
128
+ def _gen_sort_key(tag: str) -> list[int]:
129
+ """Generate a sort key for a tag"""
130
+ major = int(tag.split(".")[0])
131
+ minor = int(tag.split(".")[1])
132
+ # Note: patch is not cast to int for sorting, because it may contain
133
+ # alpha/beta/rc suffixes
134
+ # TODO this will go wrong in sorting 1.2.13a1 vs 1.2.3a1, but we don't care
135
+ # about that for now, as it is unlikely that we have 10+ patch releases
136
+ # for the algorithm template repository
137
+ patch = tag.split(".")[2]
138
+ return [major, minor, patch]
139
+
140
+
141
+ def _get_algo_template_tags(repo_url: str) -> list[str]:
142
+ """Get all tags from a git repository
143
+
144
+ Parameters
145
+ ----------
146
+ repo_url : str
147
+ Repository URL in format like "gh:owner/repo.git" or full git URL
148
+
149
+ Returns
150
+ -------
151
+ list[str]
152
+ List of tag names (without refs/tags/ prefix)
153
+ """
154
+ # Convert copier format (gh:owner/repo.git) to git URL
155
+ if repo_url.startswith("gh:"):
156
+ # Format: gh:owner/repo.git -> https://github.com/owner/repo.git
157
+ repo_path = repo_url[3:].rstrip(".git")
158
+ git_url = f"https://github.com/{repo_path}.git"
159
+ else:
160
+ git_url = repo_url
161
+
162
+ try:
163
+ # Use git ls-remote to fetch tags without cloning
164
+ result = subprocess.run(
165
+ ["git", "ls-remote", "--tags", git_url],
166
+ capture_output=True,
167
+ text=True,
168
+ check=True,
169
+ timeout=10,
170
+ )
171
+
172
+ # Parse output: lines look like "hash\trefs/tags/v1.0.0"
173
+ tags = []
174
+ for line in result.stdout.strip().split("\n"):
175
+ if line:
176
+ # Extract tag name from "refs/tags/tagname"
177
+ match = re.search(r"refs/tags/(.+)", line)
178
+ if match:
179
+ tag = match.group(1)
180
+ # Filter out ^{} suffix that git adds for annotated tags
181
+ if not tag.endswith("^{}"):
182
+ tags.append(tag)
183
+
184
+ return sorted(tags)
185
+ except subprocess.CalledProcessError as e:
186
+ info(f"Failed to fetch tags from {git_url}: {e}")
187
+ return []
188
+ except subprocess.TimeoutExpired:
189
+ info(f"Timeout while fetching tags from {git_url}")
190
+ return []
191
+ except FileNotFoundError:
192
+ info("git command not found. Please install git to fetch repository tags.")
193
+ return []
@@ -1,11 +1,34 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: vantage6
3
- Version: 4.13.0rc3
3
+ Version: 4.13.3rc2
4
4
  Summary: vantage6 command line interface
5
5
  Home-page: https://github.com/vantage6/vantage6
6
6
  Requires-Python: >=3.10
7
7
  Description-Content-Type: text/markdown
8
+ Requires-Dist: click==8.1.3
9
+ Requires-Dist: colorama==0.4.6
10
+ Requires-Dist: copier==9.9.1
11
+ Requires-Dist: docker==7.1.0
12
+ Requires-Dist: ipython==8.10.0
13
+ Requires-Dist: jinja2==3.1.6
14
+ Requires-Dist: pandas>=1.5.3
15
+ Requires-Dist: questionary==2.1.1
16
+ Requires-Dist: rich==13.5.2
17
+ Requires-Dist: schema==0.7.5
18
+ Requires-Dist: SQLAlchemy==1.4.46
19
+ Requires-Dist: vantage6-common==4.13.3rc2
20
+ Requires-Dist: vantage6-client==4.13.3rc2
8
21
  Provides-Extra: dev
22
+ Requires-Dist: coverage==6.4.4; extra == "dev"
23
+ Requires-Dist: black; extra == "dev"
24
+ Requires-Dist: pre-commit; extra == "dev"
25
+ Dynamic: description
26
+ Dynamic: description-content-type
27
+ Dynamic: home-page
28
+ Dynamic: provides-extra
29
+ Dynamic: requires-dist
30
+ Dynamic: requires-python
31
+ Dynamic: summary
9
32
 
10
33
  <h1 align="center">
11
34
  <br>
@@ -9,8 +9,8 @@ questionary==2.1.1
9
9
  rich==13.5.2
10
10
  schema==0.7.5
11
11
  SQLAlchemy==1.4.46
12
- vantage6-common==4.13.0rc3
13
- vantage6-client==4.13.0rc3
12
+ vantage6-common==4.13.3rc2
13
+ vantage6-client==4.13.3rc2
14
14
 
15
15
  [dev]
16
16
  coverage==6.4.4
@@ -1 +0,0 @@
1
- 3
@@ -1,69 +0,0 @@
1
- import os
2
- from pathlib import Path
3
-
4
- import click
5
- import questionary as q
6
- from copier import run_copy
7
-
8
- from vantage6.cli.globals import ALGORITHM_TEMPLATE_REPO
9
- from vantage6.cli.utils import info
10
-
11
-
12
- @click.command()
13
- @click.option(
14
- "-n", "--name", default=None, type=str, help="Name for your new algorithm"
15
- )
16
- @click.option(
17
- "-d",
18
- "--dir",
19
- "directory",
20
- default=None,
21
- type=str,
22
- help="Directory to put the algorithm into",
23
- )
24
- def cli_algorithm_create(name: str, directory: str) -> dict:
25
- """Creates a personalized template for a new algorithm
26
-
27
- By answering a number of questions, a template will be created that will
28
- simplify the creation of a new algorithm. The goal is that the algorithm
29
- developer only focuses on the algorithm code rather than fitting it to
30
- the vantage6 infrastructure.
31
-
32
- The created template will contain a Python package with a Dockerfile that
33
- can be used to build an appropriate Docker image that can be used as a
34
- vantage6 algorithm.
35
- """
36
- try:
37
- name, directory = _get_user_input(name, directory)
38
- except KeyboardInterrupt:
39
- info("Aborted by user!")
40
- return
41
-
42
- # Create the template. The `unsafe` flag is used to allow running a Python script
43
- # after creating the template that cleans up some things.
44
- run_copy(
45
- ALGORITHM_TEMPLATE_REPO, directory, data={"algorithm_name": name}, unsafe=True
46
- )
47
- info("Template created!")
48
- info(f"You can find your new algorithm in: {directory}")
49
-
50
-
51
- def _get_user_input(name: str, directory: str) -> None:
52
- """Get user input for the algorithm creation
53
-
54
- Parameters
55
- ----------
56
- name : str
57
- Name for the new algorithm
58
- directory : str
59
- Directory to put the algorithm into
60
- """
61
- if not name:
62
- name = q.text("Name of your new algorithm:").unsafe_ask()
63
-
64
- if not directory:
65
- default_dir = str(Path(os.getcwd()) / name)
66
- directory = q.text(
67
- "Directory to put the algorithm in:", default=default_dir
68
- ).unsafe_ask()
69
- return name, directory
File without changes
File without changes