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:
@@ -1,66 +0,0 @@
|
||||
# Manifest for the example source node.
|
||||
#
|
||||
# A manifest describes exactly one node, so a second node in this repository
|
||||
# gets a second manifest. This is the documented way to type a node you have
|
||||
# not published: "a dora-node.yml sitting next to a plain `path:` node is
|
||||
# picked up automatically" -- https://dora-rs.ai/dora/hub/node-manifest
|
||||
#
|
||||
# It is not optional here. `dora validate` matches a manifest to a `path:` node
|
||||
# by entrypoint; with no manifest beside examples/source.py the repository-root
|
||||
# one is tried against it, does not match its `dora-image-view` entrypoint, and
|
||||
# warns -- which `strict_types: true` turns into a failure.
|
||||
#
|
||||
# Declaring the types here rather than as `output_types:` in dataflow.yml is
|
||||
# what makes them checked: an inline annotation shadows the manifest, so the
|
||||
# manifest would be injected but never compared against dora-image-view's.
|
||||
apiVersion: 1
|
||||
name: source
|
||||
namespace: liria
|
||||
description: Synthetic image, depth, camera_info, bbox and text source for the dora-image-view example
|
||||
categories: [debug]
|
||||
keywords: [example, test, synthetic]
|
||||
|
||||
runtime: python
|
||||
entrypoint: source.py
|
||||
build: pip install .
|
||||
dora: ">=1.0"
|
||||
|
||||
inputs:
|
||||
tick:
|
||||
required: true
|
||||
description: Timer tick; one frame is emitted per tick.
|
||||
|
||||
outputs:
|
||||
image:
|
||||
type: std/core/v1/UInt8
|
||||
description: >-
|
||||
Animated bgr8 frame as a flat UInt8 buffer, with metadata
|
||||
{width, height, encoding}.
|
||||
bbox:
|
||||
description: >-
|
||||
The box around the moving square: an Arrow struct {bbox, conf, labels}
|
||||
with metadata {format: xyxy}. Untyped to match the dora-image-view input.
|
||||
text:
|
||||
type: std/core/v1/String
|
||||
description: A fixed caption.
|
||||
camera_info:
|
||||
type: std/core/v1/Float32
|
||||
description: >-
|
||||
[fx, fy, cx, cy] for the frames above. Published once, on the first tick,
|
||||
the way a real camera publishes it once per session.
|
||||
depth:
|
||||
type: std/core/v1/Float32
|
||||
description: >-
|
||||
Depth of the same scene in millimetres, [height, width]: a flat wall with
|
||||
the square standing in front of it.
|
||||
|
||||
env:
|
||||
SOURCE_WIDTH:
|
||||
type: int
|
||||
description: Frame width in pixels. Defaults to 640.
|
||||
SOURCE_HEIGHT:
|
||||
type: int
|
||||
description: Frame height in pixels. Defaults to 480.
|
||||
SOURCE_FRAMES:
|
||||
type: int
|
||||
description: Stop after this many frames. 0, the default, runs until the viewer quits.
|
||||
Reference in New Issue
Block a user