PyRogue Tree Components And Concepts
A PyRogue tree is defined by the object model and runtime behavior of
Root, Device, Variable, and Command Nodes, with Block and
Model providing memory transaction grouping and typed value conversion.
A typical hierarchy starts at one Root and fans into multiple Device
subtrees. Each Device can contain child Device Nodes, Variable
Nodes, and Command Nodes. At runtime, the Root coordinates startup,
background polling, and system-wide read/write operations across that
hierarchy.
This subsection is intentionally split into foundational pages first and more
specialized mechanics later. Most readers should understand Root,
Device, Variable, and Command before diving into Block,
Model, polling internals, YAML bulk configuration, or stream adapters.
Minimal Tree Example
import pyrogue as pr
import pyrogue.interfaces
class DemoDevice(pr.Device):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.add(pr.LocalVariable(
name='Enable',
mode='RW',
value=False,
))
self.add(pr.LocalCommand(
name='Reset',
function=lambda: print('Reset requested'),
))
class DemoRoot(pr.Root):
def __init__(self):
super().__init__(name='DemoRoot', pollEn=False)
self.add(DemoDevice(name='App'))
# Optional: expose the running tree to remote clients.
self.addInterface(pyrogue.interfaces.ZmqServer(
root=self,
addr='127.0.0.1',
port=0,
))
This composition pattern is the foundation for most PyRogue applications:
Root owns lifecycle, Device organizes hardware/application structure,
and Variable/Command Nodes expose state and actions.
How To Read This Subsection
Use the core pages in this order:
Rootfor lifecycle, startup, and whole-tree control behavior.Devicefor composition, interface ownership, and block traversal.VariableandCommandfor the two main leaf-node interaction models.The subtype pages for local, remote, and link variants.
The more advanced mechanics pages once the tree model itself is familiar.
That ordering keeps the conceptual model stable before introducing the details of memory grouping, typed encoding, polling internals, and YAML bulk configuration.
Core Node Model
Node is the common base class for the full tree object model.
Every Root, Device, Variable, and Command inherits shared
identity and hierarchy behavior (name/path/root/parent relationships).
The shared responsibilities of Node-derived types include:
Stable hierarchical addressing and lookup
Group tagging/filtering support
Lifecycle attachment to a Root context
Shared logging/path conventions across all subclasses
Concrete Node Categories
Common Design Workflow
Define one
Rootfor lifecycle, top-level interfaces, and system actions.Partition the design into
Devicesubtrees by hardware/function boundary.Add
VariableandCommandNodes for control and telemetry procedures.Choose local, remote, or linked Node subtypes as needed.
Confirm memory mapping and typed conversion behavior through
BlockandModel.Expose remote access patterns for GUIs, scripts, notebooks, and clients.
Advanced Topics And Why They Are Separate
Some pages in this subsection are deliberately separated because they describe mechanics that matter a lot in real systems, but are usually not the right starting point:
Blockis about transaction grouping and memory access flow.Device Block Operationsis about recursiveDevicetraversal and sequencing of the*Blocksmethods.Modelis about typed byte conversion and custom encodings.Fixed-Point Modelsis a focused companion page forFixedandUFixedusage.Poll Queueis about background scheduling behavior.YAML Configurationis about YAML save/load workflows, matching rules, and configuration file structure.Memory Variable Streamis about bridging variable updates into stream processing paths.Groupsis about filtering and bulk-operation scoping.
Those topics belong in core because they define how the tree behaves, but they
are advanced enough that they read better as focused pages rather than as long
detours inside the introductory Root/Device/Variable docs.
What To Explore Next
Root lifecycle and orchestration: Root
Device composition and managed interfaces: Device
Variable behavior and types: Variable
Command behavior and invocation patterns: Command
Block transaction behavior: Blocks
Device block traversal and sequencing: Device Block Operations
Model conversion behavior: Model
Fixed-point model details: Fixed-Point Models
Poll scheduling behavior: PollQueue
YAML save/load behavior: YAML Configuration
Variable-to-stream adapter behavior: Variable Update Stream
API Reference
Python: Root, Device, BaseVariable, BaseCommand, Model
Core:
- Root
- Device
- What A Device Does
- Key Device Properties
- Composition And Tree Structure
- Managed Interfaces And Protocol Ownership
- Device Lifecycle Hooks
- Foundational Transaction Operations
- Device-Level Block APIs
- Relationship To The Memory Hub Model
- Operational Hooks And Decorators
- What To Explore Next
- API Reference
- Variable
- Command
- Blocks
- Device Block Operations
- Model
- Why Models Exist
- How Variables Select A Model
- What A Model Defines
- Built-In Model Families
- Built-In Model Types
- Fixed-Point Models
- Model Utility Helpers
- Model Instances And Caching
- Model Conversion Flow In Block Access
- Custom Model Example
- How
BitReversedUIntDiffers From Built-InUInt - What To Explore Next
- API Reference
- Fixed-Point Models
- PollQueue
- YAML Configuration
- Variable Update Stream
- Groups