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.

Files changed (119) hide show
  1. arkitekt_next/__init__.py +43 -0
  2. arkitekt_next/apps/__init__.py +3 -0
  3. arkitekt_next/apps/easy.py +99 -0
  4. arkitekt_next/apps/next.py +40 -0
  5. arkitekt_next/apps/qt.py +97 -0
  6. arkitekt_next/apps/service/__init__.py +3 -0
  7. arkitekt_next/apps/service/fakts.py +88 -0
  8. arkitekt_next/apps/service/fakts_next.py +79 -0
  9. arkitekt_next/apps/service/fakts_qt.py +82 -0
  10. arkitekt_next/apps/service/fluss_next.py +31 -0
  11. arkitekt_next/apps/service/grant_registry.py +27 -0
  12. arkitekt_next/apps/service/herre.py +24 -0
  13. arkitekt_next/apps/service/herre_qt.py +57 -0
  14. arkitekt_next/apps/service/kabinet.py +31 -0
  15. arkitekt_next/apps/service/mikro_next.py +81 -0
  16. arkitekt_next/apps/service/rekuest_next.py +53 -0
  17. arkitekt_next/apps/service/unlok_next.py +32 -0
  18. arkitekt_next/apps/types.py +53 -0
  19. arkitekt_next/builders.py +264 -0
  20. arkitekt_next/cli/__init__.py +0 -0
  21. arkitekt_next/cli/commands/call/__init__.py +0 -0
  22. arkitekt_next/cli/commands/call/local.py +132 -0
  23. arkitekt_next/cli/commands/call/main.py +22 -0
  24. arkitekt_next/cli/commands/call/remote.py +90 -0
  25. arkitekt_next/cli/commands/gen/__init__.py +0 -0
  26. arkitekt_next/cli/commands/gen/compile.py +45 -0
  27. arkitekt_next/cli/commands/gen/init.py +122 -0
  28. arkitekt_next/cli/commands/gen/main.py +29 -0
  29. arkitekt_next/cli/commands/gen/watch.py +32 -0
  30. arkitekt_next/cli/commands/init/__init__.py +0 -0
  31. arkitekt_next/cli/commands/init/main.py +194 -0
  32. arkitekt_next/cli/commands/inspect/__init__.py +0 -0
  33. arkitekt_next/cli/commands/inspect/definitions.py +53 -0
  34. arkitekt_next/cli/commands/inspect/main.py +22 -0
  35. arkitekt_next/cli/commands/inspect/variables.py +92 -0
  36. arkitekt_next/cli/commands/manifest/__init__.py +0 -0
  37. arkitekt_next/cli/commands/manifest/inspect.py +42 -0
  38. arkitekt_next/cli/commands/manifest/main.py +25 -0
  39. arkitekt_next/cli/commands/manifest/scopes.py +155 -0
  40. arkitekt_next/cli/commands/manifest/version.py +147 -0
  41. arkitekt_next/cli/commands/manifest/wizard.py +94 -0
  42. arkitekt_next/cli/commands/port/__init__.py +0 -0
  43. arkitekt_next/cli/commands/port/build.py +231 -0
  44. arkitekt_next/cli/commands/port/init.py +82 -0
  45. arkitekt_next/cli/commands/port/main.py +31 -0
  46. arkitekt_next/cli/commands/port/publish.py +102 -0
  47. arkitekt_next/cli/commands/port/stage.py +59 -0
  48. arkitekt_next/cli/commands/port/utils.py +47 -0
  49. arkitekt_next/cli/commands/port/validate.py +78 -0
  50. arkitekt_next/cli/commands/port/wizard.py +329 -0
  51. arkitekt_next/cli/commands/run/__init__.py +0 -0
  52. arkitekt_next/cli/commands/run/dev.py +349 -0
  53. arkitekt_next/cli/commands/run/main.py +22 -0
  54. arkitekt_next/cli/commands/run/prod.py +57 -0
  55. arkitekt_next/cli/commands/run/utils.py +10 -0
  56. arkitekt_next/cli/commands/server/__init__.py +0 -0
  57. arkitekt_next/cli/commands/server/down.py +56 -0
  58. arkitekt_next/cli/commands/server/init.py +74 -0
  59. arkitekt_next/cli/commands/server/inspect.py +59 -0
  60. arkitekt_next/cli/commands/server/main.py +33 -0
  61. arkitekt_next/cli/commands/server/open.py +66 -0
  62. arkitekt_next/cli/commands/server/remove.py +60 -0
  63. arkitekt_next/cli/commands/server/stop.py +56 -0
  64. arkitekt_next/cli/commands/server/up.py +70 -0
  65. arkitekt_next/cli/commands/server/utils.py +33 -0
  66. arkitekt_next/cli/configs/base.yaml +867 -0
  67. arkitekt_next/cli/constants.py +63 -0
  68. arkitekt_next/cli/dockerfiles/vanilla.dockerfile +8 -0
  69. arkitekt_next/cli/errors.py +4 -0
  70. arkitekt_next/cli/inspect.py +1 -0
  71. arkitekt_next/cli/io.py +255 -0
  72. arkitekt_next/cli/main.py +83 -0
  73. arkitekt_next/cli/options.py +166 -0
  74. arkitekt_next/cli/schemas/fluss.schema.graphql +2446 -0
  75. arkitekt_next/cli/schemas/gucker.schema.graphql +8908 -0
  76. arkitekt_next/cli/schemas/kabinet.schema.graphql +515 -0
  77. arkitekt_next/cli/schemas/kluster.schema.graphql +109 -0
  78. arkitekt_next/cli/schemas/konviktion.schema.graphql +70 -0
  79. arkitekt_next/cli/schemas/kuay.schema.graphql +356 -0
  80. arkitekt_next/cli/schemas/mikro.schema.graphql +8908 -0
  81. arkitekt_next/cli/schemas/mikro_next.schema.graphql +1639 -0
  82. arkitekt_next/cli/schemas/napari.schema.graphql +8908 -0
  83. arkitekt_next/cli/schemas/omero_ark.schema.graphql +100 -0
  84. arkitekt_next/cli/schemas/port.schema.graphql +356 -0
  85. arkitekt_next/cli/schemas/rekuest.schema.graphql +4630 -0
  86. arkitekt_next/cli/schemas/rekuest_next.schema.graphql +1159 -0
  87. arkitekt_next/cli/schemas/unlok.schema.graphql +1013 -0
  88. arkitekt_next/cli/templates/filter.py +26 -0
  89. arkitekt_next/cli/templates/simple.py +67 -0
  90. arkitekt_next/cli/texts.py +20 -0
  91. arkitekt_next/cli/types.py +365 -0
  92. arkitekt_next/cli/ui.py +111 -0
  93. arkitekt_next/cli/utils.py +15 -0
  94. arkitekt_next/cli/validators.py +17 -0
  95. arkitekt_next/cli/vars.py +39 -0
  96. arkitekt_next/cli/versions/v1.yaml +1 -0
  97. arkitekt_next/constants.py +6 -0
  98. arkitekt_next/model.py +110 -0
  99. arkitekt_next/qt/__init__.py +9 -0
  100. arkitekt_next/qt/assets/dark/gear.png +0 -0
  101. arkitekt_next/qt/assets/dark/green pulse.gif +0 -0
  102. arkitekt_next/qt/assets/dark/orange pulse.gif +0 -0
  103. arkitekt_next/qt/assets/dark/pink pulse.gif +0 -0
  104. arkitekt_next/qt/assets/dark/red pulse.gif +0 -0
  105. arkitekt_next/qt/assets/light/gear.png +0 -0
  106. arkitekt_next/qt/assets/light/green pulse.gif +0 -0
  107. arkitekt_next/qt/assets/light/orange pulse.gif +0 -0
  108. arkitekt_next/qt/assets/light/pink pulse.gif +0 -0
  109. arkitekt_next/qt/assets/light/red pulse.gif +0 -0
  110. arkitekt_next/qt/magic_bar.py +545 -0
  111. arkitekt_next/qt/utils.py +30 -0
  112. arkitekt_next/service_registry.py +51 -0
  113. arkitekt_next/tqdm.py +43 -0
  114. arkitekt_next/utils.py +38 -0
  115. arkitekt_next-0.7.8.dist-info/LICENSE +21 -0
  116. arkitekt_next-0.7.8.dist-info/METADATA +155 -0
  117. arkitekt_next-0.7.8.dist-info/RECORD +119 -0
  118. arkitekt_next-0.7.8.dist-info/WHEEL +4 -0
  119. arkitekt_next-0.7.8.dist-info/entry_points.txt +3 -0
