arkitekt-next 0.12.1__py3-none-any.whl → 0.13.0__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/__blok__.py +0 -2
- arkitekt_next/__init__.py +3 -0
- arkitekt_next/bloks/alpaka.py +61 -2
- arkitekt_next/bloks/arkitekt.py +4 -7
- arkitekt_next/bloks/base.py +1 -8
- arkitekt_next/bloks/gateway.py +0 -12
- arkitekt_next/bloks/lok.py +2 -18
- arkitekt_next/builders.py +5 -6
- arkitekt_next/inspect.py +29 -0
- arkitekt_next/protocols.py +6 -12
- {arkitekt_next-0.12.1.dist-info → arkitekt_next-0.13.0.dist-info}/METADATA +5 -5
- {arkitekt_next-0.12.1.dist-info → arkitekt_next-0.13.0.dist-info}/RECORD +15 -15
- arkitekt_next/bloks/local_sign.py +0 -261
- {arkitekt_next-0.12.1.dist-info → arkitekt_next-0.13.0.dist-info}/WHEEL +0 -0
- {arkitekt_next-0.12.1.dist-info → arkitekt_next-0.13.0.dist-info}/entry_points.txt +0 -0
- {arkitekt_next-0.12.1.dist-info → arkitekt_next-0.13.0.dist-info}/licenses/LICENSE +0 -0
arkitekt_next/__blok__.py
CHANGED
|
@@ -21,7 +21,6 @@ from arkitekt_next.bloks.namegen import PreformedNamesBlok
|
|
|
21
21
|
from arkitekt_next.bloks.ollama import OllamaBlok
|
|
22
22
|
from arkitekt_next.bloks.self_signed import SelfSignedBlok
|
|
23
23
|
from arkitekt_next.bloks.kraph import KraphBlok
|
|
24
|
-
from arkitekt_next.bloks.local_sign import LocalSignBlok
|
|
25
24
|
from arkitekt_next.bloks.elektro import ElektroBlok
|
|
26
25
|
from blok.blok import Blok
|
|
27
26
|
|
|
@@ -51,6 +50,5 @@ def get_bloks() -> list[Blok]:
|
|
|
51
50
|
SecretBlok(),
|
|
52
51
|
PreformedNamesBlok(),
|
|
53
52
|
OrkestratorBlok(),
|
|
54
|
-
LocalSignBlok(),
|
|
55
53
|
ElektroBlok(),
|
|
56
54
|
]
|
arkitekt_next/__init__.py
CHANGED
|
@@ -38,8 +38,10 @@ try:
|
|
|
38
38
|
aiterate_raw,
|
|
39
39
|
find,
|
|
40
40
|
)
|
|
41
|
+
from .inspect import inspect
|
|
41
42
|
except ImportError as e:
|
|
42
43
|
raise e
|
|
44
|
+
inspect = missing_install("rekuest_next", e)
|
|
43
45
|
publish = missing_install("rekuest_next", e)
|
|
44
46
|
apublish = missing_install("rekuest_next", e)
|
|
45
47
|
structure = missing_install("rekuest_next", e)
|
|
@@ -86,6 +88,7 @@ __all__ = [
|
|
|
86
88
|
"breakpoint",
|
|
87
89
|
"abreakpoint",
|
|
88
90
|
"aiterate",
|
|
91
|
+
"inspect",
|
|
89
92
|
"iterate",
|
|
90
93
|
"aiterate_raw",
|
|
91
94
|
"call",
|
arkitekt_next/bloks/alpaka.py
CHANGED
|
@@ -2,7 +2,18 @@ from typing import Dict, Any
|
|
|
2
2
|
import secrets
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
from arkitekt_next.bloks.services.admin import AdminService
|
|
6
|
+
from arkitekt_next.bloks.services.channel import ChannelService
|
|
7
|
+
from arkitekt_next.bloks.services.config import ConfigService
|
|
8
|
+
from arkitekt_next.bloks.services.db import DBService
|
|
9
|
+
from arkitekt_next.bloks.services.gateway import GatewayService
|
|
10
|
+
from arkitekt_next.bloks.services.lok import LokService
|
|
11
|
+
from arkitekt_next.bloks.services.mount import MountService
|
|
12
|
+
from arkitekt_next.bloks.services.redis import RedisService
|
|
13
|
+
from arkitekt_next.bloks.services.s3 import S3Service
|
|
14
|
+
from arkitekt_next.bloks.services.secret import SecretService
|
|
5
15
|
from blok import blok, InitContext, ExecutionContext, Option
|
|
16
|
+
from blok.bloks.services.dns import DnsService
|
|
6
17
|
from blok.tree import Repo, YamlFile
|
|
7
18
|
from arkitekt_next.bloks.base import BaseArkitektService
|
|
8
19
|
|
|
@@ -13,7 +24,7 @@ class AlpakaBlok(BaseArkitektService):
|
|
|
13
24
|
self.dev = False
|
|
14
25
|
self.host = "alpaka"
|
|
15
26
|
self.command = "bash run-debug.sh"
|
|
16
|
-
self.repo = "https://github.com/
|
|
27
|
+
self.repo = "https://github.com/arkitektio/alpaka-server"
|
|
17
28
|
self.scopes = {
|
|
18
29
|
"alpaka_pull": "Pull new Models",
|
|
19
30
|
"alpaka_chat": "Add repositories to the database",
|
|
@@ -22,11 +33,59 @@ class AlpakaBlok(BaseArkitektService):
|
|
|
22
33
|
self.build_repo = False
|
|
23
34
|
self.buckets = ["media"]
|
|
24
35
|
self.secret_key = secrets.token_hex(16)
|
|
25
|
-
self.image = "jhnnsrs/alpaka:
|
|
36
|
+
self.image = "jhnnsrs/alpaka:nightly"
|
|
26
37
|
|
|
27
38
|
def get_additional_config(self):
|
|
28
39
|
return {"ensured_repos": self.ensured_repos}
|
|
29
40
|
|
|
41
|
+
def preflight(
|
|
42
|
+
self,
|
|
43
|
+
init: InitContext,
|
|
44
|
+
lok: LokService,
|
|
45
|
+
db: DBService,
|
|
46
|
+
redis: RedisService,
|
|
47
|
+
s3: S3Service,
|
|
48
|
+
config: ConfigService,
|
|
49
|
+
channel: ChannelService,
|
|
50
|
+
mount: MountService,
|
|
51
|
+
admin: AdminService,
|
|
52
|
+
secret: SecretService,
|
|
53
|
+
gateway: GatewayService | None = None,
|
|
54
|
+
dns: DnsService = None,
|
|
55
|
+
mount_repo: bool = False,
|
|
56
|
+
host: str = "",
|
|
57
|
+
image: str = "",
|
|
58
|
+
secret_key: str = "",
|
|
59
|
+
build_repo: bool = False,
|
|
60
|
+
command: str = "",
|
|
61
|
+
repo: str = "",
|
|
62
|
+
disable: bool = False,
|
|
63
|
+
dev: bool = False,
|
|
64
|
+
):
|
|
65
|
+
return super().preflight(
|
|
66
|
+
init,
|
|
67
|
+
lok,
|
|
68
|
+
db,
|
|
69
|
+
redis,
|
|
70
|
+
s3,
|
|
71
|
+
config,
|
|
72
|
+
channel,
|
|
73
|
+
mount,
|
|
74
|
+
admin,
|
|
75
|
+
secret,
|
|
76
|
+
gateway,
|
|
77
|
+
dns,
|
|
78
|
+
mount_repo,
|
|
79
|
+
host,
|
|
80
|
+
image,
|
|
81
|
+
secret_key,
|
|
82
|
+
build_repo,
|
|
83
|
+
command,
|
|
84
|
+
repo,
|
|
85
|
+
disable,
|
|
86
|
+
dev,
|
|
87
|
+
)
|
|
88
|
+
|
|
30
89
|
def get_builder(self):
|
|
31
90
|
return "arkitekt.generic"
|
|
32
91
|
|
arkitekt_next/bloks/arkitekt.py
CHANGED
|
@@ -3,6 +3,7 @@ from typing import Any, Dict, Optional
|
|
|
3
3
|
from pydantic import BaseModel
|
|
4
4
|
|
|
5
5
|
from arkitekt_next.bloks.kraph import KraphBlok
|
|
6
|
+
from arkitekt_next.bloks.lok import LokBlok
|
|
6
7
|
from arkitekt_next.bloks.tailscale import TailscaleBlok
|
|
7
8
|
from blok import InitContext, Panel, Renderer, blok
|
|
8
9
|
|
|
@@ -26,21 +27,17 @@ class AdminCredentials(BaseModel):
|
|
|
26
27
|
@blok(
|
|
27
28
|
"live.arkitekt",
|
|
28
29
|
dependencies=[
|
|
30
|
+
LokBlok.as_dependency(True, True),
|
|
29
31
|
MikroBlok.as_dependency(True, True),
|
|
30
32
|
KabinetBlok.as_dependency(True, True),
|
|
31
33
|
RekuestBlok.as_dependency(True, True),
|
|
32
34
|
FlussBlok.as_dependency(True, True),
|
|
33
35
|
InternalDockerBlok.as_dependency(True, True),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
KraphBlok.as_dependency(True, False),
|
|
37
|
-
TailscaleBlok.as_dependency(True, False),
|
|
38
|
-
OllamaBlok.as_dependency(True, False),
|
|
39
|
-
ElektroBlok.as_dependency(True, False),
|
|
36
|
+
KraphBlok.as_dependency(True, True),
|
|
37
|
+
ElektroBlok.as_dependency(True, True),
|
|
40
38
|
],
|
|
41
39
|
)
|
|
42
40
|
class ArkitektBlok:
|
|
43
|
-
|
|
44
41
|
def entry(self, renderer: Renderer):
|
|
45
42
|
renderer.render(
|
|
46
43
|
Panel(
|
arkitekt_next/bloks/base.py
CHANGED
|
@@ -63,12 +63,10 @@ class BaseArkitektService:
|
|
|
63
63
|
redis: RedisService,
|
|
64
64
|
s3: S3Service,
|
|
65
65
|
config: ConfigService,
|
|
66
|
-
channel: ChannelService,
|
|
67
66
|
mount: MountService,
|
|
68
67
|
admin: AdminService,
|
|
69
68
|
secret: SecretService,
|
|
70
|
-
gateway:
|
|
71
|
-
dns: DnsService = None,
|
|
69
|
+
gateway: GatewayService,
|
|
72
70
|
mount_repo: bool = False,
|
|
73
71
|
host: str = "",
|
|
74
72
|
image: str = "",
|
|
@@ -100,12 +98,7 @@ class BaseArkitektService:
|
|
|
100
98
|
|
|
101
99
|
django_secret = secret.retrieve_secret()
|
|
102
100
|
|
|
103
|
-
dns_result = dns.get_dns_result()
|
|
104
|
-
|
|
105
101
|
csrf_trusted_origins = []
|
|
106
|
-
for hostname in dns_result.hostnames:
|
|
107
|
-
csrf_trusted_origins.append(f"http://{hostname}")
|
|
108
|
-
csrf_trusted_origins.append(f"https://{hostname}")
|
|
109
102
|
|
|
110
103
|
configuration = YamlFile(
|
|
111
104
|
**{
|
arkitekt_next/bloks/gateway.py
CHANGED
|
@@ -67,20 +67,13 @@ class CaddyBlok:
|
|
|
67
67
|
def preflight(
|
|
68
68
|
self,
|
|
69
69
|
init: InitContext,
|
|
70
|
-
dns: DnsService,
|
|
71
70
|
name: NameService,
|
|
72
|
-
certer: CerterService,
|
|
73
71
|
):
|
|
74
72
|
for key, value in init.kwargs.items():
|
|
75
73
|
setattr(self, key, value)
|
|
76
74
|
|
|
77
|
-
self.public_ips = dns.get_dns_result().ip_addresses
|
|
78
|
-
self.public_hosts = dns.get_dns_result().hostnames
|
|
79
75
|
self.gateway_network = name.retrieve_name().replace("-", "_")
|
|
80
76
|
|
|
81
|
-
self.cert_mount = certer.retrieve_certs_mount()
|
|
82
|
-
self.depends_on = certer.retrieve_depends_on()
|
|
83
|
-
|
|
84
77
|
def build(
|
|
85
78
|
self,
|
|
86
79
|
context: ExecutionContext,
|
|
@@ -95,7 +88,6 @@ class CaddyBlok:
|
|
|
95
88
|
if port.tls:
|
|
96
89
|
caddyfile += f"""
|
|
97
90
|
:{port.port} {{
|
|
98
|
-
tls /certs/caddy.crt /certs/caddy.key
|
|
99
91
|
reverse_proxy {port.host}:{port.to}
|
|
100
92
|
}}
|
|
101
93
|
"""
|
|
@@ -112,7 +104,6 @@ class CaddyBlok:
|
|
|
112
104
|
"""
|
|
113
105
|
caddyfile += (
|
|
114
106
|
"""
|
|
115
|
-
tls /certs/caddy.crt /certs/caddy.key
|
|
116
107
|
"""
|
|
117
108
|
if protocol == "https" and self.cert_mount
|
|
118
109
|
else ""
|
|
@@ -173,8 +164,6 @@ class CaddyBlok:
|
|
|
173
164
|
]
|
|
174
165
|
|
|
175
166
|
volumes = ["./configs/Caddyfile:/etc/caddy/Caddyfile"]
|
|
176
|
-
if self.cert_mount:
|
|
177
|
-
volumes.append(f"{self.cert_mount}:/certs")
|
|
178
167
|
|
|
179
168
|
caddy_container = {
|
|
180
169
|
"image": "caddy:latest",
|
|
@@ -184,7 +173,6 @@ class CaddyBlok:
|
|
|
184
173
|
]
|
|
185
174
|
+ exposed_ports_strings,
|
|
186
175
|
"volumes": volumes,
|
|
187
|
-
"depends_on": caddy_depends_on,
|
|
188
176
|
"networks": [self.gateway_network, "default"],
|
|
189
177
|
}
|
|
190
178
|
|
arkitekt_next/bloks/lok.py
CHANGED
|
@@ -35,7 +35,7 @@ class UserParamType(click.ParamType):
|
|
|
35
35
|
return value
|
|
36
36
|
try:
|
|
37
37
|
name, password = value.split(":")
|
|
38
|
-
return {"
|
|
38
|
+
return {"username": name, "password": password}
|
|
39
39
|
except ValueError:
|
|
40
40
|
self.fail(
|
|
41
41
|
f"User '{value}' is not in the correct format. It should be 'name:password'.",
|
|
@@ -176,8 +176,6 @@ class LokBlok:
|
|
|
176
176
|
admin: AdminService,
|
|
177
177
|
secrets: SecretBlok,
|
|
178
178
|
s3: S3Service,
|
|
179
|
-
dns: DnsService,
|
|
180
|
-
livekit: Optional[LivekitService] = None,
|
|
181
179
|
):
|
|
182
180
|
for key, value in init.kwargs.items():
|
|
183
181
|
setattr(self, key, value)
|
|
@@ -193,9 +191,6 @@ class LokBlok:
|
|
|
193
191
|
self.redis_access = redis.register()
|
|
194
192
|
self.admin_access = admin.retrieve()
|
|
195
193
|
self.s3_access = s3.create_buckets(self.buckets)
|
|
196
|
-
if livekit:
|
|
197
|
-
self.local_access = livekit.retrieve_access()
|
|
198
|
-
self.dns_result = dns.get_dns_result()
|
|
199
194
|
self.initialized = True
|
|
200
195
|
|
|
201
196
|
def build(self, context: ExecutionContext):
|
|
@@ -206,7 +201,7 @@ class LokBlok:
|
|
|
206
201
|
|
|
207
202
|
if self.postgress_access.dependency:
|
|
208
203
|
depends_on.append(self.postgress_access.dependency)
|
|
209
|
-
|
|
204
|
+
|
|
210
205
|
if self.s3_access.dependency:
|
|
211
206
|
depends_on.append(self.s3_access.dependency)
|
|
212
207
|
|
|
@@ -219,7 +214,6 @@ class LokBlok:
|
|
|
219
214
|
"volumes": [
|
|
220
215
|
"/var/run/docker.sock:/var/run/docker.sock",
|
|
221
216
|
"./configs/lok.yaml:/workspace/config.yaml",
|
|
222
|
-
"./certs:/certs",
|
|
223
217
|
],
|
|
224
218
|
}
|
|
225
219
|
|
|
@@ -237,10 +231,6 @@ class LokBlok:
|
|
|
237
231
|
|
|
238
232
|
trusted_origins = []
|
|
239
233
|
|
|
240
|
-
for i in self.dns_result.hostnames:
|
|
241
|
-
trusted_origins.append(f"http://{i}")
|
|
242
|
-
trusted_origins.append(f"https://{i}")
|
|
243
|
-
|
|
244
234
|
configuration = YamlFile(
|
|
245
235
|
**{
|
|
246
236
|
"db": asdict(self.postgress_access),
|
|
@@ -262,14 +252,8 @@ class LokBlok:
|
|
|
262
252
|
],
|
|
263
253
|
"groups": [group for group in self.groups],
|
|
264
254
|
"deployment": {"name": self.deployment_name},
|
|
265
|
-
"livekit": (
|
|
266
|
-
asdict(self.local_access)
|
|
267
|
-
if self.local_access
|
|
268
|
-
else {"api_key": "dev", "api_secret": "secret", "api_url": None}
|
|
269
|
-
),
|
|
270
255
|
"s3": asdict(self.s3_access),
|
|
271
256
|
"token_expire_seconds": self.token_expiry_seconds,
|
|
272
|
-
"apps": [],
|
|
273
257
|
"force_script_name": "lok",
|
|
274
258
|
"csrf_trusted_origins": trusted_origins,
|
|
275
259
|
}
|
arkitekt_next/builders.py
CHANGED
|
@@ -100,7 +100,6 @@ def easy(
|
|
|
100
100
|
service_registry = service_registry or get_default_service_registry()
|
|
101
101
|
init_hook_registry = init_hook_registry or get_default_init_hook_registry()
|
|
102
102
|
|
|
103
|
-
|
|
104
103
|
if identifier is None:
|
|
105
104
|
identifier = __file__.split("/")[-1].replace(".py", "")
|
|
106
105
|
|
|
@@ -115,7 +114,6 @@ def easy(
|
|
|
115
114
|
requirements=service_registry.get_requirements(),
|
|
116
115
|
)
|
|
117
116
|
|
|
118
|
-
|
|
119
117
|
if token:
|
|
120
118
|
fakts_next = build_arkitekt_next_token_fakts_next(
|
|
121
119
|
manifest=manifest,
|
|
@@ -140,7 +138,8 @@ def easy(
|
|
|
140
138
|
herre_next = build_arkitekt_next_herre_next(fakts_next=fakts_next)
|
|
141
139
|
|
|
142
140
|
params = {
|
|
143
|
-
|
|
141
|
+
"instance_id": instance_id,
|
|
142
|
+
}
|
|
144
143
|
|
|
145
144
|
create_arkitekt_next_folder(with_cache=True)
|
|
146
145
|
|
|
@@ -176,7 +175,6 @@ def interactive(
|
|
|
176
175
|
token: Optional[str] = None,
|
|
177
176
|
no_cache: bool = False,
|
|
178
177
|
redeem_token: Optional[str] = None,
|
|
179
|
-
app_kind: str = "development",
|
|
180
178
|
registry: Optional[ServiceBuilderRegistry] = None,
|
|
181
179
|
sync_mode: bool = True,
|
|
182
180
|
) -> App:
|
|
@@ -193,7 +191,7 @@ def interactive(
|
|
|
193
191
|
token=token,
|
|
194
192
|
no_cache=no_cache,
|
|
195
193
|
redeem_token=redeem_token,
|
|
196
|
-
|
|
194
|
+
service_registry=registry,
|
|
197
195
|
)
|
|
198
196
|
|
|
199
197
|
if sync_mode:
|
|
@@ -202,7 +200,8 @@ def interactive(
|
|
|
202
200
|
# to avoid having to use await for every call. This is the default
|
|
203
201
|
# behaviour for the app, but can be overwritten by setting
|
|
204
202
|
# app.koil.sync_in_async = False
|
|
205
|
-
app.
|
|
203
|
+
if app.__koil:
|
|
204
|
+
app.__koil.sync_in_async = True
|
|
206
205
|
app.enter()
|
|
207
206
|
|
|
208
207
|
return app
|
arkitekt_next/inspect.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
from rekuest_next.structures.default import get_default_structure_registry
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
import webbrowser
|
|
6
|
+
import os
|
|
7
|
+
from rath.scalars import ID
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def open_orkestrator_link(link: str):
|
|
11
|
+
webbrowser.open(link)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class IDBearer(typing.Protocol):
|
|
15
|
+
id: ID
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def inspect(x: IDBearer) -> None:
|
|
19
|
+
"""
|
|
20
|
+
Inspects the given object by opening it in the orkestrator.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
"""
|
|
25
|
+
structure_reg = get_default_structure_registry()
|
|
26
|
+
|
|
27
|
+
identifier = structure_reg.get_identifier_for_cls(type(x))
|
|
28
|
+
|
|
29
|
+
open_orkestrator_link(f"orkestrator://{identifier}/{x.id}")
|
arkitekt_next/protocols.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from typing import Any, Protocol
|
|
2
1
|
"""
|
|
3
2
|
This module contains the types for the apps
|
|
4
3
|
depending on the builder used.
|
|
@@ -10,12 +9,14 @@ an import exception to the app.
|
|
|
10
9
|
|
|
11
10
|
"""
|
|
12
11
|
|
|
12
|
+
from typing import Any, Protocol, cast
|
|
13
13
|
import logging
|
|
14
|
-
from typing import
|
|
14
|
+
from typing import Dict, TYPE_CHECKING
|
|
15
15
|
from koil import unkoil
|
|
16
16
|
from koil.composition import KoiledModel
|
|
17
17
|
from arkitekt_next.base_models import Manifest
|
|
18
18
|
from fakts_next import Fakts
|
|
19
|
+
from herre_next import Herre
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
if TYPE_CHECKING:
|
|
@@ -25,15 +26,9 @@ if TYPE_CHECKING:
|
|
|
25
26
|
logger = logging.getLogger(__name__)
|
|
26
27
|
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
29
|
class App(Protocol):
|
|
36
30
|
"""An app that is built with the easy builder"""
|
|
31
|
+
|
|
37
32
|
fakts: Fakts
|
|
38
33
|
herre: Herre
|
|
39
34
|
manifest: Manifest
|
|
@@ -44,7 +39,7 @@ class App(Protocol):
|
|
|
44
39
|
"""Get the rekuest service"""
|
|
45
40
|
if "rekuest" not in self.services:
|
|
46
41
|
raise ValueError("Rekuest service is not available")
|
|
47
|
-
return self.services["rekuest"]
|
|
42
|
+
return cast("RekuestNext", self.services["rekuest"])
|
|
48
43
|
|
|
49
44
|
def run(self):
|
|
50
45
|
return unkoil(self.rekuest.arun)
|
|
@@ -79,5 +74,4 @@ class Builder(Protocol):
|
|
|
79
74
|
This protocol defines the methods that a builder class must implement.
|
|
80
75
|
"""
|
|
81
76
|
|
|
82
|
-
def __call__(self, *args: Any, **kwds: Any) -> Any:
|
|
83
|
-
return super().__call__(*args, **kwds)
|
|
77
|
+
def __call__(self, *args: Any, **kwds: Any) -> Any: ...
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: arkitekt-next
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.13.0
|
|
4
4
|
Summary: client for the arkitekt_next platform
|
|
5
5
|
Author-email: jhnnsrs <jhnnsrs@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -20,12 +20,12 @@ Requires-Dist: watchfiles>=1.0.5
|
|
|
20
20
|
Provides-Extra: all
|
|
21
21
|
Requires-Dist: fluss-next>=0.2.0; extra == 'all'
|
|
22
22
|
Requires-Dist: kabinet>=0.2.0; extra == 'all'
|
|
23
|
-
Requires-Dist: mikro-next>=0.
|
|
23
|
+
Requires-Dist: mikro-next>=0.4; extra == 'all'
|
|
24
24
|
Requires-Dist: reaktion-next>=0.2.0; extra == 'all'
|
|
25
25
|
Requires-Dist: rekuest-next>=0.7; extra == 'all'
|
|
26
26
|
Requires-Dist: rich-click>=1.6.1; extra == 'all'
|
|
27
27
|
Requires-Dist: semver>=3.0.1; extra == 'all'
|
|
28
|
-
Requires-Dist: turms>=0.
|
|
28
|
+
Requires-Dist: turms>=0.9; extra == 'all'
|
|
29
29
|
Requires-Dist: unlok-next>=0.2.0; extra == 'all'
|
|
30
30
|
Requires-Dist: watchfiles>=0.18.1; extra == 'all'
|
|
31
31
|
Provides-Extra: alpaka
|
|
@@ -33,7 +33,7 @@ Requires-Dist: alpaka>=0.2.0; extra == 'alpaka'
|
|
|
33
33
|
Provides-Extra: blok
|
|
34
34
|
Requires-Dist: blok>=0.1.0; extra == 'blok'
|
|
35
35
|
Provides-Extra: cli
|
|
36
|
-
Requires-Dist: turms>=0.
|
|
36
|
+
Requires-Dist: turms>=0.9.0; extra == 'cli'
|
|
37
37
|
Provides-Extra: elektro
|
|
38
38
|
Requires-Dist: elektro>=0.5.0; extra == 'elektro'
|
|
39
39
|
Provides-Extra: extended
|
|
@@ -48,7 +48,7 @@ Requires-Dist: kraph>=0.2.0; extra == 'kraph'
|
|
|
48
48
|
Provides-Extra: lovekit
|
|
49
49
|
Requires-Dist: lovekit>=0.2.0; extra == 'lovekit'
|
|
50
50
|
Provides-Extra: mikro
|
|
51
|
-
Requires-Dist: mikro-next>=0.
|
|
51
|
+
Requires-Dist: mikro-next>=0.4.0; extra == 'mikro'
|
|
52
52
|
Provides-Extra: reaktion
|
|
53
53
|
Requires-Dist: reaktion-next>=0.2.0; extra == 'reaktion'
|
|
54
54
|
Provides-Extra: unlok
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
arkitekt_next/__blok__.py,sha256=
|
|
2
|
-
arkitekt_next/__init__.py,sha256=
|
|
1
|
+
arkitekt_next/__blok__.py,sha256=1u-ggUla503bHMWsnHLOucmUMF4JuHNQRKuG1Vc343Q,1901
|
|
2
|
+
arkitekt_next/__init__.py,sha256=6id-PHkRWAvHSSUpOg9rS7pTKYGherVpCO-Fy_ZVVvE,3205
|
|
3
3
|
arkitekt_next/base_models.py,sha256=GlxtMcV4YbeY8wkbK943HsIFzB8caEsDOfzJ2EDLJ9s,4247
|
|
4
|
-
arkitekt_next/builders.py,sha256=
|
|
4
|
+
arkitekt_next/builders.py,sha256=VjVipPc4EIpeHVQPSwfBzxIt1pJMIU8AweYN2WP91Yg,7646
|
|
5
5
|
arkitekt_next/constants.py,sha256=N_tP85BDHPiOG663wwaEyMWYiUGtL2T_h4wBVPgsSUU,87
|
|
6
6
|
arkitekt_next/init_registry.py,sha256=RHAHBI1dJNpFrNZRiDxMHBj_p4GLq2Oj0GnY9Vs31os,3230
|
|
7
|
-
arkitekt_next/
|
|
7
|
+
arkitekt_next/inspect.py,sha256=iJKyN_9jlrsoEEgl_kMriEZ46uKDNV-vz6PwzqDRE3g,587
|
|
8
|
+
arkitekt_next/protocols.py,sha256=ZZFLOKtLlSjrKX4kWqZC-_C7QqSXN2MyeA8AbD9jfgo,2031
|
|
8
9
|
arkitekt_next/service_registry.py,sha256=gA7c2JKWqZPme5VatVJWFlX0e8HPcxb2BkzZrBMGPUk,7307
|
|
9
10
|
arkitekt_next/tqdm.py,sha256=KLGeviRa8iEx89OENMXOuoz8hRDKxDktwG3L8oPlR7I,3415
|
|
10
11
|
arkitekt_next/utils.py,sha256=7kWfUU4jacD8sKgV2-GsZV547EXYpzDNx_7LnIrb0oU,2454
|
|
@@ -19,20 +20,19 @@ arkitekt_next/apps/service/herre_qt.py,sha256=42APOZl0SnX0FWl6K-TC9CcZUO-BSXMXyH
|
|
|
19
20
|
arkitekt_next/apps/service/local_fakts.py,sha256=Wy37fjsEP2yjKZPtMlLilNlkO0olFX_7P5IIr6g3jkE,2900
|
|
20
21
|
arkitekt_next/bloks/__init__.py,sha256=_4EeR63d6avQUWLG4mK2n_FvogTPQ_Jx6f2_RvNbWeA,29
|
|
21
22
|
arkitekt_next/bloks/admin.py,sha256=LzlcGWtpoS3NR3llRjzj1EuwH5o_hroBje3ZSm7ZXOI,1293
|
|
22
|
-
arkitekt_next/bloks/alpaka.py,sha256=
|
|
23
|
-
arkitekt_next/bloks/arkitekt.py,sha256=
|
|
24
|
-
arkitekt_next/bloks/base.py,sha256=
|
|
23
|
+
arkitekt_next/bloks/alpaka.py,sha256=Ojw1iOQL6JtEEwCTGshYO5e6iYn5dwx8LiG4ArdDCa4,3151
|
|
24
|
+
arkitekt_next/bloks/arkitekt.py,sha256=BiqKLcptePUIDKtZ-IOf0mQnYPtZCquYbs0qKj8pUFk,1580
|
|
25
|
+
arkitekt_next/bloks/base.py,sha256=n3cfEF-7OFJFUDMA5UDEfH118Mg-9aKBxFEFtm8Vb5E,6271
|
|
25
26
|
arkitekt_next/bloks/channel.py,sha256=PsFlb1qjL9ULtbVt8g1dsuaa9bd60zJCT059LztUkGA,739
|
|
26
27
|
arkitekt_next/bloks/config.py,sha256=YMQChT4SCdc_vvvbkAj_qGyA--6JVEHds7MalqUp3lw,1269
|
|
27
28
|
arkitekt_next/bloks/elektro.py,sha256=7UlSZ6EjwCV3SEN7Wn0En2pDZwZcLF_wa5nQvZmKvGI,1288
|
|
28
29
|
arkitekt_next/bloks/fluss.py,sha256=8nf5Z2k-tA3CNRQeIqh7-aaFe5my_NN2lAhbyYbwKEs,1074
|
|
29
|
-
arkitekt_next/bloks/gateway.py,sha256=
|
|
30
|
+
arkitekt_next/bloks/gateway.py,sha256=H_8ZzEaeTOgVUjL8_qOa0hm6b8kqhXma6p2lxRDPfiY,6207
|
|
30
31
|
arkitekt_next/bloks/internal_docker.py,sha256=4onnegXts8zOaXEgg4kw8zaqlACRNwvdknJeFHipGtQ,2829
|
|
31
32
|
arkitekt_next/bloks/kabinet.py,sha256=NKP6tpr8XcVvvFifX-lxgBPkP0P810kJ4URv25jf2z8,1489
|
|
32
33
|
arkitekt_next/bloks/kraph.py,sha256=vbDkLNC5X644pwM_rpUpTNl4uwGpswFm0iNsyMPWY6c,1292
|
|
33
34
|
arkitekt_next/bloks/livekit.py,sha256=Wf4JM236ZwuWC5qHnZkGDPq_FZftKLi1nDWbkwRoVso,2611
|
|
34
|
-
arkitekt_next/bloks/
|
|
35
|
-
arkitekt_next/bloks/lok.py,sha256=REa2HF6_FOqVyZ2KEdGTWfdgxXvGI5xvqqPJtyrzIJY,12136
|
|
35
|
+
arkitekt_next/bloks/lok.py,sha256=LL5yoFwIXO4INGKHEha5k2VmkWyHgQIHmy1roDxEae0,11500
|
|
36
36
|
arkitekt_next/bloks/mikro.py,sha256=bnI9lWd6FXyOViog0Xko3_yhKOt7AAdB_PA4N0XkXAU,1291
|
|
37
37
|
arkitekt_next/bloks/minio.py,sha256=gVFVoq5Po7yWO-CeTxQQecK4b3bBr_vdnEodF991WR4,5595
|
|
38
38
|
arkitekt_next/bloks/mount.py,sha256=IEod6LDuV5NNKvvRJ3Xgo8l2caVZnNmJYDgGGBUB3Cg,1088
|
|
@@ -144,8 +144,8 @@ arkitekt_next/qt/assets/light/green pulse.gif,sha256=cUd2F3Qlvjb7SnsU-LjGgeLTa8K
|
|
|
144
144
|
arkitekt_next/qt/assets/light/orange pulse.gif,sha256=0gDvrRed0mzZZPHB4tP6vptx7myUCAa_hEVGdjRhNy8,94769
|
|
145
145
|
arkitekt_next/qt/assets/light/pink pulse.gif,sha256=rxd6ZTHSIG9JZuuHhi3jiSB_JYFBZpy7OWUeZETlhQ4,107513
|
|
146
146
|
arkitekt_next/qt/assets/light/red pulse.gif,sha256=U7WLbZvSl5e-Ob5RmawtlC0Rh9VVHxkjDbGjj7NYVUo,108749
|
|
147
|
-
arkitekt_next-0.
|
|
148
|
-
arkitekt_next-0.
|
|
149
|
-
arkitekt_next-0.
|
|
150
|
-
arkitekt_next-0.
|
|
151
|
-
arkitekt_next-0.
|
|
147
|
+
arkitekt_next-0.13.0.dist-info/METADATA,sha256=VW7ONrep0p_hY3IFfYVm4ag-FAYjBxP9qVxX6MxXiTw,5778
|
|
148
|
+
arkitekt_next-0.13.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
149
|
+
arkitekt_next-0.13.0.dist-info/entry_points.txt,sha256=IY-mUEDBU6QncqnYw-Ufw5bvNNXjqSlLf1uexZZCJhc,61
|
|
150
|
+
arkitekt_next-0.13.0.dist-info/licenses/LICENSE,sha256=YZ2oRjC248t-GpoEyw7J13vwKYNG6zhYMaEAix6EzF0,1089
|
|
151
|
+
arkitekt_next-0.13.0.dist-info/RECORD,,
|
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
import click
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel
|
|
4
|
-
from cryptography.hazmat.primitives import serialization as crypto_serialization
|
|
5
|
-
from cryptography.hazmat.primitives.asymmetric import rsa
|
|
6
|
-
from cryptography.hazmat.backends import default_backend as crypto_default_backend
|
|
7
|
-
from typing import Dict, Optional
|
|
8
|
-
from arkitekt_next.bloks.secret import SecretBlok
|
|
9
|
-
from arkitekt_next.bloks.services.admin import AdminService
|
|
10
|
-
from arkitekt_next.bloks.services.db import DBService
|
|
11
|
-
from arkitekt_next.bloks.services.gateway import GatewayService
|
|
12
|
-
from arkitekt_next.bloks.services.livekit import LivekitService
|
|
13
|
-
from arkitekt_next.bloks.services.lok import LokCredentials, LokService
|
|
14
|
-
import yaml
|
|
15
|
-
import secrets
|
|
16
|
-
from dataclasses import asdict
|
|
17
|
-
|
|
18
|
-
from arkitekt_next.bloks.services.redis import RedisService
|
|
19
|
-
from blok import blok, InitContext, ExecutionContext, Option
|
|
20
|
-
from blok.bloks.services.dns import DnsService
|
|
21
|
-
from blok.tree import YamlFile, Repo
|
|
22
|
-
from blok import blok, InitContext
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
DEFAULT_ARKITEKT_URL = "http://localhost:8000"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
# Define a custom user type that will parse and validate the user input
|
|
29
|
-
class UserParamType(click.ParamType):
|
|
30
|
-
name = "user"
|
|
31
|
-
|
|
32
|
-
def convert(self, value, param, ctx):
|
|
33
|
-
if isinstance(value, dict):
|
|
34
|
-
return value
|
|
35
|
-
try:
|
|
36
|
-
name, password = value.split(":")
|
|
37
|
-
return {"name": name, "password": password}
|
|
38
|
-
except ValueError:
|
|
39
|
-
self.fail(
|
|
40
|
-
f"User '{value}' is not in the correct format. It should be 'name:password'.",
|
|
41
|
-
param,
|
|
42
|
-
ctx,
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
USER = UserParamType()
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
# Define a custom user type that will parse and validate the user input
|
|
50
|
-
class GroupParamType(click.ParamType):
|
|
51
|
-
name = "group"
|
|
52
|
-
|
|
53
|
-
def convert(self, value, param, ctx):
|
|
54
|
-
if isinstance(value, dict):
|
|
55
|
-
return value
|
|
56
|
-
try:
|
|
57
|
-
name, description = value.split(":")
|
|
58
|
-
return {"name": name, "description": description}
|
|
59
|
-
except ValueError:
|
|
60
|
-
self.fail(
|
|
61
|
-
f"User '{value}' is not in the correct format. It should be 'name:password'.",
|
|
62
|
-
param,
|
|
63
|
-
ctx,
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
GROUP = GroupParamType()
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
class RedeemTokenParamType(click.ParamType):
|
|
71
|
-
name = "redeem_token"
|
|
72
|
-
|
|
73
|
-
def convert(self, value, param, ctx):
|
|
74
|
-
if isinstance(value, dict):
|
|
75
|
-
assert "user" in value, f"scope is required {value}"
|
|
76
|
-
assert "token" in value, f"description is required {value}"
|
|
77
|
-
return value
|
|
78
|
-
|
|
79
|
-
try:
|
|
80
|
-
user, token = value.split(":")
|
|
81
|
-
return {"user": user, "token": token}
|
|
82
|
-
except ValueError:
|
|
83
|
-
self.fail(
|
|
84
|
-
f"RedeemToken '{value}' is not in the correct format. It should be 'username:token'.",
|
|
85
|
-
param,
|
|
86
|
-
ctx,
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
TOKEN = RedeemTokenParamType()
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
class ScopeParamType(click.ParamType):
|
|
94
|
-
name = "scope"
|
|
95
|
-
|
|
96
|
-
def convert(self, value, param, ctx):
|
|
97
|
-
if isinstance(value, dict):
|
|
98
|
-
assert "scope" in value, f"scope is required {value}"
|
|
99
|
-
assert "description" in value, f"description is required {value}"
|
|
100
|
-
return value
|
|
101
|
-
|
|
102
|
-
try:
|
|
103
|
-
name, description = value.split(":")
|
|
104
|
-
return {"scope": name, "description": description}
|
|
105
|
-
except ValueError:
|
|
106
|
-
self.fail(
|
|
107
|
-
f"Scopes '{value}' is not in the correct format. It should be 'scope:description'.",
|
|
108
|
-
param,
|
|
109
|
-
ctx,
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
SCOPE = ScopeParamType()
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
@blok(LokService, description="A local sign service")
|
|
117
|
-
class LocalSignBlok:
|
|
118
|
-
db_name: str
|
|
119
|
-
|
|
120
|
-
def __init__(self) -> None:
|
|
121
|
-
self.db_name = "lok_db"
|
|
122
|
-
self.mount_repo = False
|
|
123
|
-
self.build_repo = False
|
|
124
|
-
self.private_key = None
|
|
125
|
-
self.public_key = None
|
|
126
|
-
self.host = "lok"
|
|
127
|
-
self.dev = False
|
|
128
|
-
self.with_repo = False
|
|
129
|
-
self.users = []
|
|
130
|
-
self.tokens = []
|
|
131
|
-
self.groups = []
|
|
132
|
-
self.scopes = {}
|
|
133
|
-
self.key = None
|
|
134
|
-
self.deployment_name = "default"
|
|
135
|
-
self.token_expiry_seconds = 700000
|
|
136
|
-
self.preformed_redeem_tokens = [secrets.token_hex(16) for i in range(80)]
|
|
137
|
-
self.registered_tokens = {}
|
|
138
|
-
self.local_access = None
|
|
139
|
-
|
|
140
|
-
def retrieve_credentials(self) -> LokCredentials:
|
|
141
|
-
return LokCredentials(
|
|
142
|
-
public_key=self.public_key, key_type="RS256", issuer="lok"
|
|
143
|
-
)
|
|
144
|
-
|
|
145
|
-
def retrieve_labels(self, service_name: str, builder_name: str) -> list[str]:
|
|
146
|
-
return [
|
|
147
|
-
f"fakts.service={service_name}",
|
|
148
|
-
f"fakts.builder={builder_name}",
|
|
149
|
-
]
|
|
150
|
-
|
|
151
|
-
def retrieve_token(self, user: str = "admin") -> str:
|
|
152
|
-
pass
|
|
153
|
-
return "fake-token"
|
|
154
|
-
|
|
155
|
-
def register_scopes(self, scopes_dict: Dict[str, str]) -> LokCredentials:
|
|
156
|
-
self.scopes = self.scopes | scopes_dict
|
|
157
|
-
|
|
158
|
-
def preflight(
|
|
159
|
-
self,
|
|
160
|
-
init: InitContext
|
|
161
|
-
):
|
|
162
|
-
for key, value in init.kwargs.items():
|
|
163
|
-
setattr(self, key, value)
|
|
164
|
-
|
|
165
|
-
assert self.public_key, "Public key is required"
|
|
166
|
-
assert self.private_key, "Private key is required"
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
def build(self, context: ExecutionContext):
|
|
170
|
-
context.file_tree.set_nested("secrets", "public_key.pem", self.public_key)
|
|
171
|
-
context.file_tree.set_nested("secrets", "private_key.pem", self.private_key)
|
|
172
|
-
|
|
173
|
-
def get_options(self):
|
|
174
|
-
key = rsa.generate_private_key(
|
|
175
|
-
public_exponent=65537, key_size=2048, backend=crypto_default_backend()
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
private_key = key.private_bytes(
|
|
179
|
-
crypto_serialization.Encoding.PEM,
|
|
180
|
-
crypto_serialization.PrivateFormat.PKCS8,
|
|
181
|
-
crypto_serialization.NoEncryption(),
|
|
182
|
-
).decode()
|
|
183
|
-
|
|
184
|
-
public_key = (
|
|
185
|
-
key.public_key()
|
|
186
|
-
.public_bytes(
|
|
187
|
-
crypto_serialization.Encoding.OpenSSH,
|
|
188
|
-
crypto_serialization.PublicFormat.OpenSSH,
|
|
189
|
-
)
|
|
190
|
-
.decode()
|
|
191
|
-
)
|
|
192
|
-
|
|
193
|
-
with_dev = Option(
|
|
194
|
-
subcommand="dev",
|
|
195
|
-
help="Run the service in development mode",
|
|
196
|
-
type=bool,
|
|
197
|
-
default=self.dev,
|
|
198
|
-
show_default=True,
|
|
199
|
-
)
|
|
200
|
-
|
|
201
|
-
with_fakts_url = Option(
|
|
202
|
-
subcommand="db_name",
|
|
203
|
-
help="The name of the database",
|
|
204
|
-
default="db_name",
|
|
205
|
-
show_default=True,
|
|
206
|
-
)
|
|
207
|
-
with_users = Option(
|
|
208
|
-
subcommand="users",
|
|
209
|
-
help="Users that should be greated by default. Format is name:password",
|
|
210
|
-
default=["admin:admin"],
|
|
211
|
-
multiple=True,
|
|
212
|
-
type=USER,
|
|
213
|
-
show_default=True,
|
|
214
|
-
)
|
|
215
|
-
with_groups = Option(
|
|
216
|
-
subcommand="groups",
|
|
217
|
-
help="Groups that should be greated by default. Format is name:description",
|
|
218
|
-
default=["admin:admin_group"],
|
|
219
|
-
multiple=True,
|
|
220
|
-
type=GROUP,
|
|
221
|
-
show_default=True,
|
|
222
|
-
)
|
|
223
|
-
with_public_key = Option(
|
|
224
|
-
subcommand="public_key",
|
|
225
|
-
help="The public key for the JWT creation",
|
|
226
|
-
default=public_key,
|
|
227
|
-
required=True,
|
|
228
|
-
callback=validate_public_key,
|
|
229
|
-
)
|
|
230
|
-
with_private_key = Option(
|
|
231
|
-
subcommand="private_key",
|
|
232
|
-
help="The corresponding private key for the JWT creation",
|
|
233
|
-
default=private_key,
|
|
234
|
-
callback=validate_private_key,
|
|
235
|
-
required=True,
|
|
236
|
-
)
|
|
237
|
-
|
|
238
|
-
return [
|
|
239
|
-
with_dev,
|
|
240
|
-
with_fakts_url,
|
|
241
|
-
with_users,
|
|
242
|
-
with_groups,
|
|
243
|
-
with_private_key,
|
|
244
|
-
with_public_key,
|
|
245
|
-
]
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
def validate_public_key(ctx, param, value):
|
|
249
|
-
if not value.startswith("ssh-rsa"):
|
|
250
|
-
raise click.BadParameter(
|
|
251
|
-
f"Public key must be in ssh-rsa format. Started with {value}"
|
|
252
|
-
)
|
|
253
|
-
return value
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
def validate_private_key(ctx, param, value):
|
|
257
|
-
if not value.startswith("-----BEGIN PRIVATE KEY-----"):
|
|
258
|
-
raise click.BadParameter(
|
|
259
|
-
f"Private key must be in PEM format. Started with {value}"
|
|
260
|
-
)
|
|
261
|
-
return value
|
|
File without changes
|
|
File without changes
|
|
File without changes
|