build with uv, and preview locally instead of a second dataflow
validate / validate (push) Successful in 59m16s

The build command was `pip install .`, which is what upstream and the dora docs
use because `--uv` rewrites it. Spelling it `uv pip install .` means the
dataflow never installs through pip at all, whether or not `--uv` was passed.
The cost is that the node then needs a virtualenv to install into, so it must
be run with `--uv`; the README says so.

The second dataflow is gone. It existed to wire this node into dora-image-view
just to see the frames, which pulled another repository over the network and
needed a tag there. PREVIEW=true now opens a local window of the frames as they
are published, so checking a camera, an encoding or a flip needs this
repository alone. It shows the frame after the flip and the resize, so what is
on screen is what is sent, and it never opens under CI, where there is no
display.

That a source node can display its own output overlaps with what a viewer node
does. The overlap is the point: the alternative was a second repository in the
loop before you can tell whether a camera works.
This commit is contained in:
2026-09-15 06:09:12 -03:00
parent 3c0e0f327d
commit dc3960809a
6 changed files with 87 additions and 50 deletions
+23 -16
View File
@@ -18,7 +18,7 @@ nodes:
- id: camera
git: ssh://git@gitea.liria.cl:5001/liria/dora-webcam.git
tag: v0.1.0
build: pip install .
build: uv pip install .
path: dora-webcam
inputs:
tick: dora/timer/millis/33
@@ -26,24 +26,30 @@ nodes:
- image
```
Run the dataflow with `--uv` (`dora run dataflow.yml --uv`) so the node gets its own
managed environment.
Run the dataflow with `--uv` (`dora run dataflow.yml --uv`): the build command is
`uv pip install .`, so the node gets its own managed environment and never installs into
an ambient one.
### Runnable dataflows
### Runnable dataflow
Two dataflows live here, run one at a time — dora has no cross-dataflow wiring, so each
declares the camera itself:
[`dataflow.yml`](dataflow.yml) is the camera on its own, and is what CI runs:
Run either with `dora run <file> --uv`:
```bash
dora run dataflow.yml --uv
```
| File | Contents |
|---|---|
| [`dataflow.yml`](dataflow.yml) | The camera alone |
| [`dataflow_view.yml`](dataflow_view.yml) | The camera into `dora-image-view` |
Nothing consumes the frames, so to actually see them set `PREVIEW`:
`dataflow_view.yml` is the end-to-end check of the pair: it wires this node's `image`
output into the viewer's `image` input, so a window opens showing the webcam. It fetches
the viewer over the network, which is why CI validates and runs `dataflow.yml` only.
```bash
PREVIEW=true dora run dataflow.yml --uv
```
A window opens showing the frames as they are published. Press `q` to stop. That is
enough to check a camera, an encoding or a flip without wiring a second node — which is
why there is one dataflow here rather than one per consumer.
For a real pipeline, wire `image` into a viewer such as `dora-image-view` from your own
dataflow.
## Output
@@ -73,6 +79,7 @@ compressed encoding, `width` and `height` are the image's dimensions, not the le
| `ENCODING` | `bgr8` | One of `bgr8`, `rgb8`, `yuv420`, `jpeg`/`jpg`/`jpe`, `png`, `bmp`, `webp`. |
| `JPEG_QUALITY` | `95` | Quality 0-100, used only by the JPEG encodings. |
| `FLIP` | unset | `VERTICAL`, `HORIZONTAL` or `BOTH`. |
| `PREVIEW` | unset | `true` opens a window of the published frames; `q` stops the node. |
| `CAPTURE_FRAMES` | `0` | Stop after this many frames. 0 runs until the tick closes. |
Resizing only happens when both `IMAGE_WIDTH` and `IMAGE_HEIGHT` are set.
@@ -94,8 +101,8 @@ Every dependency ships prebuilt wheels for linux-x86_64, linux-aarch64 and macos
so the node installs with no system packages and no compiler.
**Requirements:** dora 1.0+ (verified with `dora-cli 1.0.1`), Python 3.11+, `uv`, and a
V4L2 camera. On a bare Linux image `opencv-python` also needs the libGL shared libraries
(`libgl1`, `libglib2.0-0`), which it links at import time.
V4L2 camera. `PREVIEW` also needs a display. On a bare Linux image `opencv-python` needs
the libGL shared libraries (`libgl1`, `libglib2.0-0`), which it links at import time.
## Test