arkitekt-next 0.7.8__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.
Potentially problematic release.
This version of arkitekt-next might be problematic. Click here for more details.
- arkitekt_next/__init__.py +43 -0
- arkitekt_next/apps/__init__.py +3 -0
- arkitekt_next/apps/easy.py +99 -0
- arkitekt_next/apps/next.py +40 -0
- arkitekt_next/apps/qt.py +97 -0
- arkitekt_next/apps/service/__init__.py +3 -0
- arkitekt_next/apps/service/fakts.py +88 -0
- arkitekt_next/apps/service/fakts_next.py +79 -0
- arkitekt_next/apps/service/fakts_qt.py +82 -0
- arkitekt_next/apps/service/fluss_next.py +31 -0
- arkitekt_next/apps/service/grant_registry.py +27 -0
- arkitekt_next/apps/service/herre.py +24 -0
- arkitekt_next/apps/service/herre_qt.py +57 -0
- arkitekt_next/apps/service/kabinet.py +31 -0
- arkitekt_next/apps/service/mikro_next.py +81 -0
- arkitekt_next/apps/service/rekuest_next.py +53 -0
- arkitekt_next/apps/service/unlok_next.py +32 -0
- arkitekt_next/apps/types.py +53 -0
- arkitekt_next/builders.py +264 -0
- arkitekt_next/cli/__init__.py +0 -0
- arkitekt_next/cli/commands/call/__init__.py +0 -0
- arkitekt_next/cli/commands/call/local.py +132 -0
- arkitekt_next/cli/commands/call/main.py +22 -0
- arkitekt_next/cli/commands/call/remote.py +90 -0
- arkitekt_next/cli/commands/gen/__init__.py +0 -0
- arkitekt_next/cli/commands/gen/compile.py +45 -0
- arkitekt_next/cli/commands/gen/init.py +122 -0
- arkitekt_next/cli/commands/gen/main.py +29 -0
- arkitekt_next/cli/commands/gen/watch.py +32 -0
- arkitekt_next/cli/commands/init/__init__.py +0 -0
- arkitekt_next/cli/commands/init/main.py +194 -0
- arkitekt_next/cli/commands/inspect/__init__.py +0 -0
- arkitekt_next/cli/commands/inspect/definitions.py +53 -0
- arkitekt_next/cli/commands/inspect/main.py +22 -0
- arkitekt_next/cli/commands/inspect/variables.py +92 -0
- arkitekt_next/cli/commands/manifest/__init__.py +0 -0
- arkitekt_next/cli/commands/manifest/inspect.py +42 -0
- arkitekt_next/cli/commands/manifest/main.py +25 -0
- arkitekt_next/cli/commands/manifest/scopes.py +155 -0
- arkitekt_next/cli/commands/manifest/version.py +147 -0
- arkitekt_next/cli/commands/manifest/wizard.py +94 -0
- arkitekt_next/cli/commands/port/__init__.py +0 -0
- arkitekt_next/cli/commands/port/build.py +231 -0
- arkitekt_next/cli/commands/port/init.py +82 -0
- arkitekt_next/cli/commands/port/main.py +31 -0
- arkitekt_next/cli/commands/port/publish.py +102 -0
- arkitekt_next/cli/commands/port/stage.py +59 -0
- arkitekt_next/cli/commands/port/utils.py +47 -0
- arkitekt_next/cli/commands/port/validate.py +78 -0
- arkitekt_next/cli/commands/port/wizard.py +329 -0
- arkitekt_next/cli/commands/run/__init__.py +0 -0
- arkitekt_next/cli/commands/run/dev.py +349 -0
- arkitekt_next/cli/commands/run/main.py +22 -0
- arkitekt_next/cli/commands/run/prod.py +57 -0
- arkitekt_next/cli/commands/run/utils.py +10 -0
- arkitekt_next/cli/commands/server/__init__.py +0 -0
- arkitekt_next/cli/commands/server/down.py +56 -0
- arkitekt_next/cli/commands/server/init.py +74 -0
- arkitekt_next/cli/commands/server/inspect.py +59 -0
- arkitekt_next/cli/commands/server/main.py +33 -0
- arkitekt_next/cli/commands/server/open.py +66 -0
- arkitekt_next/cli/commands/server/remove.py +60 -0
- arkitekt_next/cli/commands/server/stop.py +56 -0
- arkitekt_next/cli/commands/server/up.py +70 -0
- arkitekt_next/cli/commands/server/utils.py +33 -0
- arkitekt_next/cli/configs/base.yaml +867 -0
- arkitekt_next/cli/constants.py +63 -0
- arkitekt_next/cli/dockerfiles/vanilla.dockerfile +8 -0
- arkitekt_next/cli/errors.py +4 -0
- arkitekt_next/cli/inspect.py +1 -0
- arkitekt_next/cli/io.py +255 -0
- arkitekt_next/cli/main.py +83 -0
- arkitekt_next/cli/options.py +166 -0
- arkitekt_next/cli/schemas/fluss.schema.graphql +2446 -0
- arkitekt_next/cli/schemas/gucker.schema.graphql +8908 -0
- arkitekt_next/cli/schemas/kabinet.schema.graphql +515 -0
- arkitekt_next/cli/schemas/kluster.schema.graphql +109 -0
- arkitekt_next/cli/schemas/konviktion.schema.graphql +70 -0
- arkitekt_next/cli/schemas/kuay.schema.graphql +356 -0
- arkitekt_next/cli/schemas/mikro.schema.graphql +8908 -0
- arkitekt_next/cli/schemas/mikro_next.schema.graphql +1639 -0
- arkitekt_next/cli/schemas/napari.schema.graphql +8908 -0
- arkitekt_next/cli/schemas/omero_ark.schema.graphql +100 -0
- arkitekt_next/cli/schemas/port.schema.graphql +356 -0
- arkitekt_next/cli/schemas/rekuest.schema.graphql +4630 -0
- arkitekt_next/cli/schemas/rekuest_next.schema.graphql +1159 -0
- arkitekt_next/cli/schemas/unlok.schema.graphql +1013 -0
- arkitekt_next/cli/templates/filter.py +26 -0
- arkitekt_next/cli/templates/simple.py +67 -0
- arkitekt_next/cli/texts.py +20 -0
- arkitekt_next/cli/types.py +365 -0
- arkitekt_next/cli/ui.py +111 -0
- arkitekt_next/cli/utils.py +15 -0
- arkitekt_next/cli/validators.py +17 -0
- arkitekt_next/cli/vars.py +39 -0
- arkitekt_next/cli/versions/v1.yaml +1 -0
- arkitekt_next/constants.py +6 -0
- arkitekt_next/model.py +110 -0
- arkitekt_next/qt/__init__.py +9 -0
- arkitekt_next/qt/assets/dark/gear.png +0 -0
- arkitekt_next/qt/assets/dark/green pulse.gif +0 -0
- arkitekt_next/qt/assets/dark/orange pulse.gif +0 -0
- arkitekt_next/qt/assets/dark/pink pulse.gif +0 -0
- arkitekt_next/qt/assets/dark/red pulse.gif +0 -0
- arkitekt_next/qt/assets/light/gear.png +0 -0
- arkitekt_next/qt/assets/light/green pulse.gif +0 -0
- arkitekt_next/qt/assets/light/orange pulse.gif +0 -0
- arkitekt_next/qt/assets/light/pink pulse.gif +0 -0
- arkitekt_next/qt/assets/light/red pulse.gif +0 -0
- arkitekt_next/qt/magic_bar.py +545 -0
- arkitekt_next/qt/utils.py +30 -0
- arkitekt_next/service_registry.py +51 -0
- arkitekt_next/tqdm.py +43 -0
- arkitekt_next/utils.py +38 -0
- arkitekt_next-0.7.8.dist-info/LICENSE +21 -0
- arkitekt_next-0.7.8.dist-info/METADATA +155 -0
- arkitekt_next-0.7.8.dist-info/RECORD +119 -0
- arkitekt_next-0.7.8.dist-info/WHEEL +4 -0
- arkitekt_next-0.7.8.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from .types import Requirement
|
|
2
|
+
from .utils import build_relative_dir
|
|
3
|
+
from typing import List
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def compile_scopes() -> List[str]:
|
|
8
|
+
"""Compile all available scopes"""
|
|
9
|
+
return ["read", "write"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def compile_requirements():
|
|
13
|
+
"""Compile all available requirements"""
|
|
14
|
+
return [Requirement.GPU.value]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def compile_builders():
|
|
18
|
+
return ["arkitekt_next.builders.easy", "arkitekt_next.builders.port"]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def compile_runtimes():
|
|
22
|
+
return ["nvidia", "standard"]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def compile_schema_versions() -> List[str]:
|
|
26
|
+
z = build_relative_dir("schemas")
|
|
27
|
+
return [
|
|
28
|
+
os.path.basename(f) for f in os.listdir(z) if os.path.isdir(os.path.join(z, f))
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def compile_configs() -> List[str]:
|
|
33
|
+
z = build_relative_dir("configs")
|
|
34
|
+
return [
|
|
35
|
+
os.path.basename(f) for f in os.listdir(z) if os.path.isdir(os.path.join(z, f))
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def compile_dockerfiles() -> List[str]:
|
|
40
|
+
z = build_relative_dir("dockerfiles")
|
|
41
|
+
return [
|
|
42
|
+
os.path.basename(f).replace(".dockerfile", "")
|
|
43
|
+
for f in os.listdir(z)
|
|
44
|
+
if os.path.isfile(os.path.join(z, f))
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def compile_templates() -> List[str]:
|
|
49
|
+
z = build_relative_dir("templates")
|
|
50
|
+
return [
|
|
51
|
+
os.path.basename(f).split(".")[0]
|
|
52
|
+
for f in os.listdir(z)
|
|
53
|
+
if os.path.isfile(os.path.join(z, f))
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def compile_services() -> List[str]:
|
|
58
|
+
z = build_relative_dir("schemas")
|
|
59
|
+
return [
|
|
60
|
+
os.path.basename(f).split(".")[0]
|
|
61
|
+
for f in os.listdir(z)
|
|
62
|
+
if os.path.isfile(os.path.join(z, f))
|
|
63
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
arkitekt_next/cli/io.py
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
from arkitekt_next.utils import create_arkitekt_next_folder
|
|
2
|
+
import os
|
|
3
|
+
from typing import Optional, List, Dict
|
|
4
|
+
from arkitekt_next.cli.types import (
|
|
5
|
+
Inspection,
|
|
6
|
+
Manifest,
|
|
7
|
+
Build,
|
|
8
|
+
BuildsConfigFile,
|
|
9
|
+
Deployment,
|
|
10
|
+
Flavour,
|
|
11
|
+
DeploymentsConfigFile,
|
|
12
|
+
DefinitionInput,
|
|
13
|
+
)
|
|
14
|
+
import yaml
|
|
15
|
+
import json
|
|
16
|
+
import rich_click as click
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def load_manifest_yaml(path: str) -> Manifest:
|
|
20
|
+
"""Loads a manifest from a yaml file
|
|
21
|
+
|
|
22
|
+
Uses yaml safe load to load the manifest from a yaml file
|
|
23
|
+
(to avoid unsafe yaml attributes)
|
|
24
|
+
|
|
25
|
+
Parameters
|
|
26
|
+
----------
|
|
27
|
+
path : str
|
|
28
|
+
The path to the yaml file
|
|
29
|
+
|
|
30
|
+
Returns
|
|
31
|
+
-------
|
|
32
|
+
Manifest
|
|
33
|
+
The loaded manifest
|
|
34
|
+
"""
|
|
35
|
+
with open(path, "r") as file:
|
|
36
|
+
manifest = yaml.safe_load(file)
|
|
37
|
+
return Manifest(**manifest)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def load_manifest() -> Optional[Manifest]:
|
|
41
|
+
"""Loads the manifest from the arkitekt_next folder
|
|
42
|
+
|
|
43
|
+
Will load the manifest from the current working directories
|
|
44
|
+
arkitekt_next folder. If no folder exists, it will create one, but
|
|
45
|
+
will not create a manifest.
|
|
46
|
+
|
|
47
|
+
Returns
|
|
48
|
+
-------
|
|
49
|
+
Optional[Manifest]
|
|
50
|
+
The loaded manifest, or None if no manifest exists
|
|
51
|
+
"""
|
|
52
|
+
path = create_arkitekt_next_folder()
|
|
53
|
+
config_file = os.path.join(path, "manifest.yaml")
|
|
54
|
+
if os.path.exists(config_file):
|
|
55
|
+
return load_manifest_yaml(config_file)
|
|
56
|
+
return None
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def write_manifest(manifest: Manifest):
|
|
60
|
+
"""Writes a manifest to the arkitekt_next folder
|
|
61
|
+
|
|
62
|
+
Will write a manifest to the current working directories
|
|
63
|
+
arkitekt_next folder. If no folder exists, it will create one.
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
Parameters
|
|
67
|
+
----------
|
|
68
|
+
manifest : Manifest
|
|
69
|
+
The manifest to write
|
|
70
|
+
"""
|
|
71
|
+
path = create_arkitekt_next_folder()
|
|
72
|
+
config_file = os.path.join(path, "manifest.yaml")
|
|
73
|
+
|
|
74
|
+
with open(config_file, "w") as file:
|
|
75
|
+
yaml.safe_dump(
|
|
76
|
+
json.loads(manifest.json(exclude_none=True, exclude_unset=True)),
|
|
77
|
+
file,
|
|
78
|
+
sort_keys=True,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def get_builds(selected_run: Optional[str] = None) -> Dict[str, Build]:
|
|
83
|
+
"""Will load the builds.yaml file and return a dictionary of builds
|
|
84
|
+
|
|
85
|
+
Will load the builds.yaml file and return a dictionary of builds
|
|
86
|
+
where the key is the build_id and the value is the build object.
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
Returns
|
|
90
|
+
-------
|
|
91
|
+
Dict[str, Build]
|
|
92
|
+
The loaded builds
|
|
93
|
+
"""
|
|
94
|
+
path = create_arkitekt_next_folder()
|
|
95
|
+
config_file = os.path.join(path, "builds.yaml")
|
|
96
|
+
|
|
97
|
+
builds = {}
|
|
98
|
+
|
|
99
|
+
if os.path.exists(config_file):
|
|
100
|
+
with open(config_file, "r") as file:
|
|
101
|
+
config = BuildsConfigFile(**yaml.safe_load(file))
|
|
102
|
+
|
|
103
|
+
# We will only return the builds from the selected run
|
|
104
|
+
selected_run = selected_run or config.latest_build_run
|
|
105
|
+
|
|
106
|
+
builds = {
|
|
107
|
+
build.build_id: build
|
|
108
|
+
for build in config.builds
|
|
109
|
+
if build.build_run == selected_run
|
|
110
|
+
}
|
|
111
|
+
return builds
|
|
112
|
+
else:
|
|
113
|
+
raise click.ClickException(
|
|
114
|
+
"Could not find any builds. Please run `arkitekt_next port build` first"
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def generate_build(
|
|
119
|
+
build_run: str,
|
|
120
|
+
build_id: str,
|
|
121
|
+
flavour_name: str,
|
|
122
|
+
flavour: Flavour,
|
|
123
|
+
manifest: Manifest,
|
|
124
|
+
inspection: Optional[Inspection],
|
|
125
|
+
) -> Build:
|
|
126
|
+
"""Generates a build from a builder, build_id and manifest
|
|
127
|
+
|
|
128
|
+
Will generate a build from a builder, build_id and manifest,
|
|
129
|
+
and write it to the builds.yaml file in the arkitekt_next folder.
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
Parameters
|
|
133
|
+
----------
|
|
134
|
+
builder : str
|
|
135
|
+
The builder that was used to build the build
|
|
136
|
+
build_id : str
|
|
137
|
+
The build_id of the build
|
|
138
|
+
manifest : Manifest
|
|
139
|
+
The manifest of the build
|
|
140
|
+
|
|
141
|
+
Returns
|
|
142
|
+
-------
|
|
143
|
+
Build
|
|
144
|
+
The generated build
|
|
145
|
+
"""
|
|
146
|
+
path = create_arkitekt_next_folder()
|
|
147
|
+
|
|
148
|
+
config_file = os.path.join(path, "builds.yaml")
|
|
149
|
+
|
|
150
|
+
build = Build(
|
|
151
|
+
manifest=manifest,
|
|
152
|
+
flavour=flavour_name,
|
|
153
|
+
selectors=flavour.selectors,
|
|
154
|
+
build_id=build_id,
|
|
155
|
+
build_run=build_run,
|
|
156
|
+
description=flavour.description,
|
|
157
|
+
inspection=inspection,
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
if os.path.exists(config_file):
|
|
161
|
+
with open(config_file, "r") as file:
|
|
162
|
+
config = BuildsConfigFile(**yaml.safe_load(file))
|
|
163
|
+
config.builds.append(build)
|
|
164
|
+
config.latest_build_run = build_run
|
|
165
|
+
else:
|
|
166
|
+
config = BuildsConfigFile(builds=[build], latest_build_run=build_run)
|
|
167
|
+
|
|
168
|
+
with open(config_file, "w") as file:
|
|
169
|
+
yaml.safe_dump(
|
|
170
|
+
json.loads(
|
|
171
|
+
config.json(exclude_none=True, exclude_unset=True, by_alias=True)
|
|
172
|
+
),
|
|
173
|
+
file,
|
|
174
|
+
sort_keys=True,
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
return build
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def get_deployments() -> DeploymentsConfigFile:
|
|
181
|
+
"""Loads the deployments.yaml file and returns the deployments
|
|
182
|
+
|
|
183
|
+
Will load the deployments.yaml file and return the deployments
|
|
184
|
+
as a DeploymentsConfigFile object. If no deployments.yaml file
|
|
185
|
+
exists, it will return an empty DeploymentsConfigFile object.
|
|
186
|
+
|
|
187
|
+
Returns
|
|
188
|
+
-------
|
|
189
|
+
DeploymentsConfigFile
|
|
190
|
+
The deployments as a DeploymentsConfigFile object
|
|
191
|
+
"""
|
|
192
|
+
path = create_arkitekt_next_folder()
|
|
193
|
+
config_file = os.path.join(path, "deployments.yaml")
|
|
194
|
+
if os.path.exists(config_file):
|
|
195
|
+
with open(config_file, "r") as file:
|
|
196
|
+
return DeploymentsConfigFile(**yaml.safe_load(file))
|
|
197
|
+
else:
|
|
198
|
+
return DeploymentsConfigFile()
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def generate_deployment(
|
|
202
|
+
deployment_run: str,
|
|
203
|
+
build: Build,
|
|
204
|
+
image: str,
|
|
205
|
+
definitions: Optional[List[DefinitionInput]] = None,
|
|
206
|
+
) -> Deployment:
|
|
207
|
+
"""Generates a deployment from a build and an image
|
|
208
|
+
|
|
209
|
+
Parameters
|
|
210
|
+
----------
|
|
211
|
+
|
|
212
|
+
build : Build
|
|
213
|
+
The build that should be deployed
|
|
214
|
+
image: str
|
|
215
|
+
The image that is the actuall deployment of the build
|
|
216
|
+
with_definitions: bool:
|
|
217
|
+
Should we generated and inspect definitions to bundle with
|
|
218
|
+
the deployment?
|
|
219
|
+
|
|
220
|
+
Returns:
|
|
221
|
+
------
|
|
222
|
+
Deployment: The created deployment
|
|
223
|
+
|
|
224
|
+
"""
|
|
225
|
+
|
|
226
|
+
path = create_arkitekt_next_folder()
|
|
227
|
+
|
|
228
|
+
config_file = os.path.join(path, "deployments.yaml")
|
|
229
|
+
|
|
230
|
+
deployment = Deployment(
|
|
231
|
+
build_id=build.build_id,
|
|
232
|
+
manifest=build.manifest,
|
|
233
|
+
flavour=build.flavour,
|
|
234
|
+
selectors=build.selectors,
|
|
235
|
+
inspection=build.inspection,
|
|
236
|
+
image=image,
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
if os.path.exists(config_file):
|
|
240
|
+
with open(config_file, "r") as file:
|
|
241
|
+
config = DeploymentsConfigFile(**yaml.safe_load(file))
|
|
242
|
+
config.deployments.append(deployment)
|
|
243
|
+
config.latest_deployment_run = deployment_run
|
|
244
|
+
else:
|
|
245
|
+
config = DeploymentsConfigFile(deployments=[deployment])
|
|
246
|
+
config.latest_deployment_run = deployment_run
|
|
247
|
+
|
|
248
|
+
with open(config_file, "w") as file:
|
|
249
|
+
yaml.safe_dump(
|
|
250
|
+
json.loads(config.json(exclude_none=True, by_alias=True)),
|
|
251
|
+
file,
|
|
252
|
+
sort_keys=True,
|
|
253
|
+
)
|
|
254
|
+
|
|
255
|
+
return deployment
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
try:
|
|
5
|
+
import rich_click as click
|
|
6
|
+
|
|
7
|
+
from rich.console import Console
|
|
8
|
+
except ImportError:
|
|
9
|
+
print(
|
|
10
|
+
"ArkitektNext CLI is not installed, please install it first. By installing the cli, e.g with `pip install arkitekt_next[cli]`, you can use the `arkitekt_next` command."
|
|
11
|
+
)
|
|
12
|
+
sys.exit(1)
|
|
13
|
+
|
|
14
|
+
from arkitekt_next.cli.vars import *
|
|
15
|
+
from arkitekt_next.cli.constants import *
|
|
16
|
+
from arkitekt_next.cli.texts import *
|
|
17
|
+
from arkitekt_next.cli.commands.run.main import run
|
|
18
|
+
from arkitekt_next.cli.commands.gen.main import gen
|
|
19
|
+
from arkitekt_next.cli.commands.server.main import server
|
|
20
|
+
from arkitekt_next.cli.commands.port.main import port
|
|
21
|
+
from arkitekt_next.cli.commands.init.main import init
|
|
22
|
+
from arkitekt_next.cli.commands.manifest.main import manifest
|
|
23
|
+
from arkitekt_next.cli.commands.inspect.main import inspect
|
|
24
|
+
from arkitekt_next.cli.commands.call.main import call
|
|
25
|
+
from arkitekt_next.cli.io import load_manifest
|
|
26
|
+
from arkitekt_next.utils import create_arkitekt_next_folder
|
|
27
|
+
|
|
28
|
+
default_docker_file = """
|
|
29
|
+
FROM python:3.8-slim-buster
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
RUN pip install arkitekt_next==0.4.23
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
RUN mkdir /app
|
|
36
|
+
COPY . /app
|
|
37
|
+
WORKDIR /app
|
|
38
|
+
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
click.rich_click.HEADER_TEXT = LOGO
|
|
43
|
+
click.rich_click.ERRORS_EPILOGUE = ERROR_EPILOGUE
|
|
44
|
+
click.rich_click.USE_RICH_MARKUP = True
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@click.group()
|
|
48
|
+
@click.pass_context
|
|
49
|
+
def cli(ctx):
|
|
50
|
+
"""ArkitektNext is a framework for building safe and performant apps that then can be centrally orchestrated and managed
|
|
51
|
+
in workflows.
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
This is the CLI for the ArkitektNext Python SDK. It allows you to create and deploy ArkitektNext Apps from your python code
|
|
55
|
+
as well as to run them locally for testing and development. For more information about ArkitektNext, please visit
|
|
56
|
+
[link=https://arkitekt_next.live]https://arkitekt_next.live[/link]
|
|
57
|
+
"""
|
|
58
|
+
sys.path.append(os.getcwd())
|
|
59
|
+
|
|
60
|
+
ctx.obj = {}
|
|
61
|
+
console = Console()
|
|
62
|
+
set_console(ctx, console)
|
|
63
|
+
|
|
64
|
+
create_arkitekt_next_folder()
|
|
65
|
+
|
|
66
|
+
manifest = load_manifest()
|
|
67
|
+
if manifest:
|
|
68
|
+
set_manifest(ctx, manifest)
|
|
69
|
+
|
|
70
|
+
pass
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
cli.add_command(init, "init")
|
|
74
|
+
cli.add_command(run, "run")
|
|
75
|
+
cli.add_command(gen, "gen")
|
|
76
|
+
cli.add_command(port, "port")
|
|
77
|
+
cli.add_command(manifest, "manifest")
|
|
78
|
+
cli.add_command(inspect, "inspect")
|
|
79
|
+
cli.add_command(server, "server")
|
|
80
|
+
cli.add_command(call, "call")
|
|
81
|
+
|
|
82
|
+
if __name__ == "__main__":
|
|
83
|
+
cli()
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import rich_click as click
|
|
2
|
+
|
|
3
|
+
from arkitekt_next.constants import DEFAULT_ARKITEKT_URL
|
|
4
|
+
from .constants import *
|
|
5
|
+
from .types import *
|
|
6
|
+
from .vars import *
|
|
7
|
+
from .ui import *
|
|
8
|
+
|
|
9
|
+
with_fakts_url = click.option(
|
|
10
|
+
"--url",
|
|
11
|
+
"-u",
|
|
12
|
+
help="The fakts url for connection",
|
|
13
|
+
default=DEFAULT_ARKITEKT_URL,
|
|
14
|
+
envvar="FAKTS_URL",
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
with_token = click.option(
|
|
18
|
+
"--token",
|
|
19
|
+
"-t",
|
|
20
|
+
help="The token for the fakts instance",
|
|
21
|
+
envvar="FAKTS_TOKEN",
|
|
22
|
+
required=False,
|
|
23
|
+
)
|
|
24
|
+
with_version = click.option(
|
|
25
|
+
"--version",
|
|
26
|
+
"-v",
|
|
27
|
+
help="Override the version of the app",
|
|
28
|
+
envvar="ARKITEKT_VERSION",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
with_log_level = click.option(
|
|
32
|
+
"--log",
|
|
33
|
+
"-l",
|
|
34
|
+
help="Override the logging level",
|
|
35
|
+
type=click.Choice(["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]),
|
|
36
|
+
envvar="ARKITEKT_LOG_LEVEL",
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
with_skip_cache = click.option(
|
|
41
|
+
"--no-cache",
|
|
42
|
+
"-nc",
|
|
43
|
+
is_flag=True,
|
|
44
|
+
default=False,
|
|
45
|
+
help="Should we skip the cache",
|
|
46
|
+
envvar="ARKITEKT_NO_CACHE",
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
with_instance_id = click.option(
|
|
50
|
+
"--instance-id",
|
|
51
|
+
"-i",
|
|
52
|
+
default="main",
|
|
53
|
+
help="The token for the fakts instance",
|
|
54
|
+
envvar="REKUEST_INSTANCE",
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
with_log_level = click.option(
|
|
58
|
+
"--log-level",
|
|
59
|
+
"-l",
|
|
60
|
+
default="ERROR",
|
|
61
|
+
help="The token for the fakts instance",
|
|
62
|
+
envvar="ARKITEKT_LOG_LEVEL",
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
with_builder = click.option(
|
|
67
|
+
"--builder",
|
|
68
|
+
"-b",
|
|
69
|
+
default="arkitekt_next.builders.easy",
|
|
70
|
+
help="The builder for this run",
|
|
71
|
+
envvar="ARKITEKT_BUILDER",
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
with_headless = click.option(
|
|
75
|
+
"--headless",
|
|
76
|
+
"-h",
|
|
77
|
+
is_flag=True,
|
|
78
|
+
default=False,
|
|
79
|
+
help="Should we start headless",
|
|
80
|
+
envvar="ARKITEKT_HEADLESS",
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def check_gen_boring(ctx, param, value):
|
|
85
|
+
"""Callback to check and prompt for file overwrite."""
|
|
86
|
+
|
|
87
|
+
if not value:
|
|
88
|
+
get_console(ctx).print(construct_codegen_welcome_panel())
|
|
89
|
+
|
|
90
|
+
return value
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
with_boring = click.option(
|
|
94
|
+
"--boring",
|
|
95
|
+
help="Should we skip the welcome message?",
|
|
96
|
+
is_flag=True,
|
|
97
|
+
default=False,
|
|
98
|
+
callback=check_gen_boring,
|
|
99
|
+
)
|
|
100
|
+
with_seperate_document_dirs = click.option(
|
|
101
|
+
"--seperate-doc-dirs",
|
|
102
|
+
"-sd",
|
|
103
|
+
help="Should we generate seperate dirs for the documents?",
|
|
104
|
+
is_flag=True,
|
|
105
|
+
default=False,
|
|
106
|
+
)
|
|
107
|
+
with_choose_services = click.option(
|
|
108
|
+
"--services",
|
|
109
|
+
"-s",
|
|
110
|
+
help="The services to create the codegen for",
|
|
111
|
+
multiple=True,
|
|
112
|
+
type=click.Choice(compile_services()),
|
|
113
|
+
default=["mikro"],
|
|
114
|
+
)
|
|
115
|
+
with_graphql_config = click.option(
|
|
116
|
+
"--config",
|
|
117
|
+
"-c",
|
|
118
|
+
help="The name of the configuration file",
|
|
119
|
+
type=str,
|
|
120
|
+
default="graphql.config.yaml",
|
|
121
|
+
)
|
|
122
|
+
with_api_path = click.option(
|
|
123
|
+
"--path",
|
|
124
|
+
"-c",
|
|
125
|
+
help="The path of the api to be generated",
|
|
126
|
+
prompt="Where should we generate the api? (relative to the current directory)",
|
|
127
|
+
type=str,
|
|
128
|
+
default="api",
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def check_overwrite_config(ctx, param, value):
|
|
133
|
+
"""Callback to check and prompt for file overwrite."""
|
|
134
|
+
|
|
135
|
+
config = ctx.params["config"]
|
|
136
|
+
if os.path.exists(config) and not value:
|
|
137
|
+
should_overwrite = click.confirm(
|
|
138
|
+
"GraphQL Config file already exists. Do you want to overwrite?"
|
|
139
|
+
)
|
|
140
|
+
return should_overwrite
|
|
141
|
+
|
|
142
|
+
return value
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
with_overwrite_graphql = click.option(
|
|
146
|
+
"--overwrite-config",
|
|
147
|
+
"-o",
|
|
148
|
+
help="Should we overwrite the config file if it already exists",
|
|
149
|
+
is_flag=True,
|
|
150
|
+
default=False,
|
|
151
|
+
callback=check_overwrite_config,
|
|
152
|
+
)
|
|
153
|
+
with_documents = click.option(
|
|
154
|
+
"--documents",
|
|
155
|
+
"-d",
|
|
156
|
+
help="With documents",
|
|
157
|
+
is_flag=True,
|
|
158
|
+
default=True,
|
|
159
|
+
)
|
|
160
|
+
with_schemas = click.option(
|
|
161
|
+
"--schemas",
|
|
162
|
+
"-s",
|
|
163
|
+
help="Should we copy the schemas",
|
|
164
|
+
is_flag=True,
|
|
165
|
+
default=True,
|
|
166
|
+
)
|