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.
Found while reviewing PR #360 commit
c8adb33b(EPICS CA multi-root softioc with id-based PV prefix).The 13
docs/snippets/*.pyfiles (e.g.static08.py,dynamic.py) had theirEpicsIOCOptions(pv_prefix="DEMO")arg removed whenEpicsIOCOptionswas deleted, but none of them gained a correspondingcontroller.set_id(...)call. They still passtests/test_docs_snippets.pybecauserunpy.run_pathonly executes the module body — which constructsFastCS(...)but never callsfastcs.run(). Sotransport.connectnever fires andpv_prefix_from_path([])never raises.A reader who copies a tutorial snippet and adds
fastcs.run()will get: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 explaincontroller.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 constructingFastCS(...)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.