arkitekt-next 0.7.8__py3-none-any.whl → 0.7.10__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.

@@ -20,9 +20,9 @@ from herre import Herre
20
20
  logger = logging.getLogger(__name__)
21
21
 
22
22
 
23
-
24
23
  class App(Composition):
25
24
  """An app that is built with the easy builder"""
25
+
26
26
  fakts: Fakts
27
27
  herre: Herre
28
28
  manifest: Manifest
@@ -32,22 +32,13 @@ class App(Composition):
32
32
  """Run the app"""
33
33
  self.services["rekuest"].run()
34
34
 
35
-
36
35
  async def __aenter__(self):
37
36
  await super().__aenter__()
38
- print("Entering")
39
37
  for service in self.services.values():
40
38
  await service.__aenter__()
41
39
 
42
40
  return self
43
41
 
44
-
45
42
  async def __aexit__(self, exc_type, exc_value, traceback):
46
43
  for service in self.services.values():
47
44
  await service.__aexit__(exc_type, exc_value, traceback)
48
-
49
-
50
-
51
-
52
-
53
-
arkitekt_next/builders.py CHANGED
@@ -2,14 +2,17 @@ from typing import List, Optional
2
2
  import logging
3
3
  import os
4
4
 
5
- from arkitekt_next.apps.service.fakts_next import build_arkitekt_next_fakts_next, build_arkitekt_next_redeem_fakts_next
5
+ from arkitekt_next.apps.service.fakts_next import (
6
+ build_arkitekt_next_fakts_next,
7
+ build_arkitekt_next_redeem_fakts_next,
8
+ )
6
9
  from arkitekt_next.apps.service.herre import build_arkitekt_next_herre
7
10
  from arkitekt_next.apps.service.fakts_qt import build_arkitekt_next_qt_fakts
8
11
  from arkitekt_next.apps.service.herre_qt import build_arkitekt_next_qt_herre
9
12
  from .utils import create_arkitekt_next_folder
10
13
  from .model import Manifest
11
14
  from .apps.types import App
12
- from .service_registry import ServiceBuilderRegistry, get_default_service_builder_registry
15
+ from .service_registry import ServiceBuilderRegistry, check_and_import_services
13
16
  from arkitekt_next.constants import DEFAULT_ARKITEKT_URL
14
17
  from qtpy import QtWidgets, QtCore
15
18
 
@@ -95,8 +98,7 @@ def easy(
95
98
  NextApp
96
99
  A built app, that can be used to interact with the ArkitektNext server
97
100
  """
98
- registry = registry or get_default_service_builder_registry()
99
-
101
+ registry = registry or check_and_import_services()
100
102
 
101
103
  manifest = Manifest(
102
104
  version=version,
@@ -106,7 +108,6 @@ def easy(
106
108
  requirements=registry.get_requirements(),
107
109
  )
108
110
 
109
-
110
111
  if redeem_token:
111
112
  fakts = build_arkitekt_next_redeem_fakts_next(
112
113
  manifest=manifest,
@@ -128,15 +129,11 @@ def easy(
128
129
 
129
130
  params = kwargs
130
131
 
131
-
132
-
133
132
  url = os.getenv("FAKTS_URL", url)
134
133
  token = os.getenv("FAKTS_TOKEN", token)
135
134
 
136
135
  create_arkitekt_next_folder(with_cache=True)
137
136
 
138
-
139
-
140
137
  try:
141
138
  from rich.logging import RichHandler
142
139
 
@@ -144,8 +141,6 @@ def easy(
144
141
  except ImportError:
145
142
  logging.basicConfig(level=log_level)
146
143
 
147
- print(registry.service_builders)
148
-
149
144
  app = App(
150
145
  fakts=fakts,
151
146
  herre=herre,
@@ -155,12 +150,9 @@ def easy(
155
150
 
156
151
  print()
157
152
 
158
-
159
153
  return app
160
154
 
161
155
 
162
-
163
-
164
156
  def publicqt(
165
157
  identifier: str,
166
158
  version: str = "latest",
@@ -175,10 +167,10 @@ def publicqt(
175
167
  redeem_token: Optional[str] = None,
176
168
  app_kind: str = "desktop",
177
169
  registry: Optional[ServiceBuilderRegistry] = None,
178
- parent: Optional[QtWidgets.QWidget] =None,
179
- beacon_widget: Optional[QtWidgets.QWidget]=None,
180
- login_widget: Optional[QtWidgets.QWidget]=None,
181
- settings: Optional[QtCore.QSettings]=None,
170
+ parent: Optional[QtWidgets.QWidget] = None,
171
+ beacon_widget: Optional[QtWidgets.QWidget] = None,
172
+ login_widget: Optional[QtWidgets.QWidget] = None,
173
+ settings: Optional[QtCore.QSettings] = None,
182
174
  **kwargs,
183
175
  ) -> App:
184
176
  """Public QtApp creation
@@ -196,10 +188,7 @@ def publicqt(
196
188
  Arkitekt: The Arkitekt app
197
189
  """
198
190
 
199
- from arkitekt.apps.qt import build_arkitekt_qt_app
200
-
201
- registry = registry or get_default_service_builder_registry()
202
-
191
+ registry = registry or check_and_import_services()
203
192
 
204
193
  manifest = Manifest(
205
194
  version=version,
@@ -209,7 +198,6 @@ def publicqt(
209
198
  requirements=registry.get_requirements(),
210
199
  )
211
200
 
212
-
213
201
  if redeem_token:
214
202
  fakts = build_arkitekt_next_redeem_fakts_next(
215
203
  manifest=manifest,
@@ -228,19 +216,21 @@ def publicqt(
228
216
  settings=settings,
229
217
  )
230
218
 
231
- herre = build_arkitekt_next_qt_herre(manifest=manifest, fakts=fakts, login_widget=login_widget, parent=parent, settings=settings)
219
+ herre = build_arkitekt_next_qt_herre(
220
+ manifest=manifest,
221
+ fakts=fakts,
222
+ login_widget=login_widget,
223
+ parent=parent,
224
+ settings=settings,
225
+ )
232
226
 
233
227
  params = kwargs
234
228
 
235
-
236
-
237
229
  url = os.getenv("FAKTS_URL", url)
238
230
  token = os.getenv("FAKTS_TOKEN", token)
239
231
 
240
232
  create_arkitekt_next_folder(with_cache=True)
241
233
 
242
-
243
-
244
234
  try:
245
235
  from rich.logging import RichHandler
246
236
 
@@ -248,8 +238,6 @@ def publicqt(
248
238
  except ImportError:
249
239
  logging.basicConfig(level=log_level)
250
240
 
251
- print(registry.service_builders)
252
-
253
241
  app = App(
254
242
  fakts=fakts,
255
243
  herre=herre,
@@ -257,8 +245,5 @@ def publicqt(
257
245
  services=registry.build_service_map(fakts=fakts, herre=herre, params=params),
258
246
  )
259
247
 
260
- print()
261
-
262
-
263
248
  app.enter()
264
249
  return app
@@ -100,6 +100,9 @@ async def run_app(app: App) -> None:
100
100
  """
101
101
 
102
102
  rekuest = app.services.get("rekuest")
103
+ if not rekuest:
104
+ raise Exception("No rekuest service found. We need this to run the app.")
105
+
103
106
  async with app:
104
107
  await rekuest.run()
105
108
 
@@ -6,9 +6,12 @@ from importlib import import_module
6
6
  from .utils import import_builder
7
7
  from arkitekt_next.constants import DEFAULT_ARKITEKT_URL
8
8
 
9
+
9
10
  async def run_app(app):
11
+ rekuest = app.services.get("rekuest")
12
+
10
13
  async with app:
11
- await app.rekuest.run()
14
+ await rekuest.run()
12
15
 
13
16
 
14
17
  @click.command("prod")
@@ -1,4 +1,4 @@
1
- from arkitekt_next_next import register
1
+ from arkitekt_next import register
2
2
  from mikro.api.schema import RepresentationFragment, from_xarray
3
3
 
4
4
 
@@ -1,4 +1,4 @@
1
- from arkitekt_next_next import register
1
+ from arkitekt_next import register
2
2
  import time
3
3
 
4
4
 
arkitekt_next/cli/ui.py CHANGED
@@ -56,15 +56,21 @@ def construct_app_group(app: App) -> Group:
56
56
  panel_header = f"Running App \n\n{app.manifest.identifier}:{app.manifest.version}\n"
57
57
 
58
58
  actor_tree = Tree("Registered Definitions", style="white not bold")
59
- panel_group = Group(panel_header, actor_tree)
59
+ service_tree = Tree("Depends on services", style="white not bold")
60
+
61
+ for key, extension in app.services.items():
62
+ service_tree.add(key)
60
63
 
61
64
  rekuest = app.services.get("rekuest")
65
+ if rekuest is None:
66
+ return Group(panel_header, service_tree)
62
67
 
63
68
  for key, extension in rekuest.agent.extensions.items():
64
69
  tree = actor_tree.add(key)
65
70
  for template in extension.definition_registry.templates.values():
66
71
  tree.add(template.interface + "-" + template.definition.name)
67
72
 
73
+ panel_group = Group(panel_header, service_tree, actor_tree)
68
74
 
69
75
  return panel_group
70
76
 
@@ -3,7 +3,12 @@ from herre import Herre
3
3
  from fakts import Fakts
4
4
  from .model import Requirement
5
5
  from typing import Callable, Dict
6
-
6
+ import importlib
7
+ import sys
8
+ import os
9
+ import traceback
10
+ import logging
11
+ import pkgutil
7
12
 
8
13
  Params = Dict[str, str]
9
14
 
@@ -43,9 +48,52 @@ class ServiceBuilderRegistry:
43
48
 
44
49
 
45
50
 
46
- service_builder_registry = ServiceBuilderRegistry()
47
51
 
48
52
 
49
- def get_default_service_builder_registry():
50
- return service_builder_registry
53
+
54
+ class SetupInfo:
55
+ services: Dict[str, object]
56
+
57
+
58
+
59
+ def check_and_import_services() -> ServiceBuilderRegistry:
60
+
61
+ service_builder_registry = ServiceBuilderRegistry()
51
62
 
63
+ # Function to load and call init_extensions from __rekuest__.py
64
+ def load_and_call_init_extensions(module_name, rekuest_path):
65
+ try:
66
+ spec = importlib.util.spec_from_file_location(f"{module_name}.__arkitekt__", rekuest_path)
67
+ rekuest_module = importlib.util.module_from_spec(spec)
68
+ spec.loader.exec_module(rekuest_module)
69
+ if hasattr(rekuest_module, 'init_services'):
70
+ rekuest_module.init_services(service_builder_registry)
71
+ logging.info(f"Called init_service function from {module_name}")
72
+ else:
73
+ print(f"No init_services function in {module_name}.__arkitekt__")
74
+ except Exception as e:
75
+ print(f"Failed to call init_services for {module_name}: {e}")
76
+ traceback.print_exc()
77
+
78
+ # Check local modules in the current working directory
79
+ current_directory = os.getcwd()
80
+ for item in os.listdir(current_directory):
81
+ item_path = os.path.join(current_directory, item)
82
+ if os.path.isdir(item_path) and os.path.isfile(os.path.join(item_path, '__init__.py')):
83
+ rekuest_path = os.path.join(item_path, '__arkitekt__.py')
84
+ if os.path.isfile(rekuest_path):
85
+ load_and_call_init_extensions(item, rekuest_path)
86
+
87
+ # Check installed packages
88
+ for _, module_name, _ in pkgutil.iter_modules():
89
+ try:
90
+ module_spec = importlib.util.find_spec(module_name)
91
+ if module_spec and module_spec.origin:
92
+ rekuest_path = os.path.join(os.path.dirname(module_spec.origin), '__arkitekt__.py')
93
+ if os.path.isfile(rekuest_path):
94
+ load_and_call_init_extensions(module_name, rekuest_path)
95
+ except Exception as e:
96
+ print(f"Failed to call init_extensions for installed package {module_name}: {e}")
97
+ traceback.print_exc()
98
+
99
+ return service_builder_registry
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: arkitekt-next
3
- Version: 0.7.8
3
+ Version: 0.7.10
4
4
  Summary: client for the arkitekt_next platform
5
5
  License: MIT
6
6
  Author: jhnnsrs
@@ -15,8 +15,8 @@ arkitekt_next/apps/service/kabinet.py,sha256=OocZHxcw8kGrziz1LlF1cmWTs2JNXyHR_qY
15
15
  arkitekt_next/apps/service/mikro_next.py,sha256=j612M2wo4EdaKp13qx_8eqQsB6wc5nE_Lhn28BpvnzA,2441
16
16
  arkitekt_next/apps/service/rekuest_next.py,sha256=RiNN5rzDbq15AgyVpv-3tjkSO6TeO2xsuEvGTYmB2UQ,1816
17
17
  arkitekt_next/apps/service/unlok_next.py,sha256=u3cjFr1i6kHjH881oj_NBmY1CgnM0uqdDbicq-SilPM,1124
18
- arkitekt_next/apps/types.py,sha256=F65TJDPac1eILpgX1WE35i84F_RwD6qeIihu9JbE3EI,1178
19
- arkitekt_next/builders.py,sha256=FXYSpP12P7yLhDj9YRVMEtxRASr78U2Wyjy8vMzWhyQ,8830
18
+ arkitekt_next/apps/types.py,sha256=uozRXDDGJBL9hYCYGZF_XmtZ4ZvoLZeEEfJeL10Ve3U,1136
19
+ arkitekt_next/builders.py,sha256=2wh7cJARQawfstITaNGquRZUB8-dSDsYxyg5NOUzCIc,8695
20
20
  arkitekt_next/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  arkitekt_next/cli/commands/call/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  arkitekt_next/cli/commands/call/local.py,sha256=YDummInGSb6lGKGiTlMSuXbE-Sz6dbfng6CsZaChCew,3338
@@ -49,9 +49,9 @@ arkitekt_next/cli/commands/port/utils.py,sha256=x27qR7ksCuvASHkEAEaDuUAeuzjrZpzI
49
49
  arkitekt_next/cli/commands/port/validate.py,sha256=MSSuwjdJKDtXB6rkjRmG-PPK6cVwTcOuCRpgPDQ0uVg,2490
50
50
  arkitekt_next/cli/commands/port/wizard.py,sha256=vbW-EAitypCl1HRjsgHRuwc18hQgOzAU8C__6SWuAzQ,9148
51
51
  arkitekt_next/cli/commands/run/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
- arkitekt_next/cli/commands/run/dev.py,sha256=HI1djLeaRPn0hXviT0RaQIE0enZQ0zqsbkdV0Sg1do0,9888
52
+ arkitekt_next/cli/commands/run/dev.py,sha256=KRcAHM-MCsy2-Wv2UIONCzdezEF214rEVbRPWec33FE,9991
53
53
  arkitekt_next/cli/commands/run/main.py,sha256=0bNO3DqwbZ4ddMsDWbCGmlPD6Cs3Jlg4yh2-zilsEbY,552
54
- arkitekt_next/cli/commands/run/prod.py,sha256=MQDh2A5QOXHrAvOjS2Zb9j6-rKAzVjfDNn9SfKVXRzc,1473
54
+ arkitekt_next/cli/commands/run/prod.py,sha256=5GmZayfvYvKqSYWmicT1hhadq2hFJ-q8taEL17qKK78,1513
55
55
  arkitekt_next/cli/commands/run/utils.py,sha256=zH-MNNEfKgyOYQvwP6Ph8KUHVqH48fw3ZI6tiQ9unwQ,325
56
56
  arkitekt_next/cli/commands/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
57
  arkitekt_next/cli/commands/server/down.py,sha256=POFe9OtzhSdlwWY7JBakGqVDZvQ9LrsiFDRSik2Hn2U,1490
@@ -85,11 +85,11 @@ arkitekt_next/cli/schemas/port.schema.graphql,sha256=GqXwoiEhe-F-38OSs0RlEbtHQxA
85
85
  arkitekt_next/cli/schemas/rekuest.schema.graphql,sha256=9STewo6BBz0feHm0WYFWjn7jexYDD1CK3ZAJUoTFjyo,64225
86
86
  arkitekt_next/cli/schemas/rekuest_next.schema.graphql,sha256=LcYtS9AjTRlSBPllSImPN9hN-Pcr3Z2F3IJRn00eT5c,20177
87
87
  arkitekt_next/cli/schemas/unlok.schema.graphql,sha256=fXR846snIBIqkuQ-PlYnSkQjkFVmM6NVZLlcMKgbr8E,18216
88
- arkitekt_next/cli/templates/filter.py,sha256=KI0tEuHiHVCMD5PppZo2ABUPhwYXtctLJ_Mx0FSDFb4,655
89
- arkitekt_next/cli/templates/simple.py,sha256=RQwk8STfIY74-nb9YzkOWX2-SYY3jcGqHYgJonOZIVU,1176
88
+ arkitekt_next/cli/templates/filter.py,sha256=mD2jdNEXrZNagC_8WtuTisGJrGIbJDSylCvh19cF49I,650
89
+ arkitekt_next/cli/templates/simple.py,sha256=IbcThJ5LryXVFQUdzxfHQCtzSNxEQWTxbD__Ygxsp4M,1171
90
90
  arkitekt_next/cli/texts.py,sha256=csMefyCnwnvDnriTy0VJ4L24VFIbcXoC9ayopP4RxIc,697
91
91
  arkitekt_next/cli/types.py,sha256=0VUfoqnEZaf-LzWmBDYwa6IAG4FTx6Edj1cBOiHzF50,10409
92
- arkitekt_next/cli/ui.py,sha256=OF8Dy3MORxjZ8HMB4CF7RsVuTeIKiCeGItjnO3fRVk4,3256
92
+ arkitekt_next/cli/ui.py,sha256=BR_AOsBIIHwojI5otBzT_560-ep5Dw1xAHKsO2zOOJQ,3493
93
93
  arkitekt_next/cli/utils.py,sha256=rl1hfQIVzepLHPN_ZWuvfVH-IIVqcSfiFGyfNtL1XCo,445
94
94
  arkitekt_next/cli/validators.py,sha256=XkLrOrDzBJwcG1keTawa_NJPt3QIBhb5KjepeH4N1KA,719
95
95
  arkitekt_next/cli/vars.py,sha256=ev7cKDSPoik8hU9A_ohNpjRZX4FT1GYJaBoGLnxCKjU,982
@@ -109,11 +109,11 @@ arkitekt_next/qt/assets/light/pink pulse.gif,sha256=rxd6ZTHSIG9JZuuHhi3jiSB_JYFB
109
109
  arkitekt_next/qt/assets/light/red pulse.gif,sha256=U7WLbZvSl5e-Ob5RmawtlC0Rh9VVHxkjDbGjj7NYVUo,108749
110
110
  arkitekt_next/qt/magic_bar.py,sha256=xo4_ReVYtpCwnRFTMBYvBEcVvY3JnNFbqYYY_-ez6vM,18242
111
111
  arkitekt_next/qt/utils.py,sha256=MgBPtPmCSBkIuATov3UgREESwxAHh77lWNNxyE7Qs48,773
112
- arkitekt_next/service_registry.py,sha256=i-PWzEYla2LUyWKBSiJ23Dw9W0Ytue49WpuMeJ46ad8,1314
112
+ arkitekt_next/service_registry.py,sha256=Aq5bgu4UHRl1P6E2JOQ2gMCwFI8pQfASWte0BvtKE3g,3365
113
113
  arkitekt_next/tqdm.py,sha256=DlrxPluHao7TvW-Cqgt0UokRS-fM2_ZNiWiddqvCqCc,1488
114
114
  arkitekt_next/utils.py,sha256=WA3AtqQFcz2h-yOadAsQkkr0qKJmKcGMi2aclxaVI_o,1278
115
- arkitekt_next-0.7.8.dist-info/LICENSE,sha256=YZ2oRjC248t-GpoEyw7J13vwKYNG6zhYMaEAix6EzF0,1089
116
- arkitekt_next-0.7.8.dist-info/METADATA,sha256=Kw3xu_LzCTnuIbGRROOwS7mWPnkOUnyyvAmfUPu1-Xk,5217
117
- arkitekt_next-0.7.8.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
118
- arkitekt_next-0.7.8.dist-info/entry_points.txt,sha256=-hxikQx4xZ6TiOnWVDOlTN_kcAISgGFvTHXIchsCHSc,60
119
- arkitekt_next-0.7.8.dist-info/RECORD,,
115
+ arkitekt_next-0.7.10.dist-info/LICENSE,sha256=YZ2oRjC248t-GpoEyw7J13vwKYNG6zhYMaEAix6EzF0,1089
116
+ arkitekt_next-0.7.10.dist-info/METADATA,sha256=6_CPvEuorWERrxwJByvV-5hZrFb9w9UyL-Kzc75bKY8,5218
117
+ arkitekt_next-0.7.10.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
118
+ arkitekt_next-0.7.10.dist-info/entry_points.txt,sha256=-hxikQx4xZ6TiOnWVDOlTN_kcAISgGFvTHXIchsCHSc,60
119
+ arkitekt_next-0.7.10.dist-info/RECORD,,