arkitekt-next 0.11.0__tar.gz → 0.12.0__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 arkitekt-next might be problematic. Click here for more details.
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/PKG-INFO +4 -3
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/__init__.py +6 -1
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/apps/service/fakts_next.py +2 -11
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/builders.py +10 -23
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/call/local.py +9 -13
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/gen/compile.py +1 -1
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/kabinet/build.py +30 -12
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/kabinet/io.py +1 -1
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/run/dev.py +53 -29
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/run/utils.py +14 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/io.py +1 -1
- arkitekt_next-0.12.0/arkitekt_next/init_registry.py +117 -0
- arkitekt_next-0.12.0/arkitekt_next/protocols.py +83 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/service_registry.py +41 -14
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/pyproject.toml +4 -3
- arkitekt_next-0.11.0/arkitekt_next/init_registry.py +0 -102
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/.gitignore +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/LICENSE +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/README.md +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/__blok__.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/apps/__init__.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/apps/protocols.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/apps/service/__init__.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/apps/service/fakts_qt.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/apps/service/grant_registry.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/apps/service/herre.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/apps/service/herre_qt.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/apps/service/local_fakts.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/base_models.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/__init__.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/admin.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/alpaka.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/arkitekt.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/base.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/channel.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/config.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/elektro.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/fluss.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/gateway.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/internal_docker.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/kabinet.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/kraph.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/livekit.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/local_sign.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/lok.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/mikro.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/minio.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/mount.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/namegen.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/ollama.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/orkestrator.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/postgres.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/redis.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/rekuest.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/secret.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/self_signed.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/services/__init__.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/services/admin.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/services/certer.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/services/channel.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/services/config.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/services/db.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/services/gateway.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/services/livekit.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/services/lok.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/services/mount.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/services/name.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/services/ollama.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/services/redis.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/services/s3.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/services/secret.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/services/socket.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/socket.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/bloks/tailscale.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/__init__.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/call/__init__.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/call/main.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/call/remote.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/gen/__init__.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/gen/init.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/gen/main.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/gen/watch.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/init/__init__.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/init/main.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/inspect/__init__.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/inspect/implementations.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/inspect/main.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/inspect/requirements.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/inspect/variables.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/kabinet/__init__.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/kabinet/init.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/kabinet/main.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/kabinet/publish.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/kabinet/stage.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/kabinet/types.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/kabinet/utils.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/kabinet/validate.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/manifest/__init__.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/manifest/inspect.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/manifest/main.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/manifest/scopes.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/manifest/version.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/run/__init__.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/run/main.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/commands/run/prod.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/constants.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/dockerfiles/vanilla.dockerfile +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/errors.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/inspect.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/main.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/options.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/schemas/fluss.schema.graphql +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/schemas/gucker.schema.graphql +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/schemas/kabinet.schema.graphql +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/schemas/kluster.schema.graphql +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/schemas/konviktion.schema.graphql +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/schemas/kuay.schema.graphql +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/schemas/mikro.schema.graphql +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/schemas/mikro_next.schema.graphql +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/schemas/napari.schema.graphql +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/schemas/omero_ark.schema.graphql +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/schemas/port.schema.graphql +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/schemas/rekuest.schema.graphql +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/schemas/rekuest_next.schema.graphql +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/schemas/unlok.schema.graphql +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/templates/filter.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/templates/simple.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/texts.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/types.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/ui.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/utils.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/validators.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/vars.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/cli/versions/v1.yaml +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/constants.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/qt/__init__.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/qt/assets/dark/gear.png +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/qt/assets/dark/green pulse.gif +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/qt/assets/dark/orange pulse.gif +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/qt/assets/dark/pink pulse.gif +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/qt/assets/dark/red pulse.gif +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/qt/assets/light/gear.png +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/qt/assets/light/green pulse.gif +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/qt/assets/light/orange pulse.gif +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/qt/assets/light/pink pulse.gif +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/qt/assets/light/red pulse.gif +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/qt/builders.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/qt/magic_bar.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/qt/types.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/qt/utils.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/tqdm.py +0 -0
- {arkitekt_next-0.11.0 → arkitekt_next-0.12.0}/arkitekt_next/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: arkitekt-next
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.12.0
|
|
4
4
|
Summary: client for the arkitekt_next platform
|
|
5
5
|
Author-email: jhnnsrs <jhnnsrs@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -9,10 +9,11 @@ Requires-Python: <4,>=3.11
|
|
|
9
9
|
Requires-Dist: click>=8.2.0
|
|
10
10
|
Requires-Dist: dokker>=2.1.2
|
|
11
11
|
Requires-Dist: fakts-next>=1.2.2
|
|
12
|
-
Requires-Dist: herre-next>=1.
|
|
12
|
+
Requires-Dist: herre-next>=1.3
|
|
13
|
+
Requires-Dist: kabinet>=0.5
|
|
13
14
|
Requires-Dist: koil>=2.0.4
|
|
14
15
|
Requires-Dist: rath>=3.4
|
|
15
|
-
Requires-Dist: rekuest-next>=0.
|
|
16
|
+
Requires-Dist: rekuest-next>=0.8
|
|
16
17
|
Requires-Dist: rich-click>=1.8.8
|
|
17
18
|
Requires-Dist: semver>=3.0.4
|
|
18
19
|
Requires-Dist: watchfiles>=1.0.5
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from .builders import easy, interactive
|
|
2
2
|
from .apps.protocols import App
|
|
3
3
|
from fakts_next.helpers import afakt, fakt
|
|
4
|
-
from .init_registry import init,
|
|
4
|
+
from .init_registry import init, InitHookRegistry, get_default_init_hook_registry
|
|
5
5
|
from .service_registry import (
|
|
6
6
|
require,
|
|
7
7
|
ServiceBuilderRegistry,
|
|
@@ -28,6 +28,7 @@ try:
|
|
|
28
28
|
from rekuest_next.actors.context import progress, aprogress
|
|
29
29
|
from rekuest_next.actors.context import log, alog
|
|
30
30
|
from rekuest_next.structures.model import model
|
|
31
|
+
from rekuest_next.actors.context import apublish, publish
|
|
31
32
|
from rekuest_next.remote import (
|
|
32
33
|
call,
|
|
33
34
|
acall,
|
|
@@ -39,6 +40,8 @@ try:
|
|
|
39
40
|
)
|
|
40
41
|
except ImportError as e:
|
|
41
42
|
raise e
|
|
43
|
+
publish = missing_install("rekuest_next", e)
|
|
44
|
+
apublish = missing_install("rekuest_next", e)
|
|
42
45
|
structure = missing_install("rekuest_next", e)
|
|
43
46
|
register = missing_install("rekuest_next", e)
|
|
44
47
|
background = missing_install("rekuest_next", e)
|
|
@@ -73,6 +76,8 @@ __all__ = [
|
|
|
73
76
|
"afakt",
|
|
74
77
|
"fakt",
|
|
75
78
|
"progress",
|
|
79
|
+
"InitHookRegistry",
|
|
80
|
+
"get_default_init_hook_registry",
|
|
76
81
|
"aprogress",
|
|
77
82
|
"ServiceBuilderRegistry",
|
|
78
83
|
"get_default_service_registry",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from typing import Optional
|
|
2
2
|
|
|
3
3
|
from fakts_next.fakts import Fakts
|
|
4
|
-
from fakts_next.grants.hard import HardFakts
|
|
5
4
|
from fakts_next.grants.remote import RemoteGrant
|
|
6
5
|
from fakts_next.grants.remote.discovery.well_known import WellKnownDiscovery
|
|
7
6
|
from fakts_next.grants.remote.demanders.static import StaticDemander
|
|
@@ -45,7 +44,7 @@ def build_arkitekt_next_fakts_next(
|
|
|
45
44
|
)
|
|
46
45
|
|
|
47
46
|
|
|
48
|
-
def build_arkitekt_next_redeem_fakts_next(manifest: Manifest, redeem_token: str, url):
|
|
47
|
+
def build_arkitekt_next_redeem_fakts_next(manifest: Manifest, redeem_token: str, url: str) -> Fakts:
|
|
49
48
|
identifier = manifest.identifier
|
|
50
49
|
version = manifest.version
|
|
51
50
|
|
|
@@ -65,7 +64,7 @@ def build_arkitekt_next_redeem_fakts_next(manifest: Manifest, redeem_token: str,
|
|
|
65
64
|
def build_arkitekt_next_token_fakts_next(
|
|
66
65
|
manifest: Manifest,
|
|
67
66
|
token: str,
|
|
68
|
-
url,
|
|
67
|
+
url: str,
|
|
69
68
|
):
|
|
70
69
|
identifier = manifest.identifier
|
|
71
70
|
version = manifest.version
|
|
@@ -82,11 +81,3 @@ def build_arkitekt_next_token_fakts_next(
|
|
|
82
81
|
),
|
|
83
82
|
)
|
|
84
83
|
|
|
85
|
-
|
|
86
|
-
def build_local_fakts(manifest, fakts):
|
|
87
|
-
identifier = manifest.identifier
|
|
88
|
-
version = manifest.version
|
|
89
|
-
|
|
90
|
-
return Fakts(
|
|
91
|
-
grant=HardFakts(fakts=fakts),
|
|
92
|
-
)
|
|
@@ -6,14 +6,13 @@ from arkitekt_next.apps.service.fakts_next import (
|
|
|
6
6
|
build_arkitekt_next_fakts_next,
|
|
7
7
|
build_arkitekt_next_redeem_fakts_next,
|
|
8
8
|
build_arkitekt_next_token_fakts_next,
|
|
9
|
-
build_local_fakts,
|
|
10
9
|
)
|
|
11
10
|
from arkitekt_next.apps.service.herre import build_arkitekt_next_herre_next
|
|
12
11
|
from .utils import create_arkitekt_next_folder
|
|
13
12
|
from .base_models import Manifest
|
|
14
13
|
from .apps.protocols import App
|
|
15
14
|
from .service_registry import ServiceBuilderRegistry, get_default_service_registry
|
|
16
|
-
from .init_registry import
|
|
15
|
+
from .init_registry import InitHookRegistry, get_default_init_hook_registry
|
|
17
16
|
from arkitekt_next.constants import DEFAULT_ARKITEKT_URL
|
|
18
17
|
|
|
19
18
|
|
|
@@ -29,9 +28,8 @@ def easy(
|
|
|
29
28
|
no_cache: bool = False,
|
|
30
29
|
redeem_token: Optional[str] = None,
|
|
31
30
|
service_registry: Optional[ServiceBuilderRegistry] = None,
|
|
32
|
-
init_hook_registry: Optional[
|
|
33
|
-
|
|
34
|
-
**kwargs,
|
|
31
|
+
init_hook_registry: Optional[InitHookRegistry] = None,
|
|
32
|
+
instance_id: str = "main",
|
|
35
33
|
) -> App:
|
|
36
34
|
"""Creates a next app
|
|
37
35
|
|
|
@@ -100,12 +98,8 @@ def easy(
|
|
|
100
98
|
A built app, that can be used to interact with the ArkitektNext server
|
|
101
99
|
"""
|
|
102
100
|
service_registry = service_registry or get_default_service_registry()
|
|
103
|
-
init_hook_registry = init_hook_registry or
|
|
101
|
+
init_hook_registry = init_hook_registry or get_default_init_hook_registry()
|
|
104
102
|
|
|
105
|
-
if init_hook_registry is None:
|
|
106
|
-
raise ValueError(
|
|
107
|
-
"No init hook registry found. Please provide a init hook registry or use the default one."
|
|
108
|
-
)
|
|
109
103
|
|
|
110
104
|
if identifier is None:
|
|
111
105
|
identifier = __file__.split("/")[-1].replace(".py", "")
|
|
@@ -121,13 +115,8 @@ def easy(
|
|
|
121
115
|
requirements=service_registry.get_requirements(),
|
|
122
116
|
)
|
|
123
117
|
|
|
124
|
-
if fakts:
|
|
125
|
-
fakts_next = build_local_fakts(
|
|
126
|
-
manifest=manifest,
|
|
127
|
-
fakts=fakts,
|
|
128
|
-
)
|
|
129
118
|
|
|
130
|
-
|
|
119
|
+
if token:
|
|
131
120
|
fakts_next = build_arkitekt_next_token_fakts_next(
|
|
132
121
|
manifest=manifest,
|
|
133
122
|
token=token,
|
|
@@ -150,7 +139,8 @@ def easy(
|
|
|
150
139
|
|
|
151
140
|
herre_next = build_arkitekt_next_herre_next(fakts_next=fakts_next)
|
|
152
141
|
|
|
153
|
-
params =
|
|
142
|
+
params = {
|
|
143
|
+
"instance_id": instance_id,}
|
|
154
144
|
|
|
155
145
|
create_arkitekt_next_folder(with_cache=True)
|
|
156
146
|
|
|
@@ -189,8 +179,7 @@ def interactive(
|
|
|
189
179
|
app_kind: str = "development",
|
|
190
180
|
registry: Optional[ServiceBuilderRegistry] = None,
|
|
191
181
|
sync_mode: bool = True,
|
|
192
|
-
|
|
193
|
-
):
|
|
182
|
+
) -> App:
|
|
194
183
|
"""Creates an interactive jupyter app"""
|
|
195
184
|
|
|
196
185
|
app = easy(
|
|
@@ -204,9 +193,7 @@ def interactive(
|
|
|
204
193
|
token=token,
|
|
205
194
|
no_cache=no_cache,
|
|
206
195
|
redeem_token=redeem_token,
|
|
207
|
-
|
|
208
|
-
registry=registry,
|
|
209
|
-
**kwargs,
|
|
196
|
+
|
|
210
197
|
)
|
|
211
198
|
|
|
212
199
|
if sync_mode:
|
|
@@ -215,7 +202,7 @@ def interactive(
|
|
|
215
202
|
# to avoid having to use await for every call. This is the default
|
|
216
203
|
# behaviour for the app, but can be overwritten by setting
|
|
217
204
|
# app.koil.sync_in_async = False
|
|
218
|
-
app.
|
|
205
|
+
app._koil.sync_in_async = True
|
|
219
206
|
app.enter()
|
|
220
207
|
|
|
221
208
|
return app
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
|
|
2
|
+
from click import Context
|
|
2
3
|
import rich_click as click
|
|
3
4
|
from arkitekt_next.cli.options import *
|
|
4
5
|
import asyncio
|
|
@@ -8,7 +9,6 @@ from arkitekt_next.cli.utils import import_builder
|
|
|
8
9
|
from rekuest_next.rekuest import RekuestNext
|
|
9
10
|
from rich.console import Console
|
|
10
11
|
from typing import Dict, Any
|
|
11
|
-
import asyncio
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
async def call_app(
|
|
@@ -22,15 +22,11 @@ async def call_app(
|
|
|
22
22
|
|
|
23
23
|
async with app:
|
|
24
24
|
|
|
25
|
-
rekuest: RekuestNext = app.
|
|
26
|
-
|
|
25
|
+
rekuest: RekuestNext = app.rekuest
|
|
27
26
|
|
|
28
|
-
raise NotImplementedError("Not implemented yet")
|
|
27
|
+
raise NotImplementedError("Not implemented yet. Do you want to implement it? :)")
|
|
29
28
|
|
|
30
29
|
|
|
31
|
-
t = asyncio.create_task(rekuest.arun())
|
|
32
|
-
|
|
33
|
-
await t
|
|
34
30
|
|
|
35
31
|
|
|
36
32
|
|
|
@@ -66,12 +62,12 @@ async def call_app(
|
|
|
66
62
|
)
|
|
67
63
|
@click.option("--fakts", "-f", "fakts", type=(str, str), multiple=True)
|
|
68
64
|
def local(
|
|
69
|
-
ctx,
|
|
70
|
-
entrypoint=None,
|
|
71
|
-
builder=None,
|
|
72
|
-
args=None,
|
|
73
|
-
template: str = None,
|
|
74
|
-
fakts: str = None,
|
|
65
|
+
ctx: Context,
|
|
66
|
+
entrypoint: str | None =None,
|
|
67
|
+
builder: str | None =None,
|
|
68
|
+
args: Optional[Dict[str, Any]] = None,
|
|
69
|
+
template: str | None = None,
|
|
70
|
+
fakts: Optional[Dict[str, str]] = None,
|
|
75
71
|
**builder_kwargs,
|
|
76
72
|
):
|
|
77
73
|
"""Runs the app in production mode
|
|
@@ -10,7 +10,7 @@ import os
|
|
|
10
10
|
type=click.Path(exists=True),
|
|
11
11
|
default=None,
|
|
12
12
|
)
|
|
13
|
-
def compile(projects, config):
|
|
13
|
+
def compile(projects, config: click.Path):
|
|
14
14
|
"""Genererate the code of a project"
|
|
15
15
|
|
|
16
16
|
Uses a previously generated graphql-config.yaml file to generate the code for a or multiple projects.
|
|
@@ -5,11 +5,13 @@ import os
|
|
|
5
5
|
from rich.panel import Panel
|
|
6
6
|
import subprocess
|
|
7
7
|
import uuid
|
|
8
|
+
|
|
9
|
+
from kabinet.api.schema import RequirementInput
|
|
8
10
|
from .io import generate_build
|
|
9
11
|
from click import Context
|
|
10
12
|
from .types import Flavour, InspectionInput
|
|
11
13
|
import yaml
|
|
12
|
-
from typing import Dict, Optional
|
|
14
|
+
from typing import Dict, List, Optional
|
|
13
15
|
import json
|
|
14
16
|
from arkitekt_next.base_models import Requirement
|
|
15
17
|
from arkitekt_next.constants import DEFAULT_ARKITEKT_URL
|
|
@@ -93,7 +95,7 @@ def inspect_docker_container(build_id: str) -> InspectionInput:
|
|
|
93
95
|
raise InspectionError(f"An error occurred: {e.stdout + e.stderr}") from e
|
|
94
96
|
|
|
95
97
|
|
|
96
|
-
def
|
|
98
|
+
def inspect_implementations(build_id: str, url: str) -> list[ImplementationInput]:
|
|
97
99
|
try:
|
|
98
100
|
# Run 'docker inspect' with the container ID or name
|
|
99
101
|
process = subprocess.Popen(
|
|
@@ -116,7 +118,7 @@ def inspect_templates(build_id: str, url: str) -> list[ImplementationInput]:
|
|
|
116
118
|
stderr=subprocess.PIPE,
|
|
117
119
|
)
|
|
118
120
|
|
|
119
|
-
lines = []
|
|
121
|
+
lines: list[str] = []
|
|
120
122
|
# Poll process for new output until finished
|
|
121
123
|
while True:
|
|
122
124
|
if process.poll() is not None:
|
|
@@ -129,9 +131,25 @@ def inspect_templates(build_id: str, url: str) -> list[ImplementationInput]:
|
|
|
129
131
|
|
|
130
132
|
output = process.communicate()[0]
|
|
131
133
|
exitCode = process.returncode
|
|
132
|
-
|
|
133
134
|
result = "\n".join(lines)
|
|
134
135
|
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
if exitCode != 0:
|
|
139
|
+
|
|
140
|
+
if "ModuleNotFoundError" in result:
|
|
141
|
+
raise click.ClickException(
|
|
142
|
+
" It looks like you are missing a module in your container. Please make sure that you have all the dependencies installed in your container. The error is listed above."
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
raise click.ClickException(
|
|
149
|
+
"When running the command `arkitekt_next inspect implementations` we got an error. The error is listed above."
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
|
|
135
153
|
# Parse the JSON output
|
|
136
154
|
correct_part = result.split("--START_TEMPLATES--")[1].split(
|
|
137
155
|
"--END_TEMPLATES--"
|
|
@@ -158,7 +176,7 @@ def inspect_templates(build_id: str, url: str) -> list[ImplementationInput]:
|
|
|
158
176
|
raise InspectionError(f"An error occurred: {e.stdout + e.stderr}") from e
|
|
159
177
|
|
|
160
178
|
|
|
161
|
-
def inspect_requirements(build_id: str) ->
|
|
179
|
+
def inspect_requirements(build_id: str) -> List[RequirementInput]:
|
|
162
180
|
try:
|
|
163
181
|
# Run 'docker inspect' with the container ID or name
|
|
164
182
|
result = subprocess.run(
|
|
@@ -205,10 +223,10 @@ def inspect_requirements(build_id: str) -> Dict[str, Requirement]:
|
|
|
205
223
|
|
|
206
224
|
def inspect_build(build_id: str, url: str) -> InspectionInput:
|
|
207
225
|
size, size_root_fs = inspect_docker_container(build_id)
|
|
208
|
-
|
|
226
|
+
implementations = inspect_implementations(build_id, url)
|
|
209
227
|
requirements = inspect_requirements(build_id)
|
|
210
228
|
|
|
211
|
-
return InspectionInput(size=size,
|
|
229
|
+
return InspectionInput(size=size, implementations=tuple(implementations), requirements=tuple(requirements))
|
|
212
230
|
|
|
213
231
|
|
|
214
232
|
def get_flavours(ctx: Context, select: Optional[str] = None) -> Dict[str, Flavour]:
|
|
@@ -223,7 +241,7 @@ def get_flavours(ctx: Context, select: Optional[str] = None) -> Dict[str, Flavou
|
|
|
223
241
|
"We could not find the flavours folder. Please run `arkitekt_next port init` first to create a buildable flavour"
|
|
224
242
|
)
|
|
225
243
|
|
|
226
|
-
flavours = {}
|
|
244
|
+
flavours: Dict[str, Flavour] = {}
|
|
227
245
|
|
|
228
246
|
for dir_name in os.listdir(flavours_folder):
|
|
229
247
|
dir = os.path.join(flavours_folder, dir_name)
|
|
@@ -283,7 +301,7 @@ def build(
|
|
|
283
301
|
ctx: Context,
|
|
284
302
|
flavour: str,
|
|
285
303
|
no_inspect: bool,
|
|
286
|
-
tag: str = None,
|
|
304
|
+
tag: str | None = None,
|
|
287
305
|
url: str = DEFAULT_ARKITEKT_URL,
|
|
288
306
|
) -> None:
|
|
289
307
|
"""Builds the arkitekt_next app to docker"""
|
|
@@ -303,7 +321,7 @@ def build(
|
|
|
303
321
|
|
|
304
322
|
build_run = str(uuid.uuid4())
|
|
305
323
|
|
|
306
|
-
for key,
|
|
324
|
+
for key, inspected_flavour in flavours.items():
|
|
307
325
|
md = Panel(
|
|
308
326
|
"Building Flavour [bold]{}[/bold]".format(key),
|
|
309
327
|
subtitle="This may take a while...",
|
|
@@ -311,7 +329,7 @@ def build(
|
|
|
311
329
|
)
|
|
312
330
|
console.print(md)
|
|
313
331
|
|
|
314
|
-
build_tag = build_flavour(key,
|
|
332
|
+
build_tag = build_flavour(key, inspected_flavour)
|
|
315
333
|
|
|
316
334
|
if tag:
|
|
317
335
|
subprocess.run(["docker", "tag", build_tag, tag], check=True)
|
|
@@ -320,7 +338,7 @@ def build(
|
|
|
320
338
|
if not no_inspect:
|
|
321
339
|
inspection = inspect_build(build_tag, url)
|
|
322
340
|
|
|
323
|
-
generate_build(build_run, build_tag, key,
|
|
341
|
+
generate_build(build_run, build_tag, key, inspected_flavour, manifest, inspection)
|
|
324
342
|
|
|
325
343
|
md = Panel(
|
|
326
344
|
"Built Flavour [bold]{}[/bold]".format(key),
|
|
@@ -119,7 +119,7 @@ def generate_build(
|
|
|
119
119
|
with open(config_file, "w") as file:
|
|
120
120
|
yaml.safe_dump(
|
|
121
121
|
json.loads(
|
|
122
|
-
config.
|
|
122
|
+
config.model_dump_json(exclude_none=True, exclude_unset=True, by_alias=True)
|
|
123
123
|
),
|
|
124
124
|
file,
|
|
125
125
|
sort_keys=True,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
from functools import partial
|
|
1
2
|
from importlib import import_module, reload
|
|
2
3
|
import asyncio
|
|
4
|
+
|
|
5
|
+
from click import Context
|
|
3
6
|
from arkitekt_next import App
|
|
4
7
|
from watchfiles import awatch, Change
|
|
5
8
|
from rich.panel import Panel
|
|
@@ -165,10 +168,40 @@ def is_entrypoint_change(
|
|
|
165
168
|
return False
|
|
166
169
|
|
|
167
170
|
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def callback(console: Console, future: asyncio.Task[None]):
|
|
174
|
+
if future.cancelled():
|
|
175
|
+
return
|
|
176
|
+
else:
|
|
177
|
+
has_exception = future.exception()
|
|
178
|
+
|
|
179
|
+
if not has_exception:
|
|
180
|
+
panel = Panel(
|
|
181
|
+
"App finished running", style="bold yellow", border_style="yellow"
|
|
182
|
+
)
|
|
183
|
+
console.print(panel)
|
|
184
|
+
else:
|
|
185
|
+
try:
|
|
186
|
+
raise has_exception
|
|
187
|
+
except Exception:
|
|
188
|
+
console.print_exception()
|
|
189
|
+
panel = Panel(
|
|
190
|
+
"Error running App", style="bold red", border_style="red"
|
|
191
|
+
)
|
|
192
|
+
console.print(panel)
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
168
201
|
async def run_dev(
|
|
169
202
|
console: Console,
|
|
170
203
|
manifest: Manifest,
|
|
171
|
-
version=None,
|
|
204
|
+
version: str | None =None,
|
|
172
205
|
builder: str = "arkitekt_next.builders.easy",
|
|
173
206
|
deep: bool = False,
|
|
174
207
|
**builder_kwargs,
|
|
@@ -209,26 +242,10 @@ async def run_dev(
|
|
|
209
242
|
console.print(panel)
|
|
210
243
|
module = None
|
|
211
244
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
has_exception = future.exception()
|
|
217
|
-
|
|
218
|
-
if not has_exception:
|
|
219
|
-
panel = Panel(
|
|
220
|
-
"App finished running", style="bold yellow", border_style="yellow"
|
|
221
|
-
)
|
|
222
|
-
console.print(panel)
|
|
223
|
-
else:
|
|
224
|
-
try:
|
|
225
|
-
raise has_exception
|
|
226
|
-
except Exception:
|
|
227
|
-
console.print_exception()
|
|
228
|
-
panel = Panel(
|
|
229
|
-
"Error running App", style="bold red", border_style="red"
|
|
230
|
-
)
|
|
231
|
-
console.print(panel)
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
current_run: asyncio.Future[None] | None = None
|
|
248
|
+
# This is the main task that is running the app
|
|
232
249
|
|
|
233
250
|
try:
|
|
234
251
|
app: App = builder_func(
|
|
@@ -241,14 +258,16 @@ async def run_dev(
|
|
|
241
258
|
panel = Panel(group, style="bold green", border_style="green")
|
|
242
259
|
console.print(panel)
|
|
243
260
|
|
|
244
|
-
|
|
245
|
-
|
|
261
|
+
current_run = asyncio.create_task(run_app(app))
|
|
262
|
+
current_run.add_done_callback(partial(callback, console))
|
|
246
263
|
except Exception:
|
|
247
264
|
console.print_exception()
|
|
248
265
|
panel = Panel(
|
|
249
266
|
"Error building initial App", style="bold red", border_style="red"
|
|
250
267
|
)
|
|
251
268
|
console.print(panel)
|
|
269
|
+
|
|
270
|
+
|
|
252
271
|
|
|
253
272
|
async for changes in awatch(
|
|
254
273
|
".",
|
|
@@ -257,9 +276,12 @@ async def run_dev(
|
|
|
257
276
|
step=500,
|
|
258
277
|
):
|
|
259
278
|
if deep:
|
|
279
|
+
#
|
|
260
280
|
to_be_reloaded = check_deeps(changes)
|
|
261
281
|
if not to_be_reloaded:
|
|
262
282
|
continue
|
|
283
|
+
else:
|
|
284
|
+
to_be_reloaded: Set[str] = set()
|
|
263
285
|
|
|
264
286
|
group = construct_changes_group(changes)
|
|
265
287
|
panel = Panel(group, style="bold blue", border_style="blue")
|
|
@@ -267,17 +289,17 @@ async def run_dev(
|
|
|
267
289
|
|
|
268
290
|
console.print(panel)
|
|
269
291
|
# Cancelling the app
|
|
270
|
-
if not
|
|
292
|
+
if not current_run or current_run.done():
|
|
271
293
|
pass
|
|
272
294
|
|
|
273
295
|
else:
|
|
274
|
-
|
|
296
|
+
current_run.cancel()
|
|
275
297
|
panel = Panel(
|
|
276
298
|
"Cancelling latest version", style="bold yellow", border_style="yellow"
|
|
277
299
|
)
|
|
278
300
|
console.print(panel)
|
|
279
301
|
try:
|
|
280
|
-
await
|
|
302
|
+
await current_run
|
|
281
303
|
|
|
282
304
|
except asyncio.CancelledError:
|
|
283
305
|
pass
|
|
@@ -293,6 +315,8 @@ async def run_dev(
|
|
|
293
315
|
if deep:
|
|
294
316
|
reload_modules(to_be_reloaded)
|
|
295
317
|
else:
|
|
318
|
+
|
|
319
|
+
|
|
296
320
|
reload(module)
|
|
297
321
|
except Exception:
|
|
298
322
|
console.print_exception()
|
|
@@ -315,8 +339,8 @@ async def run_dev(
|
|
|
315
339
|
panel = Panel(group, style="bold green", border_style="green")
|
|
316
340
|
console.print(panel)
|
|
317
341
|
|
|
318
|
-
|
|
319
|
-
|
|
342
|
+
current_run = asyncio.create_task(run_app(app))
|
|
343
|
+
current_run.add_done_callback(partial(callback, console))
|
|
320
344
|
except Exception:
|
|
321
345
|
console.print_exception()
|
|
322
346
|
panel = Panel(
|
|
@@ -340,7 +364,7 @@ async def run_dev(
|
|
|
340
364
|
is_flag=True,
|
|
341
365
|
)
|
|
342
366
|
@click.pass_context
|
|
343
|
-
def dev(ctx, **kwargs):
|
|
367
|
+
def dev(ctx: Context, **kwargs):
|
|
344
368
|
"""Runs the app in dev mode (with hot reloading)
|
|
345
369
|
|
|
346
370
|
Running the app in dev mode will automatically reload the app when changes are detected.
|
|
@@ -4,6 +4,20 @@ from arkitekt_next.apps.protocols import App
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
def import_builder(builder: str) -> Callable[..., App]:
|
|
7
|
+
""" Import a builder function from a module.
|
|
8
|
+
|
|
9
|
+
Parameters
|
|
10
|
+
----------
|
|
11
|
+
builder : str
|
|
12
|
+
The builder function to import, in the format "module.function".
|
|
13
|
+
|
|
14
|
+
Returns
|
|
15
|
+
-------
|
|
16
|
+
Callable[..., App]
|
|
17
|
+
The imported builder function.
|
|
18
|
+
|
|
19
|
+
"""
|
|
20
|
+
|
|
7
21
|
module_path, function_name = builder.rsplit(".", 1)
|
|
8
22
|
module = import_module(module_path)
|
|
9
23
|
function = getattr(module, function_name)
|
|
@@ -68,7 +68,7 @@ def write_manifest(manifest: Manifest):
|
|
|
68
68
|
|
|
69
69
|
with open(config_file, "w") as file:
|
|
70
70
|
yaml.safe_dump(
|
|
71
|
-
json.loads(manifest.
|
|
71
|
+
json.loads(manifest.model_dump_json(exclude_none=True, exclude_unset=True)),
|
|
72
72
|
file,
|
|
73
73
|
sort_keys=True,
|
|
74
74
|
)
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import contextvars
|
|
2
|
+
from functools import wraps
|
|
3
|
+
from typing import Callable, Dict, Optional, TypeVar, overload
|
|
4
|
+
from arkitekt_next.apps.protocols import App
|
|
5
|
+
|
|
6
|
+
Params = Dict[str, str]
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
current_init_hook_registry = contextvars.ContextVar(
|
|
10
|
+
"current_init_hook_registry", default=None
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
InitHook = Callable[[App], None]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class InitHookRegistry:
|
|
19
|
+
""" A registry for init hooks. This is used to register init hooks that
|
|
20
|
+
are called when the app is initialized. The init hooks are called in
|
|
21
|
+
the order they are registered
|
|
22
|
+
|
|
23
|
+
The purpose of init hooks is to allow specific initialization
|
|
24
|
+
code to be run when the app is initialized. This is useful if you
|
|
25
|
+
plan to add some custom configuration or setup code that needs to be
|
|
26
|
+
run before the app is getting conneted to the server.
|
|
27
|
+
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def __init__(self):
|
|
33
|
+
self.init_hooks: Dict[str, InitHook] = {}
|
|
34
|
+
self.cli_only_hooks: Dict[str, InitHook] = {}
|
|
35
|
+
|
|
36
|
+
def register(
|
|
37
|
+
self,
|
|
38
|
+
function: InitHook,
|
|
39
|
+
name: Optional[str] = None,
|
|
40
|
+
only_cli: bool = False,
|
|
41
|
+
):
|
|
42
|
+
""" Register a function as an init hook. This function will be called
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
when the app is initialized. The init hooks are called in the order
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
if name is None:
|
|
51
|
+
name = function.__name__
|
|
52
|
+
|
|
53
|
+
if only_cli:
|
|
54
|
+
if name not in self.cli_only_hooks:
|
|
55
|
+
self.cli_only_hooks[name] = function
|
|
56
|
+
else:
|
|
57
|
+
raise ValueError(f"CLI Hook {name} already registered")
|
|
58
|
+
|
|
59
|
+
if name not in self.init_hooks:
|
|
60
|
+
self.init_hooks[name] = function
|
|
61
|
+
else:
|
|
62
|
+
raise ValueError(f"Init Hook {name} already registered")
|
|
63
|
+
|
|
64
|
+
def run_all(self, app: App, is_cli: bool = False):
|
|
65
|
+
for hook in self.init_hooks.values():
|
|
66
|
+
hook(app)
|
|
67
|
+
|
|
68
|
+
if is_cli:
|
|
69
|
+
for hook in self.cli_only_hooks.values():
|
|
70
|
+
hook(app)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
T = TypeVar("T", bound=InitHook)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@overload
|
|
77
|
+
def init(func: T) -> T: ...
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@overload
|
|
81
|
+
def init(*, only_cli: bool = False, init_hook_registry: InitHookRegistry | None = None) -> Callable[[T], T]: ...
|
|
82
|
+
|
|
83
|
+
def init(
|
|
84
|
+
func: T | None = None,
|
|
85
|
+
*,
|
|
86
|
+
only_cli: bool = False,
|
|
87
|
+
init_hook_registry: InitHookRegistry | None = None,
|
|
88
|
+
) -> T | Callable[[T], T]:
|
|
89
|
+
"""Register a function as an init hook. This function will be called when the app is initialized."""
|
|
90
|
+
init_hook_registry = init_hook_registry or get_default_init_hook_registry()
|
|
91
|
+
|
|
92
|
+
if func is not None:
|
|
93
|
+
init_hook_registry.register(func, only_cli=only_cli)
|
|
94
|
+
setattr(func, "__is_init_hook__", True)
|
|
95
|
+
return func
|
|
96
|
+
|
|
97
|
+
def decorator(inner: T) -> T:
|
|
98
|
+
@wraps(inner)
|
|
99
|
+
def wrapped(app: App):
|
|
100
|
+
return inner(app)
|
|
101
|
+
|
|
102
|
+
init_hook_registry.register(wrapped, only_cli=only_cli)
|
|
103
|
+
setattr(inner, "__is_init_hook__", True)
|
|
104
|
+
return inner
|
|
105
|
+
|
|
106
|
+
return decorator
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
GLOBAL_INIT_HOOK_REGISTRY = None
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def get_default_init_hook_registry():
|
|
114
|
+
global GLOBAL_INIT_HOOK_REGISTRY
|
|
115
|
+
if GLOBAL_INIT_HOOK_REGISTRY is None:
|
|
116
|
+
GLOBAL_INIT_HOOK_REGISTRY = InitHookRegistry() # type: ignore
|
|
117
|
+
return GLOBAL_INIT_HOOK_REGISTRY
|