Skip to content

EPICS tutorial snippets drop pv_prefix but never call set_id #363

Closed

Description

@gilesknap

Found while reviewing PR #360 commit c8adb33b (EPICS CA multi-root softioc with id-based PV prefix).

The 13 docs/snippets/*.py files (e.g. static08.py, dynamic.py) had their EpicsIOCOptions(pv_prefix="DEMO") arg removed when EpicsIOCOptions was deleted, but none of them gained a corresponding controller.set_id(...) call. They still pass tests/test_docs_snippets.py because runpy.run_path only executes the module body — which constructs FastCS(...) but never calls fastcs.run(). So transport.connect never fires and pv_prefix_from_path([]) never raises.

A reader who copies a tutorial snippet and adds fastcs.run() will get:

ValueError: Cannot derive a PV prefix from an empty path

with no obvious indication that they need to set an id.

The companion how-to docs (docs/how-to/multiple-transports.md, docs/how-to/launch-framework.md) do explain controller.set_id(...), so the answer is somewhere in the tree — but the tutorial snippets that demonstrate EPICS aren't self-contained anymore.

Suggested fix: add controller.set_id("DEMO") (or the snippet-appropriate name) before constructing FastCS(...) in any snippet that wires up an EPICS transport. Equivalent for any snippet that wires up REST.

Filed by: PR #360 commit-by-commit review.

Activity

  1. self-assigned this
    on May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions