object-tree
A zero-dependency Python framework for nested selection and inspection of hierarchical object trees. Framework-agnostic — no UI toolkit coupling.
Installation
pip install object-tree
Core has zero runtime dependencies (stdlib only). Optional demo requires DearPyGui:
pip install "object-tree[demo]"
Quick Start
from core.node import InspectableObject, Property
from core.selection import SelectionState
from core.viewport import RectRegion, ViewportElement
# Build an object tree
root = InspectableObject(name="Root")
child = InspectableObject(name="Child")
root.add_child(child)
# Add properties
child.add_property(Property("color", "Literal", "#FF5722"))
# Selection
sel = SelectionState()
sel.select(child)
print(sel.is_selected(child)) # True
# Viewport element with click region
elem = ViewportElement(target=child, click_region=RectRegion(x=0, y=0, width=100, height=100))
See the demo app for a complete DearPyGui example.
Architecture
object-tree/
core/ # Core framework (zero dependencies)
node.py InspectableObject tree, Property
selection.py SelectionState (single + multi)
inspector.py InspectorSystem, BoxSpec stack
viewport.py ViewportElement, click regions, Rule system
viewport_system.py ViewportSystem with hit-testing
hittest.py point-in-rect/circle/polygon
interaction.py InteractionController (click → select → refresh)
adapter.py DictAdapter, InspectableAdapter protocol
rules/ # Convenience rule builders
boolean_flags.py VisibilityFlags, SelectabilityFlags
function.py CustomRule, always_visible/hidden/selectable
demo/ # DearPyGui demo app (optional dep)
app.py DPG window with canvas + inspector panel
scene.py 4-level scene definition
Key Concepts
InspectableObject
Tree node with name, parent, children, properties, and show_parent_box flag (controls whether the inspector walks up to the parent).
SelectionState
Tracks a primary selected object (with previous selection) and an optional multi-selection set.
ViewportElement
Binds an InspectableObject to its on-screen representation. Controls visibility and selectability through composable rules:
| Rule | True when |
|---|---|
BooleanRule |
Always/never |
ParentSelectedRule |
The object's parent is selected |
SelfOrAncestorSelectedRule |
The object or an ancestor is the selection |
AncestorSelectedRule |
Any ancestor of the object is selected |
SiblingSelectedRule |
A sibling is selected |
SameGroupRule |
Same root tree as the selection |
Rules can be combined with AndRule, OrRule, NotRule.
VisibilityFlags / SelectabilityFlags
High-level flag classes that translate boolean configuration into rule lists:
from rules.boolean_flags import VisibilityFlags, SelectabilityFlags
flags = VisibilityFlags(
visible_by_default=False,
reveal_when_parent_selected=True,
remain_visible_when_self_selected=True,
)
flags.apply(element) # Sets element.visible_rules
Roadmap
v3.x — Current (Stabilization)
- Core object tree, selection, inspector, viewport rules
- Hit-testing (rect, circle, polygon)
- Interaction controller
- Dict adapter
- DearPyGui demo
- Ancestor selection rule
- Adapter back-reference, kind/ID, traversal utilities
- Multi-selection aware rules
- Auto-register property types
v4.0 — Events & Observability
- Selection change events (
on_selected,on_deselectedcallbacks) - Property change events / observable properties
- Tree mutation events (child added/removed)
-
InspectorSystemchange notification
v4.1 — Undo / Redo
- Command pattern for selection changes
- Command pattern for property edits
- Undo/redo stack with configurable depth
- Keyboard shortcuts integration
v5.0 — Multi-Select & Viewport
- Drag-select box for multi-selection
- Modifier-key based toggle selection (Ctrl+click, Shift+click)
- Viewport scrolling / panning
- Zoom support with coordinate transforms
v5.1 — Adapters & Interop
- Qt adapter (
QStandardItemModel↔InspectableObject) - Serialization adapter (JSON / YAML import/export)
- Property introspection from dataclasses / attrs
- Tree diff/patch for incremental updates
v6.0 — Performance & Tooling
- Virtual viewport (lazy element evaluation for large trees)
- Object tree search / filter by name or property
- Property validation framework (type, range, regex)
- Profiling hooks for rule evaluation
Future Ideas
- Drag and drop — Reorder objects within and across trees
- Templates — Reusable sub-tree blueprints
- Documentation site — mkdocs or readthedocs
- CLI tool — Inspect and manipulate object trees from the command line
- Remote inspection — WebSocket-based remote tree browser
- Game engine adapters — Godot, Unity, Unreal editor model adapters
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Make changes (zero-dependency core, please)
- Run tests (
pytest tests/) - Submit a pull request
License
MIT
Metadata
Release files for object-tree 3.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| object_tree-3.2.0.tar.gz | 26.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| object_tree-3.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 47.9 kB
Release files / object_tree-3.2.0.tar.gz
| Download URL | object_tree-3.2.0.tar.gz |
|---|---|
| Size | 26.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a3866379a0f238937e7a33c9a4cca68636cc197bf6eabd2b16d5c07f30e0a7fa
|
|
BLAKE2b-256 checksum How to use checksums |
2b078454b377a8b3f138e926a15051b9faf3cac5f1fb4d92b656ab364af09d93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / object_tree-3.2.0-py3-none-any.whl
| Download URL | object_tree-3.2.0-py3-none-any.whl |
|---|---|
| Size | 21.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca29df87c580f974341d0fa70fc29ae17f59b839569d38a652f6b52c68bbe07b
|
|
BLAKE2b-256 checksum How to use checksums |
e19f51d09d23231f846e960ac111c2e34d31b430cf4455dc4ea6d8386bce73c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for object-tree 3.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.