refactor: type the example source inline instead of shipping a manifest
A dora-node.yml describes exactly one node and is the unit `dora hub publish` operates on, which expects it beside pyproject.toml. This repository ships one node, so it should carry one manifest. examples/dora-node.yml described a test fixture that nobody installs and that has no package of its own -- a manifest for something that is not a node. The source's outputs are now annotated with `output_types:` in the dataflow, which is the documented way to type an output without a manifest: "only annotated outputs are type-checked". It runs as `path: python` + `args:` because `dora validate` matches a manifest to a `path:` node by entrypoint, so a path node would be tried against the root manifest, fail to match `dora-image-view`, and warn -- fatal under strict_types. Through the interpreter there is nothing to match. The type gate is unchanged in strength: the viewer's contract is still injected and compared against the source's annotations, and a deliberate Float32 -> String swap still fails validate. The cost is that the fixture no longer gets a managed venv of its own and runs against the project environment. That applies to the fixture only; the shipped node still uses path: + build:, which is what a consumer exercises. This supersedes the approach in "fix strict-type validation by giving the example source a manifest" and the doc commit that cited the manifest-next-to-a-path-node rule as justification.
This commit is contained in:
+22
-1
@@ -11,7 +11,21 @@ strict_types: true
|
||||
|
||||
nodes:
|
||||
- id: source
|
||||
path: examples/source.py
|
||||
# Run through the interpreter rather than as `path: examples/source.py`.
|
||||
#
|
||||
# A dora-node.yml describes exactly one node and is what gets published
|
||||
# (`dora hub publish` expects it beside pyproject.toml), and this
|
||||
# repository ships one node: dora-image-view. The example source is a test
|
||||
# fixture, not a node anyone installs, so it gets no manifest.
|
||||
#
|
||||
# That has a mechanical consequence. `dora validate` matches a manifest to
|
||||
# a `path:` node by entrypoint, so a path node here would be tried against
|
||||
# the root manifest, would not match its `dora-image-view` entrypoint, and
|
||||
# would warn -- which strict_types turns into a failure. Going through the
|
||||
# interpreter leaves nothing for it to match, and `output_types` below is
|
||||
# the documented way to type an output without one.
|
||||
path: python
|
||||
args: examples/source.py
|
||||
# The source needs dora-rs, numpy and pyarrow; installing the project gives
|
||||
# it exactly the versions pinned in uv.lock.
|
||||
build: pip install .
|
||||
@@ -23,6 +37,13 @@ nodes:
|
||||
- camera_info
|
||||
- bbox
|
||||
- text
|
||||
# bbox is deliberately absent: it is untyped on the viewer's side too,
|
||||
# because senders disagree on 32- vs 64-bit numeric fields.
|
||||
output_types:
|
||||
image: std/core/v1/UInt8
|
||||
text: std/core/v1/String
|
||||
depth: std/core/v1/Float32
|
||||
camera_info: std/core/v1/Float32
|
||||
|
||||
- id: view
|
||||
path: dora-image-view
|
||||
|
||||
Reference in New Issue
Block a user