This release is a pre-release and may not be stable for production use.
Polyad types
Shared Python 3.11–3.14 resource, configuration and API models for Polyad. This
package provides the same definitions used by the operator and Python client,
including constructor validation, serialization and a py.typed marker.
Its only dependencies are attrs, cattrs and typing-extensions.
Table of contents
Installation
Install from a repository checkout:
pip install ./pkg/polyad-types
Release CI builds and publishes this distribution separately. Once that release
is available, install it with pip install polyad-types and import polyad_types.
Installing it does not install polyad or polyad-client.
Example
from polyad_types import (
Cheeger, Connection, Graph, Node, ObjectMeta, StructuralRule, Topology,
from_dict, to_dict, to_document,
)
layout = Topology(
nodes=(
Node(name="source", kind="Workload", ref="source"),
Node(name="sink", kind="Workload", ref="sink"),
),
connections=(Connection(source="source", target="sink"),),
)
graph = Graph(metadata=ObjectMeta(name="pipeline"), spec=to_dict(layout))
manifest = to_document(graph)
rule = from_dict(
{"relation": "connections", "cheeger": {"minimum": 0.5}},
StructuralRule,
)
assert rule.cheeger == Cheeger(minimum=0.5)
Public models
| Module | Public models |
|---|---|
polyad_types.resources |
Kubernetes resource envelopes, metadata, status metrics, capacity status and mutation plans |
polyad_types.topology |
Nodes, dependencies, connections, placement and graph specifications |
polyad_types.replication |
Replica templates, bounds and connection modes |
polyad_types.rules |
Structural, spectral and Cheeger configuration |
polyad_types.network |
Network access, peers, ports and traffic rules |
polyad_types.activation, capacity, storage |
Activation, advance capacity and persistence configuration |
polyad_types.requests |
Composition, activation and temporary connection requests |
polyad_types.events |
Event stream observations |
Top-level Graph, PolyGraph and Daemon are Kubernetes resource envelopes.
Topology describes a Graph's specification; polyad_types.topology.PolyGraph
describes a PolyGraph's specification. Resource spec dictionaries preserve
native Kubernetes extensions and should be populated from the relevant
configuration model when local validation is needed.
Reference a Daemon definition inside a persistent graph with
Node(name="server", kind="Daemon", ref="server"). The Daemon resource model
describes the reusable service definition; Node describes its place in a graph.
Serialization
to_dict(model) and from_dict(document, Model) serialize and validate models.
to_document(resource) and from_document(manifest) handle Kubernetes envelopes,
preserving unmodeled native fields and checking kind and API version. Configuration
and request decoding rejects unknown fields. These checks validate the supplied
document; live graph admission, Cheeger computation and reconciliation run in the
operator.
Client integration
The Python client accepts shared request objects:
from polyad_client import Client
from polyad_types import CompositionItem, CompositionRequest
request = CompositionRequest(
requestId="pipeline-1",
rootId="root",
objects=(CompositionItem(id="root", kind="Graph", spec={"nodes": []}),),
)
client = Client("http://polyad-api:8090", "configured-token")
receipt = client.compose(request)
From the repository root, install both local packages with
pip install ./pkg/polyad-types ./pkg/client. Release versions of the client
and operator depend on the matching polyad-types version.
Publishing
See manual PyPI publishing for Poetry release commands.
Metadata
Release files for polyad-types 0.0.1a3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| polyad_types-0.0.1a3.tar.gz | 52.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| polyad_types-0.0.1a3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 116.3 kB
Release files / polyad_types-0.0.1a3.tar.gz
| Download URL | polyad_types-0.0.1a3.tar.gz |
|---|---|
| Size | 52.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4009caa324bc9ca685912094b670e0b7a34e8e9f8c7c01c08fd7ea7380f2d86b
|
|
BLAKE2b-256 checksum How to use checksums |
209313e2bf7855d900649bc77dd3f16169ed33851257d85083608b67814899b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.11.12 Darwin/24.6.0
|
Release files / polyad_types-0.0.1a3-py3-none-any.whl
| Download URL | polyad_types-0.0.1a3-py3-none-any.whl |
|---|---|
| Size | 63.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a60f069f9c467f537864bba3761b9e72dc28175e8b9b457e05c4dde820dec9de
|
|
BLAKE2b-256 checksum How to use checksums |
1cbfebdb10a8bc5e6c945e345c45b5d13457261d568e4ecb2f41990107b9de46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.11.12 Darwin/24.6.0
|