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

@@ -125,14 +125,6 @@ def ensure_semver(ctx, param, value):
125
125
  default=False,
126
126
  callback=check_overwrite_app,
127
127
  )
128
- @click.option(
129
- "--requirements",
130
- "-r",
131
- help="Dedicated hardware requirements for this app. They will be used to inform Plugin Schedulers like port, on which compute resources to put your plugin app, once deployed.You can choose multiple for your app. For a list of requirements, run `arkitekt_next manifest requirements available`",
132
- type=click.Choice(compile_requirements()),
133
- multiple=True,
134
- default=[],
135
- )
136
128
  @click.option(
137
129
  "--scopes",
138
130
  "-s",
@@ -4,6 +4,7 @@ import rich_click as click
4
4
  import rich_click as click
5
5
  from .variables import variables
6
6
  from .templates import templates
7
+ from .requirements import requirements
7
8
 
8
9
 
9
10
  @click.group()
@@ -19,4 +20,5 @@ def inspect(ctx):
19
20
 
20
21
 
21
22
  inspect.add_command(variables, "variables")
23
+ inspect.add_command(requirements, "requirements")
22
24
  inspect.add_command(templates, "templates")
@@ -0,0 +1,83 @@
1
+ import rich_click as click
2
+ from importlib import import_module
3
+ from arkitekt_next.apps.types import App
4
+ from arkitekt_next.cli.commands.run.utils import import_builder
5
+ from arkitekt_next.cli.vars import get_console, get_manifest
6
+ from arkitekt_next.cli.options import with_builder
7
+ import json
8
+ import os
9
+
10
+
11
+ async def run_app(app):
12
+ async with app:
13
+ await app.rekuest.run()
14
+
15
+
16
+ @click.command("prod")
17
+ @click.pass_context
18
+ @click.option(
19
+ "--pretty",
20
+ "-p",
21
+ help="Should we just output json?",
22
+ is_flag=True,
23
+ default=False,
24
+ )
25
+ @click.option(
26
+ "--machine-readable",
27
+ "-mr",
28
+ help="Should we just output json?",
29
+ is_flag=True,
30
+ default=False,
31
+ )
32
+ @with_builder
33
+ def requirements(
34
+ ctx,
35
+ pretty: bool,
36
+ machine_readable: bool,
37
+ builder: str = "arkitekt_next.builders.easy",
38
+ ):
39
+ """Runs the app in production mode
40
+
41
+ \n
42
+ You can specify the builder to use with the --builder flag. By default, the easy builder is used, which is designed to be easy to use and to get started with.
43
+
44
+ """
45
+ from rekuest.definition.registry import get_default_definition_registry
46
+
47
+ manifest = get_manifest(ctx)
48
+ console = get_console(ctx)
49
+
50
+ entrypoint = manifest.entrypoint
51
+ identifier = manifest.identifier
52
+ entrypoint_file = f"{manifest.entrypoint}.py"
53
+ os.path.realpath(entrypoint_file)
54
+
55
+ builder_func = import_builder(builder)
56
+
57
+ entrypoint = manifest.entrypoint
58
+
59
+ with console.status("Loading entrypoint module..."):
60
+ try:
61
+ import_module(entrypoint)
62
+ except ModuleNotFoundError as e:
63
+ console.print(f"Could not find entrypoint module {entrypoint}")
64
+ raise e
65
+
66
+ app: App = builder_func(
67
+ identifier=identifier,
68
+ version="dev",
69
+ logo=manifest.logo,
70
+ )
71
+
72
+ x = {
73
+ key: item.dict(by_alias=True)
74
+ for key, item in app.manifest.requirements.items()
75
+ }
76
+ if machine_readable:
77
+ print("--START_REQUIREMENTS--" + json.dumps(x) + "--END_REQUIREMENTS--")
78
+
79
+ else:
80
+ if pretty:
81
+ console.print(json.dumps(x, indent=2))
82
+ else:
83
+ print(json.dumps(x))
@@ -10,6 +10,7 @@ from arkitekt_next.cli.types import Flavour, Inspection
10
10
  import yaml
11
11
  from typing import Dict, Optional
12
12
  import json
13
+ from arkitekt_next.model import Requirement
13
14
  from arkitekt_next.utils import create_arkitekt_next_folder
14
15
  from rekuest_next.api.schema import TemplateInput
15
16
 
@@ -125,13 +126,50 @@ def inspect_templates(build_id: str) -> list[TemplateInput]:
125
126
  )
