arkitekt-spec 1.0.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.
- arkitekt_spec-1.0.0/.gitignore +7 -0
- arkitekt_spec-1.0.0/PKG-INFO +45 -0
- arkitekt_spec-1.0.0/README.md +34 -0
- arkitekt_spec-1.0.0/arkitekt_spec/__init__.py +83 -0
- arkitekt_spec-1.0.0/arkitekt_spec/__main__.py +7 -0
- arkitekt_spec-1.0.0/arkitekt_spec/actions.py +1638 -0
- arkitekt_spec-1.0.0/arkitekt_spec/base.py +30 -0
- arkitekt_spec-1.0.0/arkitekt_spec/deployment.py +72 -0
- arkitekt_spec-1.0.0/arkitekt_spec/inspection.py +36 -0
- arkitekt_spec-1.0.0/arkitekt_spec/manifest.py +54 -0
- arkitekt_spec-1.0.0/arkitekt_spec/py.typed +0 -0
- arkitekt_spec-1.0.0/arkitekt_spec/scalars.py +53 -0
- arkitekt_spec-1.0.0/arkitekt_spec/selectors.py +149 -0
- arkitekt_spec-1.0.0/pyproject.toml +103 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: arkitekt-spec
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: the wire format of an Arkitekt app: manifest, requirements, inspection, hardware selectors and deployments.yaml
|
|
5
|
+
Author-email: jhnnsrs <jhnnsrs@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Requires-Dist: pydantic>=2.11
|
|
9
|
+
Requires-Dist: pyyaml>=6
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# arkitekt-spec
|
|
13
|
+
|
|
14
|
+
The wire format of an Arkitekt app: one definition of *what an app is*, shared by everything
|
|
15
|
+
that produces or consumes it.
|
|
16
|
+
|
|
17
|
+
| Model | What it is | Produced by | Consumed by |
|
|
18
|
+
| --- | --- | --- | --- |
|
|
19
|
+
| `AppManifest`, `Requirement` | who the app is, which services it needs | arkitekt (from the `App`) | kabinet |
|
|
20
|
+
| `Inspection` | what the app declares (rekuest's action language, carried as JSON) | `arkitekt inspect all`, inside the image | arkitekt's plugin CLI, kabinet |
|
|
21
|
+
| `Selector` (`cpu`, `ram`, `cuda`, `rocm`, `oneapi`, `label`) | where a flavour may run | a flavour's `config.yaml` | kabinet, deployers |
|
|
22
|
+
| `DeploymentsFile` | `.arkitekt/deployments.yaml`, the images a repo publishes | `arkitekt plugin publish` | kabinet's repo scan |
|
|
23
|
+
|
|
24
|
+
It depends only on pydantic and pyyaml. It deliberately does **not** depend on rekuest: the
|
|
25
|
+
implementations, states, locks and bloks inside an inspection are rekuest's language, and each
|
|
26
|
+
side validates them with its own rekuest models.
|
|
27
|
+
|
|
28
|
+
## Compatibility
|
|
29
|
+
|
|
30
|
+
Every envelope model **ignores** unknown keys. An inspection is written by the arkitekt inside
|
|
31
|
+
an image and read by the host CLI, and `deployments.yaml` is written by the CLI and read by a
|
|
32
|
+
kabinet server that upgrades on its own schedule. Adding a field is therefore a minor change
|
|
33
|
+
an older reader survives. A change an older reader must refuse bumps `spec_version`.
|
|
34
|
+
|
|
35
|
+
Selectors are the exception: they refuse unknown keys, because they are written by hand and a
|
|
36
|
+
typo must not silently widen a placement constraint.
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from arkitekt_spec import load_deployments, dump_deployments
|
|
40
|
+
|
|
41
|
+
file = load_deployments(open(".arkitekt/deployments.yaml").read())
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`python -m arkitekt_spec` prints the JSON Schema. The committed snapshot in
|
|
45
|
+
`tests/fixtures/deployments.schema.json` makes every format change show up in review.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# arkitekt-spec
|
|
2
|
+
|
|
3
|
+
The wire format of an Arkitekt app: one definition of *what an app is*, shared by everything
|
|
4
|
+
that produces or consumes it.
|
|
5
|
+
|
|
6
|
+
| Model | What it is | Produced by | Consumed by |
|
|
7
|
+
| --- | --- | --- | --- |
|
|
8
|
+
| `AppManifest`, `Requirement` | who the app is, which services it needs | arkitekt (from the `App`) | kabinet |
|
|
9
|
+
| `Inspection` | what the app declares (rekuest's action language, carried as JSON) | `arkitekt inspect all`, inside the image | arkitekt's plugin CLI, kabinet |
|
|
10
|
+
| `Selector` (`cpu`, `ram`, `cuda`, `rocm`, `oneapi`, `label`) | where a flavour may run | a flavour's `config.yaml` | kabinet, deployers |
|
|
11
|
+
| `DeploymentsFile` | `.arkitekt/deployments.yaml`, the images a repo publishes | `arkitekt plugin publish` | kabinet's repo scan |
|
|
12
|
+
|
|
13
|
+
It depends only on pydantic and pyyaml. It deliberately does **not** depend on rekuest: the
|
|
14
|
+
implementations, states, locks and bloks inside an inspection are rekuest's language, and each
|
|
15
|
+
side validates them with its own rekuest models.
|
|
16
|
+
|
|
17
|
+
## Compatibility
|
|
18
|
+
|
|
19
|
+
Every envelope model **ignores** unknown keys. An inspection is written by the arkitekt inside
|
|
20
|
+
an image and read by the host CLI, and `deployments.yaml` is written by the CLI and read by a
|
|
21
|
+
kabinet server that upgrades on its own schedule. Adding a field is therefore a minor change
|
|
22
|
+
an older reader survives. A change an older reader must refuse bumps `spec_version`.
|
|
23
|
+
|
|
24
|
+
Selectors are the exception: they refuse unknown keys, because they are written by hand and a
|
|
25
|
+
typo must not silently widen a placement constraint.
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from arkitekt_spec import load_deployments, dump_deployments
|
|
29
|
+
|
|
30
|
+
file = load_deployments(open(".arkitekt/deployments.yaml").read())
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`python -m arkitekt_spec` prints the JSON Schema. The committed snapshot in
|
|
34
|
+
`tests/fixtures/deployments.schema.json` makes every format change show up in review.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"""The wire format of an Arkitekt app.
|
|
2
|
+
|
|
3
|
+
One definition of what an app is, shared by everything that produces or consumes it:
|
|
4
|
+
arkitekt's plugin CLI writes it, and the kabinet server reads it.
|
|
5
|
+
|
|
6
|
+
- :class:`AppManifest` and :class:`Requirement`: who the app is, what services it needs.
|
|
7
|
+
- :class:`Inspection`: what the app declares, in the action language of :mod:`.actions`.
|
|
8
|
+
- :data:`Selector`: where a flavour of it may run.
|
|
9
|
+
- :class:`DeploymentsFile`: ``.arkitekt/deployments.yaml``, the images a repo publishes.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from typing import Any
|
|
13
|
+
|
|
14
|
+
from pydantic import TypeAdapter
|
|
15
|
+
|
|
16
|
+
from arkitekt_spec import actions
|
|
17
|
+
from arkitekt_spec.actions import definition_hash
|
|
18
|
+
from arkitekt_spec.deployment import (
|
|
19
|
+
DEPLOYMENTS_PATH,
|
|
20
|
+
SPEC_VERSION,
|
|
21
|
+
AppImage,
|
|
22
|
+
DeploymentsFile,
|
|
23
|
+
DockerImage,
|
|
24
|
+
dump_deployments,
|
|
25
|
+
load_deployments,
|
|
26
|
+
)
|
|
27
|
+
from arkitekt_spec.inspection import Inspection
|
|
28
|
+
from arkitekt_spec.manifest import (
|
|
29
|
+
DEFAULT_ENTRYPOINT,
|
|
30
|
+
UNKNOWN_AUTHOR,
|
|
31
|
+
AppManifest,
|
|
32
|
+
Requirement,
|
|
33
|
+
)
|
|
34
|
+
from arkitekt_spec.selectors import (
|
|
35
|
+
SELECTOR_KINDS,
|
|
36
|
+
BaseSelector,
|
|
37
|
+
CpuSelector,
|
|
38
|
+
CudaSelector,
|
|
39
|
+
LabelSelector,
|
|
40
|
+
OneApiSelector,
|
|
41
|
+
RamSelector,
|
|
42
|
+
RocmSelector,
|
|
43
|
+
Selector,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def json_schema() -> dict[str, Any]:
|
|
48
|
+
"""The JSON Schema of ``deployments.yaml`` (and, within it, of every other model)."""
|
|
49
|
+
return DeploymentsFile.model_json_schema(by_alias=True)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def selector_adapter() -> TypeAdapter[Selector]:
|
|
53
|
+
"""A validator for a single selector, dispatched on ``kind``."""
|
|
54
|
+
return TypeAdapter(Selector)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
__all__ = [
|
|
58
|
+
"DEFAULT_ENTRYPOINT",
|
|
59
|
+
"DEPLOYMENTS_PATH",
|
|
60
|
+
"SELECTOR_KINDS",
|
|
61
|
+
"SPEC_VERSION",
|
|
62
|
+
"UNKNOWN_AUTHOR",
|
|
63
|
+
"AppImage",
|
|
64
|
+
"AppManifest",
|
|
65
|
+
"BaseSelector",
|
|
66
|
+
"CpuSelector",
|
|
67
|
+
"CudaSelector",
|
|
68
|
+
"DeploymentsFile",
|
|
69
|
+
"DockerImage",
|
|
70
|
+
"Inspection",
|
|
71
|
+
"LabelSelector",
|
|
72
|
+
"OneApiSelector",
|
|
73
|
+
"RamSelector",
|
|
74
|
+
"Requirement",
|
|
75
|
+
"RocmSelector",
|
|
76
|
+
"Selector",
|
|
77
|
+
"actions",
|
|
78
|
+
"definition_hash",
|
|
79
|
+
"dump_deployments",
|
|
80
|
+
"json_schema",
|
|
81
|
+
"load_deployments",
|
|
82
|
+
"selector_adapter",
|
|
83
|
+
]
|