@@ -0,0 +1,43 @@
1
+ def missing_install(name: str, error: Exception):
2
+ def real_missing_install(*args, **kwargs):
3
+ raise ImportError(
4
+ f"Missing import: {name}. Please install the missing package. "
5
+ ) from error
6
+
7
+ return real_missing_install
8
+
9
+
10
+ try:
11
+ from rekuest_next.register import register
12
+ from rekuest_next.agents.hooks import background
13
+ from rekuest_next.agents.hooks import startup
14
+ except ImportError as e:
15
+ raise e
16
+ register = missing_install("rekuest_next", e)
17
+ background = missing_install("rekuest_next", e)
18
+ startup = missing_install("rekuest_next", e)
19
+
20
+ from .builders import easy
21
+ from .apps.types import App
22
+
23
+ __all__ = [
24
+ "App",
25
+ "register",
26
+ "easy",
27
+ "publicqt",
28
+ "jupy",
29
+ "log",
30
+ "alog",
31
+ "progress",
32
+ "aprogress",
33
+ "scheduler",
34
+ "register_structure",
35
+ "group",
36
+ "useGuardian",
37
+ "useInstanceID",
38
+ "useUser",
39
+ "next",
40
+ "background",
41
+ "startup",
42
+ "register_next",
43
+ ]
@@ -0,0 +1,3 @@
1
+ from .types import App
2
+
3
+ __all__ = ["App"]
@@ -0,0 +1,99 @@
1
+ from .types import EasyApp
2
+ from typing import Optional, List
3
+
4
+
5
+ def build_arkitekt_app(
6
+ manifest: Manifest,
7
+ url=None,
8
+ no_cache=False,
9
+ headless=False,
10
+ instance_id=None,
11
+ token=None,
12
+ app_kind="development",
13
+ redeem_token=None,
14
+ ):
15
+ if redeem_token:
16
+ fakts = build_arkitekt_next_redeem_fakts_next(
17
+ manifest=manifest,
18
+ redeem_token=redeem_token,
19
+ url=url,
20
+ no_cache=no_cache,
21
+ headless=headless,
22
+ )
23
+ else:
24
+ fakts = build_arkitekt_next_fakts_next(
25
+ manifest=manifest,
26
+ url=url,
27
+ no_cache=no_cache,
28
+ headless=headless,
29
+ client_kind=app_kind,
30
+ )
31
+
32
+ herre = build_arkitekt_next_herre(fakts=fakts)
33
+
34
+ try:
35
+ from arkitekt_next_next.apps.service.rekuest_next import build_arkitekt_next_rekuest_next
36
+
37
+ rekuest = build_arkitekt_next_rekuest_next(
38
+ fakts=fakts, herre=herre, instance_id=instance_id
39
+ )
40
+ except ImportError as e:
41
+ rekuest = ImportException(import_exception=e, install_library="rekuest_next")
42
+
43
+ try:
44
+ from arkitekt_next_next.apps.service.mikro_next import build_arkitekt_next_mikro_next
45
+
46
+ mikro = build_arkitekt_next_mikro_next(fakts=fakts, herre=herre)
47
+ except ImportError as e:
48
+ raise e
49
+ mikro = ImportException(import_exception=e, install_library="mikro_next")
50
+
51
+ try:
52
+ from arkitekt_next_next.apps.service.fluss_next import build_arkitekt_next_fluss
53
+
54
+ fluss = build_arkitekt_next_fluss(herre=herre, fakts=fakts)
55
+ except ImportError as e:
56
+ raise e
57
+ fluss = ImportException(import_exception=e, install_library="fluss_next")
58
+
59
+ try:
60
+ from arkitekt_next_next.apps.service.unlok_next import build_arkitekt_next_unlok_next
61
+
62
+ unlok = build_arkitekt_next_unlok_next(herre=herre, fakts=fakts)
63
+ except ImportError as e:
64
+ raise e
65
+ fluss = ImportException(import_exception=e, install_library="fluss_next")
66
+
67
+ try:
68
+ from arkitekt_next_next.apps.service.omero_ark import build_arkitekt_next_omero_ark
69
+
70
+ omero_ark = build_arkitekt_next_omero_ark(herre=herre, fakts=fakts)
71
+ except ImportError as e:
72
+ omero_ark = ImportException(import_exception=e, install_library="omero_ark")
73
+
74
+ try:
75
+ from arkitekt_next_next.apps.service.kluster import build_arkitekt_next_kluster
76
+
77
+ kluster = build_arkitekt_next_kluster(herre=herre, fakts=fakts)
78
+ except ImportError as e:
79
+ kluster = ImportException(import_exception=e, install_library="kluster")
80
+
81
+ try:
82
+ from arkitekt_next_next.apps.service.kabinet import build_arkitekt_next_kabinet
83
+
84
+ kabinet = build_arkitekt_next_kabinet(herre=herre, fakts=fakts)
85
+ except ImportError as e:
86
+ kabinet = ImportException(import_exception=e, install_library="kluster")
87
+
88
+ return NextApp(
89
+ manifest=manifest,
90
+ fakts=fakts,
91
+ herre=herre,
92
+ rekuest=rekuest,
93
+ mikro=mikro,
94
+ kabinet=kabinet,
95
+ unlok=unlok,
96
+ fluss=fluss,
97
+ kluster=kluster,
98
+ omero_ark=omero_ark,
99
+ )
@@ -0,0 +1,40 @@
1
+ from arkitekt_next_next.apps.fallbacks import ImportException
2
+ from arkitekt_next_next.apps.service.fakts_next import (
3
+ build_arkitekt_next_fakts_next,
4
+ build_arkitekt_next_redeem_fakts_next,
5
+ )
6
+ from arkitekt_next_next.apps.service.herre import build_arkitekt_next_herre
7
+ from arkitekt_next_next.model import Manifest
8
+
9
+ from .types import NextApp
10
+
11
+
12
+ def build_next_app(
13
+ manifest: Manifest,
14
+ url=None,
15
+ no_cache=False,
16
+ headless=False,
17
+ instance_id=None,
18
+ token=None,
19
+ app_kind="development",
20
+ redeem_token=None,
21
+ ):
22
+ if redeem_token:
23
+ fakts = build_arkitekt_next_redeem_fakts_next(
24
+ manifest=manifest,
25
+ redeem_token=redeem_token,
26
+ url=url,
27
+ no_cache=no_cache,
28
+ headless=headless,
29
+ )
30
+ else:
31
+ fakts = build_arkitekt_next_fakts_next(
32
+ manifest=manifest,
33
+ url=url,
34
+ no_cache=no_cache,
35
+ headless=headless,
36
+ client_kind=app_kind,
37
+ )
38
+
39
+ herre = build_arkitekt_next_herre(fakts=fakts)
40
+
@@ -0,0 +1,97 @@
1
+ from arkitekt_next_next.model import Manifest
2
+ from arkitekt_next_next.apps.types import QtApp
3
+ from arkitekt_next_next.apps.fallbacks import ImportException, InstallModuleException
4
+ from typing import Any, Optional
5
+
6
+
7
+ def build_arkitekt_next_qt_app(
8
+ manifest: Manifest,
9
+ no_cache: bool = False,
10
+ instance_id: Optional[str] = None,
11
+ beacon_widget: Any = None,
12
+ login_widget: Any = None,
13
+ parent: Any = None,
14
+ settings: Any = None,
15
+ ):
16
+ try:
17
+ from koil.composition.qt import QtPedanticKoil
18
+ from qtpy import QtCore
19
+
20
+ settings = settings or QtCore.QSettings()
21
+ except ImportError as e:
22
+ raise InstallModuleException("Please install qtpy to use arkitekt_next_qt") from e
23
+
24
+ try:
25
+ from arkitekt_next_next.apps.service.fakts_qt import build_arkitekt_next_qt_fakts
26
+
27
+ fakts = build_arkitekt_next_qt_fakts(
28
+ manifest=manifest,
29
+ no_cache=no_cache,
30
+ beacon_widget=beacon_widget,
31
+ parent=parent,
32
+ settings=settings,
33
+ )
34
+ except ImportError as e:
35
+ fakts = ImportException(import_exception=e, install_library="qtpy")
36
+
37
+ try:
38
+ from arkitekt_next_next.apps.service.herre_qt import build_arkitekt_next_qt_herre
39
+
40
+ herre = build_arkitekt_next_qt_herre(
41
+ manifest=manifest,
42
+ fakts=fakts,
43
+ login_widget=login_widget,
44
+ parent=parent,
45
+ settings=settings,
46
+ )
47
+ except ImportError as e:
48
+ herre = ImportException(import_exception=e, install_library="qtpy")
49
+
50
+ try:
51
+ from arkitekt_next_next.apps.service.rekuest import build_arkitekt_next_rekuest
52
+
53
+ rekuest = build_arkitekt_next_rekuest(
54
+ fakts=fakts, herre=herre, instance_id=instance_id or "main"
55
+ )
56
+ except ImportError as e:
57
+ rekuest = ImportException(import_exception=e, install_library="rekuest")
58
+
59
+ try:
60
+ from arkitekt_next_next.apps.service.mikro import build_arkitekt_next_mikro
61
+
62
+ mikro = build_arkitekt_next_mikro(fakts=fakts, herre=herre)
63
+ except ImportError as e:
64
+ mikro = ImportException(import_exception=e, install_library="mikro")
65
+
66
+ try:
67
+ from arkitekt_next_next.apps.service.unlok import build_arkitekt_next_unlok
68
+
69
+ unlok = build_arkitekt_next_unlok(herre=herre, fakts=fakts)
70
+ except ImportError as e:
71
+ unlok = ImportException(import_exception=e, install_library="unlok")
72
+
73
+ try:
74
+ from arkitekt_next_next.apps.service.fluss import build_arkitekt_next_fluss
75
+
76
+ fluss = build_arkitekt_next_fluss(herre=herre, fakts=fakts)
77
+ except ImportError as e:
78
+ fluss = ImportException(import_exception=e, install_library="fluss")
79
+
80
+ try:
81
+ from arkitekt_next_next.apps.service.kluster import build_arkitekt_next_kluster
82
+
83
+ kluster = build_arkitekt_next_kluster(herre=herre, fakts=fakts)
84
+ except ImportError as e:
85
+ kluster = ImportException(import_exception=e, install_library="kluster")
86
+
87
+ return QtApp(
88
+ koil=QtPedanticKoil(parent=parent),
89
+ manifest=manifest,
90
+ fakts=fakts,
91
+ herre=herre,
92
+ rekuest=rekuest,
93
+ mikro=mikro,
94
+ unlok=unlok,
95
+ fluss=fluss,
96
+ kluster=kluster,
97
+ )
@@ -0,0 +1,3 @@
1
+ """ Modules for services, all services should be placed here.
2
+ Services SHOULD not be used directly, but build through the
3
+ builders in arkitekt_next/apps."""
@@ -0,0 +1,88 @@
1
+ from fakts.fakts import Fakts
2
+ from fakts.fakts import Fakts
3
+ from typing import Optional
4
+ from fakts.grants.remote.discovery.well_known import WellKnownDiscovery
5
+ from fakts.grants.remote import RemoteGrant
6
+ from fakts.grants.remote.demanders.auto_save import AutoSaveDemander
7
+ from fakts.grants.remote.demanders.cache import CacheTokenStore
8
+ from fakts.grants.remote.demanders.static import StaticDemander
9
+ from fakts.grants.remote.demanders.device_code import DeviceCodeDemander
10
+ from fakts.grants.remote.claimers.post import ClaimEndpointClaimer
11
+ from fakts.grants.remote.demanders.redeem import RedeemDemander
12
+ from arkitekt_next_next.model import Manifest
13
+
14
+
15
+ class ArkitektNextFaktsQt(Fakts):
16
+ grant: RemoteGrant
17
+
18
+
19
+ class ArkitektNextFakts(Fakts):
20
+ pass
21
+
22
+
23
+ def build_arkitekt_next_fakts(
24
+ manifest: Manifest,
25
+ url: Optional[str] = None,
26
+ no_cache: bool = False,
27
+ headless: bool = False,
28
+ ) -> ArkitektNextFakts:
29
+ identifier = manifest.identifier
30
+ version = manifest.version
31
+
32
+ if no_cache:
33
+ demander = DeviceCodeDemander(
34
+ manifest=manifest,
35
+ redirect_uri="http://127.0.0.1:6767",
36
+ open_browser=not headless,
37
+ )
38
+
39
+ else:
40
+ demander = AutoSaveDemander(
41
+ demander=DeviceCodeDemander(
42
+ manifest=manifest,
43
+ redirect_uri="http://127.0.0.1:6767",
44
+ open_browser=not headless,
45
+ ),
46
+ store=CacheTokenStore(
47
+ cache_file=f".arkitekt_next/cache/{identifier}-{version}_fakts_cache.json"
48
+ ),
49
+ )
50
+
51
+ return ArkitektNextFakts(
52
+ grant=RemoteGrant(
53
+ demander=demander,
54
+ discovery=WellKnownDiscovery(url=url, auto_protocols=["https", "http"]),
55
+ claimer=ClaimEndpointClaimer(),
56
+ )
57
+ )
58
+
59
+
60
+ def build_arkitekt_next_token_fakts(
61
+ manifest: Manifest,
62
+ token: str,
63
+ url,
64
+ no_cache: Optional[bool] = False,
65
+ headless=False,
66
+ ):
67
+ return ArkitektNextFakts(
68
+ grant=RemoteGrant(
69
+ demander=StaticDemander(token=token),
70
+ discovery=WellKnownDiscovery(url=url, auto_protocols=["https", "http"]),
71
+ claimer=ClaimEndpointClaimer(),
72
+ )
73
+ )
74
+
75
+ def build_arkitekt_next_redeem_fakts(
76
+ manifest: Manifest,
77
+ redeem_token: str,
78
+ url,
79
+ no_cache: Optional[bool] = False,
80
+ headless=False,
81
+ ):
82
+ return ArkitektNextFakts(
83
+ grant=RemoteGrant(
84
+ demander=RedeemDemander(token=redeem_token, manifest=manifest),
85
+ discovery=WellKnownDiscovery(url=url, auto_protocols=["https", "http"]),
86
+ claimer=ClaimEndpointClaimer(),
87
+ )
88
+ )
@@ -0,0 +1,79 @@
1
+ from typing import Optional
2
+
3
+ from fakts.fakts import Fakts
4
+ from fakts.grants.remote import RemoteGrant
5
+ from fakts.grants.remote.discovery.well_known import WellKnownDiscovery
6
+ from fakts.grants.remote import RemoteGrant
7
+ from fakts.grants.remote.demanders.auto_save import AutoSaveDemander
8
+ from fakts.grants.remote.demanders.cache import CacheTokenStore
9
+ from fakts.grants.remote.demanders.static import StaticDemander
10
+ from fakts.grants.remote.demanders.device_code import DeviceCodeDemander
11
+ from fakts.grants.remote.claimers.post import ClaimEndpointClaimer
12
+ from fakts.grants.remote.demanders.redeem import RedeemDemander
13
+
14
+ from arkitekt_next.model import Manifest
15
+
16
+
17
+ class ArkitektNextFaktsQt(Fakts):
18
+ grant: RemoteGrant
19
+
20
+
21
+ class ArkitektNextFaktsNext(Fakts):
22
+ pass
23
+
24
+
25
+ def build_arkitekt_next_fakts_next(
26
+ manifest: Manifest,
27
+ url: Optional[str] = None,
28
+ no_cache: bool = False,
29
+ headless: bool = False,
30
+ client_kind: str = "development",
31
+ ) -> ArkitektNextFaktsNext:
32
+ identifier = manifest.identifier
33
+ version = manifest.version
34
+
35
+ if no_cache:
36
+ demander = DeviceCodeDemander(
37
+ manifest=manifest,
38
+ redirect_uri="http://127.0.0.1:6767",
39
+ open_browser=not headless,
40
+ requested_client_kind=client_kind,
41
+ )
42
+
43
+ else:
44
+ demander = AutoSaveDemander(
45
+ demander=DeviceCodeDemander(
46
+ manifest=manifest,
47
+ redirect_uri="http://127.0.0.1:6767",
48
+ open_browser=not headless,
49
+ requested_client_kind=client_kind,
50
+ ),
51
+ store=CacheTokenStore(
52
+ cache_file=f".arkitekt_next/cache/{identifier}-{version}_fakts_cache.json",
53
+ hash=manifest.hash(),
54
+ ),
55
+ )
56
+
57
+ return ArkitektNextFaktsNext(
58
+ grant=RemoteGrant(
59
+ demander=demander,
60
+ discovery=WellKnownDiscovery(url=url, auto_protocols=["https", "http"]),
61
+ claimer=ClaimEndpointClaimer(),
62
+ )
63
+ )
64
+
65
+
66
+ def build_arkitekt_next_redeem_fakts_next(
67
+ manifest: Manifest,
68
+ redeem_token: str,
69
+ url,
70
+ no_cache: Optional[bool] = False,
71
+ headless=False,
72
+ ):
73
+ return ArkitektNextFaktsNext(
74
+ grant=RemoteGrant(
75
+ demander=RedeemDemander(token=redeem_token, manifest=manifest),
76
+ discovery=WellKnownDiscovery(url=url, auto_protocols=["https", "http"]),
77
+ claimer=ClaimEndpointClaimer(),
78
+ )
79
+ )
@@ -0,0 +1,82 @@
1
+ from fakts.fakts import Fakts
2
+ from typing import Optional
3
+ from fakts.grants.remote import RemoteGrant
4
+ from fakts.grants.remote.demanders.auto_save import AutoSaveDemander
5
+ from fakts.grants.remote.discovery.auto_save import AutoSaveDiscovery
6
+ from fakts.grants.remote.discovery.qt.auto_save_endpoint_widget import (
7
+ AutoSaveEndpointWidget,
8
+ )
9
+ from fakts.grants.remote.discovery.qt.qt_settings_endpoint_store import (
10
+ QtSettingsEndpointStore,
11
+ )
12
+ from fakts.grants.remote.demanders.qt.qt_settings_token_store import QTSettingTokenStore
13
+
14
+ from fakts.grants.remote.demanders.retrieve import RetrieveDemander
15
+ from fakts.grants.remote.claimers.post import ClaimEndpointClaimer
16
+ from fakts.grants.remote.discovery.qt.selectable_beacon import (
17
+ SelectBeaconWidget,
18
+ QtSelectableDiscovery,
19
+ )
20
+ from arkitekt_next.model import Manifest
21
+ from qtpy import QtCore, QtWidgets
22
+
23
+
24
+ class ArkitektNextFaktsAutoSaveDiscovery(AutoSaveDiscovery):
25
+ """An ArkitektNext Fakts discovery that uses Qt widgets for token and endpoint storage"""
26
+
27
+ discovery: QtSelectableDiscovery
28
+
29
+
30
+ class ArkitektNextFaktsQtRemoteGrant(RemoteGrant):
31
+ """An ArkitektNext Fakts grant that uses Qt widgets for token and endpoint storage"""
32
+
33
+ discovery: ArkitektNextFaktsAutoSaveDiscovery
34
+
35
+
36
+ class ArkitektNextFaktsQt(Fakts):
37
+ """A Fakts that uses Qt widgets for token and endpoint storage"""
38
+
39
+ grant: ArkitektNextFaktsQtRemoteGrant
40
+
41
+
42
+ def build_arkitekt_next_qt_fakts(
43
+ manifest: Manifest,
44
+ no_cache: Optional[bool] = False,
45
+ beacon_widget: Optional[QtWidgets.QWidget] = None,
46
+ parent: Optional[QtWidgets.QWidget] = None,
47
+ settings: Optional[QtCore.QSettings] = None,
48
+ ) -> ArkitektNextFaktsQt:
49
+ beacon_widget = beacon_widget or SelectBeaconWidget(
50
+ parent=parent, settings=settings
51
+ )
52
+
53
+ return ArkitektNextFaktsQt(
54
+ grant=RemoteGrant(
55
+ demander=AutoSaveDemander(
56
+ store=QTSettingTokenStore(
57
+ settings=settings,
58
+ save_key="fakts_token",
59
+ ),
60
+ demander=RetrieveDemander(
61
+ manifest=manifest,
62
+ redirect_uri="http://127.0.0.1:6767",
63
+ ),
64
+ ),
65
+ discovery=AutoSaveDiscovery(
66
+ store=QtSettingsEndpointStore(
67
+ settings=settings,
68
+ save_key="fakts_endpoint",
69
+ ),
70
+ decider=AutoSaveEndpointWidget(
71
+ parent=parent,
72
+ ),
73
+ discovery=QtSelectableDiscovery(
74
+ widget=beacon_widget,
75
+ settings=settings,
76
+ allow_appending_slash=True,
77
+ auto_protocols=["http", "https"],
78
+ ),
79
+ ),
80
+ claimer=ClaimEndpointClaimer(),
81
+ )
82
+ )
@@ -0,0 +1,31 @@
1
+ from fluss_next.fluss import Fluss
2
+ from fluss_next.rath import FlussLinkComposition, FlussRath
3
+ from rath.links.split import SplitLink
4
+ from rath.contrib.fakts.links.aiohttp import FaktsAIOHttpLink
5
+ from rath.contrib.fakts.links.graphql_ws import FaktsGraphQLWSLink
6
+ from rath.contrib.herre.links.auth import HerreAuthLink
7
+ from graphql import OperationType
8
+ from arkitekt_next_next.healthz import FaktsHealthz
9
+ from fakts import Fakts
10
+ from herre import Herre
11
+
12
+
13
+ class ArkitektNextFluss(Fluss):
14
+ rath: FlussRath
15
+ healthz: FaktsHealthz
16
+
17
+
18
+ def build_arkitekt_next_fluss(herre: Herre, fakts: Fakts):
19
+ return ArkitektNextFluss(
20
+ rath=FlussRath(
21
+ link=FlussLinkComposition(
22
+ auth=HerreAuthLink(herre=herre),
23
+ split=SplitLink(
24
+ left=FaktsAIOHttpLink(fakts_group="fluss", fakts=fakts),
25
+ right=FaktsGraphQLWSLink(fakts_group="fluss", fakts=fakts),
26
+ split=lambda o: o.node.operation != OperationType.SUBSCRIPTION,
27
+ ),
28
+ )
29
+ ),
30
+ healthz=FaktsHealthz(fakts_group="fluss", fakts=fakts),
31
+ )
@@ -0,0 +1,27 @@
1
+ from herre.fakts.grant import FaktsGrant
2
+ from herre.fakts.registry import GrantRegistry, GrantType
3
+ from herre.grants.oauth2.authorization_code import AuthorizationCodeGrant
4
+ from herre.grants.oauth2.redirecters.aiohttp_server import AioHttpServerRedirecter
5
+ from herre.grants.oauth2.client_credentials import ClientCredentialsGrant
6
+
7
+
8
+ ARKITEKT_GRANT_REGISTRY = GrantRegistry()
9
+
10
+
11
+ def build_authorization_code_grant(**kwargs) -> FaktsGrant:
12
+ return AuthorizationCodeGrant(**kwargs, redirecter=AioHttpServerRedirecter())
13
+
14
+
15
+ def build_client_credentials_grant(**kwargs) -> FaktsGrant:
16
+ return ClientCredentialsGrant(**kwargs)
17
+
18
+
19
+ ARKITEKT_GRANT_REGISTRY.register_grant(
20
+ GrantType.AUTHORIZATION_CODE,
21
+ build_authorization_code_grant,
22
+ )
23
+
24
+ ARKITEKT_GRANT_REGISTRY.register_grant(
25
+ GrantType.CLIENT_CREDENTIALS,
26
+ build_client_credentials_grant,
27
+ )
@@ -0,0 +1,24 @@
1
+ from herre.herre import Herre
2
+ from fakts import Fakts
3
+ from herre.grants.oauth2.refresh import RefreshGrant
4
+ from herre.fakts.fakts_endpoint_fetcher import FaktsUserFetcher
5
+ from herre.fakts.grant import FaktsGrant
6
+ from arkitekt_next.model import User
7
+ from arkitekt_next.apps.service.grant_registry import ARKITEKT_GRANT_REGISTRY
8
+
9
+
10
+ class ArkitektNextHerre(Herre):
11
+ pass
12
+
13
+
14
+ def build_arkitekt_next_herre(fakts: Fakts) -> ArkitektNextHerre:
15
+ return ArkitektNextHerre(
16
+ grant=RefreshGrant(
17
+ grant=FaktsGrant(
18
+ fakts=fakts, fakts_group="lok", grant_registry=ARKITEKT_GRANT_REGISTRY
19
+ ),
20
+ ),
21
+ fetcher=FaktsUserFetcher(
22
+ fakts=fakts, fakts_key="lok.userinfo_url", userModel=User
23
+ ),
24
+ )
@@ -0,0 +1,57 @@
1
+ from herre.herre import Herre
2
+ from fakts import Fakts
3
+ from herre.grants.oauth2.refresh import RefreshGrant
4
+ from herre.fakts.grant import FaktsGrant
5
+ from herre.fakts.fakts_qt_store import FaktsQtStore
6
+
7
+ from herre.grants.auto_login import AutoLoginGrant
8
+ from herre.grants.qt.auto_login import AutoLoginWidget
9
+ from herre.fakts.fakts_endpoint_fetcher import FaktsUserFetcher
10
+ from arkitekt_next.model import Manifest, User
11
+ from arkitekt_next.apps.service.grant_registry import ARKITEKT_GRANT_REGISTRY
12
+
13
+
14
+ class ArkitektNextAutoLogin(AutoLoginGrant):
15
+ store: FaktsQtStore
16
+ fetcher: FaktsUserFetcher
17
+ grant: FaktsGrant
18
+
19
+
20
+ class ArkitektNextRefreshGrant(RefreshGrant):
21
+ grant: ArkitektNextAutoLogin
22
+
23
+
24
+ class ArkitektNextHerreQt(Herre):
25
+ grant: ArkitektNextRefreshGrant
26
+
27
+
28
+ def build_arkitekt_next_qt_herre(
29
+ manifest: Manifest,
30
+ fakts: Fakts,
31
+ login_widget=None,
32
+ parent=None,
33
+ settings=None,
34
+ ):
35
+ login_widget = login_widget or AutoLoginWidget(parent=parent)
36
+
37
+ grant = ArkitektNextAutoLogin(
38
+ store=FaktsQtStore(
39
+ fakts=fakts,
40
+ settings=settings,
41
+ fakts_key="lok.endpoint_url",
42
+ ),
43
+ widget=login_widget,
44
+ fetcher=FaktsUserFetcher(
45
+ fakts=fakts, fakts_key="lok.userinfo_url", userModel=User
46
+ ),
47
+ grant=FaktsGrant(
48
+ fakts=fakts, fakts_group="lok", grant_registry=ARKITEKT_GRANT_REGISTRY
49
+ ),
50
+ )
51
+
52
+ return ArkitektNextHerreQt(
53
+ grant=ArkitektNextRefreshGrant(grant=grant),
54
+ fetcher=FaktsUserFetcher(
55
+ fakts=fakts, fakts_key="lok.userinfo_url", userModel=User
56
+ ),
57
+ )