126
127
 
127
128
  raise InspectionError(f"An error occurred: {e.stdout + e.stderr}") from e
129
+
130
+ def inspect_requirements(build_id: str) -> Dict[str, Requirement]:
131
+ try:
132
+ # Run 'docker inspect' with the container ID or name
133
+ result = subprocess.run(
134
+ ["docker", "run", build_id, "arkitekt-next", "inspect", "requirements", "-mr"],
135
+ stdout=subprocess.PIPE,
136
+ stderr=subprocess.PIPE,
137
+ check=True,
138
+ text=True,
139
+ )
140
+
141
+ # Parse the JSON output
142
+ correct_part = result.stdout.split("--START_REQUIREMENTS--")[1].split(
143
+ "--END_REQUIREMENTS--"
144
+ )[0]
145
+
146
+ try:
147
+ output = json.loads(correct_part)
148
+ except json.decoder.JSONDecodeError as e:
149
+ combined_error = result.stdout + result.stderr
150
+ raise InspectionError(
151
+ f"Could not decode JSON output of docker inspect. {combined_error}"
152
+ ) from e
153
+
154
+ return output
155
+ except subprocess.CalledProcessError as e:
156
+ combined_error = e.stdout + e.stderr
157
+
158
+ if "No such command" in combined_error:
159
+ raise InspectionError(
160
+ "Could not find the command `arkitekt_next inspect definitions` in the container. Maybe"
161
+ + "you forgot to install arkitekt_next in the container? "
162
+ )
163
+
164
+ raise InspectionError(f"An error occurred: {e.stdout + e.stderr}") from e
128
165
 
129
166
 
130
167
  def inspect_build(build_id: str) -> Inspection:
131
168
  size, size_root_fs = inspect_docker_container(build_id)
132
169
  templates = inspect_templates(build_id)
170
+ requirements = inspect_requirements(build_id)
133
171
 
134
- return Inspection(size=size, templates=templates)
172
+ return Inspection(size=size, templates=templates , requirements=requirements)
135
173
 
136
174
 
137
175
  def get_flavours(ctx: Context, select: Optional[str] = None) -> Dict[str, Flavour]:
@@ -9,10 +9,6 @@ def compile_scopes() -> List[str]:
9
9
  return ["read", "write"]
10
10
 
11
11
 
12
- def compile_requirements():
13
- """Compile all available requirements"""
14
- return [Requirement.GPU.value]
15
-
16
12
 
17
13
  def compile_builders():
18
14
  return ["arkitekt_next.builders.easy", "arkitekt_next.builders.port"]
@@ -1,9 +1,10 @@
1
1
  from pydantic import BaseModel, Field, validator
2
2
  import datetime
3
- from typing import List, Optional, Union, Literal
3
+ from typing import List, Optional, Union, Literal, Dict
4
4
  from enum import Enum
5
5
  import semver
6
6
  import uuid
7
+ from arkitekt_next.model import Requirement
7
8
  from rekuest.api.schema import DefinitionInput
8
9
  from string import Formatter
9
10
  import os
@@ -24,12 +25,6 @@ class Framework(str, Enum):
24
25
  PYTORCH = "pytorch"
25
26
 
26
27
 
27
- class Requirement(str, Enum):
28
- """ """
29
-
30
- GPU = "gpu"
31
-
32
-
33
28
  class Packager(str, Enum):
34
29
  CONDA = "conda"
35
30
  POETRY = "poetry"
@@ -43,7 +38,6 @@ class Manifest(BaseModel):
43
38
  logo: Optional[str]
44
39
  entrypoint: str
45
40
  scopes: List[str]
46
- requirements: List[Requirement] = Field(default_factory=list)
47
41
  created_at: datetime.datetime = Field(default_factory=datetime.datetime.now)
48
42
 
49
43
  @validator("version", pre=True)
@@ -218,6 +212,7 @@ Selector = Union[
218
212
 
219
213
  class Inspection(BaseModel):
220
214
  templates: List[TemplateInput]
215
+ requirements: Dict[str, Requirement]
221
216
  size: int
222
217
 
223
218
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: arkitekt-next
3
- Version: 0.7.17
3
+ Version: 0.7.19
4
4
  Summary: client for the arkitekt_next platform
5
5
  License: MIT
6
6
  Author: jhnnsrs
@@ -17,16 +17,17 @@ Provides-Extra: all
17
17
  Provides-Extra: cli
18
18
  Requires-Dist: dokker (>=0.1.21)
19
19
  Requires-Dist: fakts (>=0.5.0)
20
- Requires-Dist: fluss-next (>=0.1.65) ; extra == "all"
20
+ Requires-Dist: fluss-next (>=0.1.67) ; extra == "all"
21
21
  Requires-Dist: herre (>=0.4.3)
22
- Requires-Dist: kabinet (>=0.1.4) ; (python_version >= "3.9" and python_version < "4.0") and (extra == "all")
22
+ Requires-Dist: kabinet (>=0.1.5) ; (python_version >= "3.9" and python_version < "4.0") and (extra == "all")
23
23
  Requires-Dist: koil (>=0.3.6)
24
- Requires-Dist: mikro-next (>=0.1.11) ; (python_version >= "3.10" and python_version < "4.0") and (extra == "all")
25
- Requires-Dist: reaktion-next (>=0.1.55) ; (python_version >= "3.8" and python_version < "4.0") and (extra == "all")
26
- Requires-Dist: rekuest-next (>=0.2.8) ; (python_version >= "3.8" and python_version < "4.0") and (extra == "cli" or extra == "all")
24
+ Requires-Dist: mikro-next (>=0.1.13) ; (python_version >= "3.10" and python_version < "4.0") and (extra == "all")
25
+ Requires-Dist: reaktion-next (>=0.1.57) ; (python_version >= "3.8" and python_version < "4.0") and (extra == "all")
26
+ Requires-Dist: rekuest-next (>=0.2.10) ; (python_version >= "3.8" and python_version < "4.0") and (extra == "cli" or extra == "all")
27
27
  Requires-Dist: rich-click (>=1.6.1) ; extra == "cli" or extra == "all"
28
28
  Requires-Dist: semver (>=3.0.1) ; extra == "cli" or extra == "all"
29
29
  Requires-Dist: turms (>=0.5.0) ; (python_version >= "3.9" and python_version < "4.0") and (extra == "cli" or extra == "all")
30
+ Requires-Dist: unlok-next (>=0.1.62) ; python_version >= "3.8" and python_version < "4.0"
30
31
  Requires-Dist: watchfiles (>=0.18.1) ; extra == "cli" or extra == "all"
31
32
  Description-Content-Type: text/markdown
32
33
 
@@ -28,13 +28,14 @@ arkitekt_next/cli/commands/gen/init.py,sha256=JV9x27Iy80QlmigXd7TSG2YIBHPGJBdEQ_
28
28
  arkitekt_next/cli/commands/gen/main.py,sha256=_BdkcsXoWY5_3gmboq2e0pGYM6lAnwqQgBAyxmvdf6U,947
29
29
  arkitekt_next/cli/commands/gen/watch.py,sha256=nf4QckdTJOWxvKoeNRwvC4rXQ4xhIx8LCDDJzpPhcY8,1189
30
30
  arkitekt_next/cli/commands/init/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
- arkitekt_next/cli/commands/init/main.py,sha256=1ACgJn3RH5UIbsaX3KxKmwwvw9bkmJJgSWG4JDHPfow,5936
31
+ arkitekt_next/cli/commands/init/main.py,sha256=7pqr_06xooe-KJfnliBhyd2XvQbPUcglbulyp5goWQs,5507
32
32
  arkitekt_next/cli/commands/inspect/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
- arkitekt_next/cli/commands/inspect/main.py,sha256=Eab0t-oQzrnVIQuj5Rzq4Jm__awfOSMACM2vLEZlvEE,537
33
+ arkitekt_next/cli/commands/inspect/main.py,sha256=Bu1vAZudkFCtjDnZAB8yQLDt-UKY9pJGhLBlEfDqtkw,626
34
+ arkitekt_next/cli/commands/inspect/requirements.py,sha256=17rK6zviRpBDpaR-qpw5spb4ClTbKaG1d2ZQ-KiNV7I,2133
34
35
  arkitekt_next/cli/commands/inspect/templates.py,sha256=U99SLBYWiD-ZiIYV7pVWhQK3XWn1PLUIyTKzgSFF6MQ,2325
35
36
  arkitekt_next/cli/commands/inspect/variables.py,sha256=LonDlbS2qH1v-jD6RfEhTv-mxmgeBMKqD3oO2iDJRjE,2698
36
37
  arkitekt_next/cli/commands/kabinet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
- arkitekt_next/cli/commands/kabinet/build.py,sha256=H6Hu3Df2GZiJDEFAvxfSCdn_OwSeikFhW9bybF7mT1A,7085
38
+ arkitekt_next/cli/commands/kabinet/build.py,sha256=A1C84ZNRtD1nMv5erJGQPx9DDx493VxDR7SRd2__7IA,8548
38
39
  arkitekt_next/cli/commands/kabinet/init.py,sha256=NNEb5SITLNM1TBED0moyBhE-JGkkr0cvNh33A4OGnfc,2525
39
40
  arkitekt_next/cli/commands/kabinet/main.py,sha256=U5EWekRTsMZZ34abWFfwilhzrd-zZtpZbl8RsLN_bC8,1008
40
41
  arkitekt_next/cli/commands/kabinet/publish.py,sha256=zbjnoMliowje1nEuKFolFX5pZA2D_DzLjXlSxBbD88k,3596
@@ -64,7 +65,7 @@ arkitekt_next/cli/commands/server/stop.py,sha256=fPiF5zBa4zOEdchMIQqi88gsNAEhq6W
64
65
  arkitekt_next/cli/commands/server/up.py,sha256=QfXEN_IDYrL4kFJ-DZ4BGK3eMfkW4YpoSkr9bGpzFjM,1757
65
66
  arkitekt_next/cli/commands/server/utils.py,sha256=GhUiJx2eXSBMdIfukEaZAetAtkfy_dZG4yb2L6vxTio,846
66
67
  arkitekt_next/cli/configs/base.yaml,sha256=9IJ7B4Fq3swHsLUbKn1MlhhzJKqDI1wnR5PAG_VKs8A,30097
67
- arkitekt_next/cli/constants.py,sha256=-PdzHYOgxoE9ss1uFCzQ9S4pGkEbyp8EFn1xzQ5-dfw,1520
68
+ arkitekt_next/cli/constants.py,sha256=xHG2lfXw_4atx9B4ICAY45fbNbQN0UQAfdxZQbduz_w,1411
68
69
  arkitekt_next/cli/dockerfiles/vanilla.dockerfile,sha256=Cn0MSaopz_hsAyNguJCLSxUIxI7Kcr8uk3Rji2nP8AU,168
69
70
  arkitekt_next/cli/errors.py,sha256=zLTjaCbun6qM2nTldjyZd-DvykqKn5A3Gn80uYdx7Vc,93
70
71
  arkitekt_next/cli/inspect.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
@@ -88,7 +89,7 @@ arkitekt_next/cli/schemas/unlok.schema.graphql,sha256=fXR846snIBIqkuQ-PlYnSkQjkF
88
89
  arkitekt_next/cli/templates/filter.py,sha256=mD2jdNEXrZNagC_8WtuTisGJrGIbJDSylCvh19cF49I,650
89
90
  arkitekt_next/cli/templates/simple.py,sha256=IbcThJ5LryXVFQUdzxfHQCtzSNxEQWTxbD__Ygxsp4M,1171
90
91
  arkitekt_next/cli/texts.py,sha256=csMefyCnwnvDnriTy0VJ4L24VFIbcXoC9ayopP4RxIc,697
91
- arkitekt_next/cli/types.py,sha256=YH3wfQRO23xe6yw8_1ew63OWT_Z_l4EpgOUdoMipnIo,10456
92
+ arkitekt_next/cli/types.py,sha256=LJmyWFzKvvq2KpgYtZHgrq6_YAKp_RhmF-MEh5kTuFY,10420
92
93
  arkitekt_next/cli/ui.py,sha256=BR_AOsBIIHwojI5otBzT_560-ep5Dw1xAHKsO2zOOJQ,3493
93
94
  arkitekt_next/cli/utils.py,sha256=rl1hfQIVzepLHPN_ZWuvfVH-IIVqcSfiFGyfNtL1XCo,445
94
95
  arkitekt_next/cli/validators.py,sha256=XkLrOrDzBJwcG1keTawa_NJPt3QIBhb5KjepeH4N1KA,719
@@ -113,8 +114,8 @@ arkitekt_next/qt/utils.py,sha256=MgBPtPmCSBkIuATov3UgREESwxAHh77lWNNxyE7Qs48,773
113
114
  arkitekt_next/service_registry.py,sha256=Aq5bgu4UHRl1P6E2JOQ2gMCwFI8pQfASWte0BvtKE3g,3365
114
115
  arkitekt_next/tqdm.py,sha256=DlrxPluHao7TvW-Cqgt0UokRS-fM2_ZNiWiddqvCqCc,1488
115
116
  arkitekt_next/utils.py,sha256=WA3AtqQFcz2h-yOadAsQkkr0qKJmKcGMi2aclxaVI_o,1278
116
- arkitekt_next-0.7.17.dist-info/LICENSE,sha256=YZ2oRjC248t-GpoEyw7J13vwKYNG6zhYMaEAix6EzF0,1089
117
- arkitekt_next-0.7.17.dist-info/METADATA,sha256=-qKK5NZ2A5VG1YNmqcyEfoPm-mlfp748Gd4b3kDiCQs,5409
118
- arkitekt_next-0.7.17.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
119
- arkitekt_next-0.7.17.dist-info/entry_points.txt,sha256=-hxikQx4xZ6TiOnWVDOlTN_kcAISgGFvTHXIchsCHSc,60
120
- arkitekt_next-0.7.17.dist-info/RECORD,,
117
+ arkitekt_next-0.7.19.dist-info/LICENSE,sha256=YZ2oRjC248t-GpoEyw7J13vwKYNG6zhYMaEAix6EzF0,1089
118
+ arkitekt_next-0.7.19.dist-info/METADATA,sha256=eEz94kggp2E_CJU9K9fCFuANSKjbvKgagvldY2L9fTE,5500
119
+ arkitekt_next-0.7.19.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
120
+ arkitekt_next-0.7.19.dist-info/entry_points.txt,sha256=-hxikQx4xZ6TiOnWVDOlTN_kcAISgGFvTHXIchsCHSc,60
121
+ arkitekt_next-0.7.19.dist-info/RECORD,,