object-tree 3.1.0__tar.gz → 4.0.0a1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- object_tree-4.0.0a1/CHANGELOG.md +161 -0
- object_tree-4.0.0a1/LICENSE +21 -0
- object_tree-4.0.0a1/MANIFEST.in +10 -0
- object_tree-4.0.0a1/PKG-INFO +166 -0
- object_tree-4.0.0a1/README.md +139 -0
- object_tree-4.0.0a1/docs/audit.md +61 -0
- object_tree-4.0.0a1/docs/contracts.md +224 -0
- object_tree-4.0.0a1/docs/history/Analysis_NestedSelectionIdea.md +276 -0
- object_tree-4.0.0a1/docs/history/NestedSelectionIdea.md +1014 -0
- object_tree-4.0.0a1/docs/implementation-receipt.md +256 -0
- object_tree-4.0.0a1/docs/migration.md +145 -0
- object_tree-4.0.0a1/docs/roadmap.md +59 -0
- object_tree-4.0.0a1/examples/README.md +44 -0
- {object_tree-3.1.0 → object_tree-4.0.0a1}/pyproject.toml +7 -4
- object_tree-4.0.0a1/src/object_tree/__init__.py +89 -0
- object_tree-4.0.0a1/src/object_tree/adapter.py +111 -0
- object_tree-4.0.0a1/src/object_tree/context.py +74 -0
- object_tree-4.0.0a1/src/object_tree/diagnostics.py +53 -0
- object_tree-4.0.0a1/src/object_tree/events.py +100 -0
- object_tree-4.0.0a1/src/object_tree/examples/__init__.py +1 -0
- {object_tree-3.1.0/demo → object_tree-4.0.0a1/src/object_tree/examples}/app.py +14 -23
- object_tree-4.0.0a1/src/object_tree/examples/nested.py +83 -0
- object_tree-4.0.0a1/src/object_tree/examples/nested_app.py +110 -0
- {object_tree-3.1.0/demo → object_tree-4.0.0a1/src/object_tree/examples}/scene.py +6 -8
- object_tree-4.0.0a1/src/object_tree/hittest.py +22 -0
- {object_tree-3.1.0/core → object_tree-4.0.0a1/src/object_tree}/inspector.py +43 -2
- {object_tree-3.1.0/core → object_tree-4.0.0a1/src/object_tree}/interaction.py +14 -4
- object_tree-4.0.0a1/src/object_tree/node.py +246 -0
- object_tree-4.0.0a1/src/object_tree/property.py +87 -0
- object_tree-4.0.0a1/src/object_tree/regions.py +72 -0
- {object_tree-3.1.0 → object_tree-4.0.0a1/src/object_tree}/rules/boolean_flags.py +5 -7
- {object_tree-3.1.0 → object_tree-4.0.0a1/src/object_tree}/rules/function.py +3 -3
- object_tree-4.0.0a1/src/object_tree/selection.py +137 -0
- object_tree-4.0.0a1/src/object_tree/viewport.py +180 -0
- object_tree-4.0.0a1/src/object_tree/viewport_system.py +120 -0
- object_tree-4.0.0a1/src/object_tree.egg-info/PKG-INFO +166 -0
- object_tree-4.0.0a1/src/object_tree.egg-info/SOURCES.txt +58 -0
- object_tree-4.0.0a1/src/object_tree.egg-info/requires.txt +8 -0
- object_tree-4.0.0a1/src/object_tree.egg-info/top_level.txt +1 -0
- object_tree-4.0.0a1/tests/test_adapter.py +75 -0
- object_tree-3.1.0/demo/tests/test_scene.py → object_tree-4.0.0a1/tests/test_demo.py +4 -9
- {object_tree-3.1.0 → object_tree-4.0.0a1}/tests/test_hittest.py +2 -2
- {object_tree-3.1.0 → object_tree-4.0.0a1}/tests/test_inspector.py +3 -3
- object_tree-4.0.0a1/tests/test_integrity.py +109 -0
- {object_tree-3.1.0 → object_tree-4.0.0a1}/tests/test_interaction.py +6 -6
- object_tree-4.0.0a1/tests/test_model_contracts.py +180 -0
- object_tree-4.0.0a1/tests/test_nested_demo.py +28 -0
- {object_tree-3.1.0 → object_tree-4.0.0a1}/tests/test_node.py +124 -5
- object_tree-4.0.0a1/tests/test_projection_spatial.py +146 -0
- object_tree-4.0.0a1/tests/test_rule_contracts.py +84 -0
- {object_tree-3.1.0 → object_tree-4.0.0a1}/tests/test_rules.py +5 -7
- {object_tree-3.1.0 → object_tree-4.0.0a1}/tests/test_selection.py +8 -5
- {object_tree-3.1.0 → object_tree-4.0.0a1}/tests/test_viewport.py +45 -4
- {object_tree-3.1.0 → object_tree-4.0.0a1}/tests/test_viewport_system.py +8 -6
- object_tree-4.0.0a1/tools/verify_distribution.py +127 -0
- object_tree-4.0.0a1/unified_publish.py +11 -0
- object_tree-3.1.0/PKG-INFO +0 -190
- object_tree-3.1.0/README.md +0 -169
- object_tree-3.1.0/core/__init__.py +0 -68
- object_tree-3.1.0/core/adapter.py +0 -83
- object_tree-3.1.0/core/hittest.py +0 -45
- object_tree-3.1.0/core/node.py +0 -119
- object_tree-3.1.0/core/selection.py +0 -72
- object_tree-3.1.0/core/viewport.py +0 -169
- object_tree-3.1.0/core/viewport_system.py +0 -84
- object_tree-3.1.0/demo/tests/__init__.py +0 -0
- object_tree-3.1.0/object_tree.egg-info/PKG-INFO +0 -190
- object_tree-3.1.0/object_tree.egg-info/SOURCES.txt +0 -33
- object_tree-3.1.0/object_tree.egg-info/requires.txt +0 -3
- object_tree-3.1.0/object_tree.egg-info/top_level.txt +0 -3
- object_tree-3.1.0/tests/test_adapter.py +0 -41
- {object_tree-3.1.0 → object_tree-4.0.0a1}/setup.cfg +0 -0
- {object_tree-3.1.0 → object_tree-4.0.0a1/src/object_tree}/rules/__init__.py +0 -0
- {object_tree-3.1.0 → object_tree-4.0.0a1/src}/object_tree.egg-info/dependency_links.txt +0 -0
- {object_tree-3.1.0/demo → object_tree-4.0.0a1/tests}/__init__.py +0 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [4.0.0a1] — Unreleased stabilization alpha
|
|
4
|
+
|
|
5
|
+
### Breaking changes
|
|
6
|
+
|
|
7
|
+
- Install only the `object_tree` namespace from a src layout; remove generic
|
|
8
|
+
core/rules/demo packages. See [migration](docs/migration.md).
|
|
9
|
+
- Identity equality/hash and controlled, validated hierarchy mutation with
|
|
10
|
+
read-only parent/children. Iterative traversal and source adaptation.
|
|
11
|
+
- Unified ordered selection with an active member and immutable secondary view;
|
|
12
|
+
replacement and toggle semantics explicitly replace independent current/multi.
|
|
13
|
+
- Remove inert requires_parent_visible. Validate immutable built-in geometry;
|
|
14
|
+
clickability requires a region. DictAdapter typed values use TypedProperty.
|
|
15
|
+
- Property identifiers no longer modify PROPERTY_TYPES. Adapter IDs no longer
|
|
16
|
+
fall back to display names; optional methods work for structural adapters.
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- Selection snapshots, configurable EditingContext, property metadata/default
|
|
21
|
+
sentinel, validation and external bindings; hierarchical/multi-object inspection.
|
|
22
|
+
- Typed post-mutation events, ordered reentrant dispatch, notification batching.
|
|
23
|
+
- Parameterized target-relative RelationshipRule vocabulary; explicit viewport
|
|
24
|
+
snapshots, all-hit queries, independent interaction priority and custom HitRegion.
|
|
25
|
+
- Structured short-circuit diagnostics; headless/deeply nested GUI examples.
|
|
26
|
+
- Standalone MIT license, installed-wheel/sdist verification and Python 3.10–3.14
|
|
27
|
+
CI, optional-demo smoke checks, manual verification-gated trusted publication.
|
|
28
|
+
|
|
29
|
+
### Compatibility
|
|
30
|
+
|
|
31
|
+
- Historical SelfOrAncestorSelectedRule retains selected-descendant behavior with
|
|
32
|
+
deprecation warning. Use SelfOrDescendantSelectedRule for the same behavior.
|
|
33
|
+
- refresh/update methods are deprecated and now return evaluated snapshots.
|
|
34
|
+
- Existing custom adapter typed tuples remain valid; DictAdapter tuples are values.
|
|
35
|
+
- Preserve original design documents unchanged under docs/history.
|
|
36
|
+
- Remove tracked generated artifacts; old publisher becomes verification-only.
|
|
37
|
+
|
|
38
|
+
### Deliberately deferred
|
|
39
|
+
|
|
40
|
+
Reconciliation, bulk transactional writes, general spatial-selection geometry,
|
|
41
|
+
undo stacks and toolkit integration frameworks. See [roadmap](docs/roadmap.md).
|
|
42
|
+
|
|
43
|
+
## [3.2.0] — 2026-07-04
|
|
44
|
+
|
|
45
|
+
### Chromatica2 Integration Support
|
|
46
|
+
|
|
47
|
+
#### Added
|
|
48
|
+
|
|
49
|
+
- **`core/node.py`: adapter back-reference (R1)** — `InspectableObject` now has a `kind`, `uid`, and `adapter` field. The `adapter` field stores a reference to the source adapter that created the node, enabling reverse lookups from the object tree back to the original data model.
|
|
50
|
+
|
|
51
|
+
- **`core/adapter.py`: `get_kind()` / `get_id()` on protocol (R2)** — `InspectableAdapter` protocol gained optional `get_kind()` (discriminator string like `"point"`, `"group"`) and `get_id()` (stable unique identifier). `DictAdapter` supports `"kind"` and `"uid"` keys. `adapt()` now stores these on the generated nodes.
|
|
52
|
+
|
|
53
|
+
- **`core/node.py`: tree traversal utilities (R3)** — `InspectableObject` gained `walk()` (DFS pre-order generator), `walk_up()` (self-to-root iterator), `find()` (first match by kind/name/uid), and `find_all()` (all matches). Standalone `walk_tree()` convenience function added.
|
|
54
|
+
|
|
55
|
+
- **`core/node.py`: auto-register property types (R4)** — `Property.__post_init__` now adds unknown types to `PROPERTY_TYPES` instead of raising `ValueError`. Consumers can use any string as a property type without manual registration.
|
|
56
|
+
|
|
57
|
+
- **`core/viewport.py`: multi-selection aware rules (R5)** — Two new rules: `SelfInMultiRule` (true when object is in `selection.multi`) and `SelfOrAncestorInMultiRule` (true when object or any ancestor is in `selection.multi`). Enables additive selection via Shift+click to trigger visibility/selectability rules.
|
|
58
|
+
|
|
59
|
+
#### Fixed
|
|
60
|
+
|
|
61
|
+
- **`core/selection.py`: `toggle_multi()` bug** — When `selection.current` was not None, the first call to `toggle_multi` would incorrectly add then immediately remove the object, leaving `_multi = None`. Now initializes with an empty set and lets the add/remove logic handle it naturally.
|
|
62
|
+
|
|
63
|
+
#### Changed
|
|
64
|
+
|
|
65
|
+
- `pyproject.toml` v3.2.0
|
|
66
|
+
- `core/__init__.py` exports: added `walk_tree`, `SelfInMultiRule`, `SelfOrAncestorInMultiRule`
|
|
67
|
+
|
|
68
|
+
## [3.1.0] — 2026-07-02
|
|
69
|
+
|
|
70
|
+
### Documentation & Build Fixes
|
|
71
|
+
|
|
72
|
+
#### Added
|
|
73
|
+
|
|
74
|
+
- **Full docstrings** — All public API functions, classes, and methods across `core/` and `rules/` now have descriptive docstrings.
|
|
75
|
+
- **`demo/README.md`** — Documents the DearPyGui demo structure, scene layout, and interaction.
|
|
76
|
+
- **Roadmap** — `README.md` now includes a detailed roadmap covering events, undo/redo, multi-select, adapters, performance, and future ideas.
|
|
77
|
+
|
|
78
|
+
#### Changed
|
|
79
|
+
|
|
80
|
+
- **`README.md`** — Replaced draft AI-generated placeholder with a proper project README including installation, quick start, architecture overview, key concepts, roadmap, and contributing guide.
|
|
81
|
+
- **`pyproject.toml`** v3.1.0 — Build backend fixed from `setuptools.backends._legacy` (removed in setuptools 82) to `setuptools.build_meta`. Package find patterns corrected from `object_tree/*` to `core/*`, `rules/*`, `demo/*`. License field migrated from TOML table to SPDX string to eliminate deprecation warnings.
|
|
82
|
+
- **Root `__init__.py`** — Removed (unused relative imports that would break when installed).
|
|
83
|
+
- **`unified_publish.py`** — Build step now works correctly (was blocked by backend name).
|
|
84
|
+
|
|
85
|
+
## [3.0.0] — 2026-07-02
|
|
86
|
+
|
|
87
|
+
### Phase 3 — UI Toolkit Demo & Ancestor Selection Rule
|
|
88
|
+
|
|
89
|
+
#### Added
|
|
90
|
+
|
|
91
|
+
- **`core/viewport.py`: `AncestorSelectedRule`** — New rule that returns `True` when any ancestor of the target object is currently selected. Complements `SelfOrAncestorSelectedRule` (which checks if the target is above the selection) by checking if the selection is above the target. Enables children to become visible when grandparents or higher ancestors are selected.
|
|
92
|
+
|
|
93
|
+
- **`rules/boolean_flags.py`: `VisibilityFlags.reveal_when_ancestor_selected`** — New boolean flag that generates `AncestorSelectedRule()` in the visibility rule list. Makes an element visible when any of its ancestors (not just the direct parent) is selected.
|
|
94
|
+
|
|
95
|
+
- **`demo/` directory** — DearPyGui demo application at root level (soft dependency, not required by the core package). Contains:
|
|
96
|
+
- `demo/app.py` — DPG window with canvas + inspector panel, mouse click handler, full render/inspector refresh cycle
|
|
97
|
+
- `demo/scene.py` — Scene definition: two selectable squares, one with an inscribed circle, two perpendicular diameters, one diameter with two radius subsegments. Each object has editable properties (`fill_color`, `outline_color`, `line_color`, `name`).
|
|
98
|
+
- `demo/requirements.txt` — Lists `dearpygui>=1.10`
|
|
99
|
+
- `demo/tests/test_scene.py` — Tests for scene tree structure, visibility rules (squares always visible, circle revealed by parent selection, diameters/radii revealed by ancestor selection, sibling dynamics), inspector box stacking through the full 4-level hierarchy
|
|
100
|
+
|
|
101
|
+
#### Changed
|
|
102
|
+
|
|
103
|
+
- `pyproject.toml` v3.0.0 — Added `[project.optional-dependencies] demo = ["dearpygui>=1.10"]`. Package `find` includes `demo` and `demo.*`.
|
|
104
|
+
|
|
105
|
+
- `.github/workflows/tests.yml` — Added `demo-tests` job that installs dearpygui and runs `pytest demo/`. Core tests unchanged (still exclude `demo/tests/` via `testpaths=["tests"]`).
|
|
106
|
+
|
|
107
|
+
## [2.0.0] — 2026-07-02
|
|
108
|
+
|
|
109
|
+
### Phase 2 — Viewport System, Interaction, Adapters, Packaging & CI
|
|
110
|
+
|
|
111
|
+
#### Added
|
|
112
|
+
|
|
113
|
+
- **`core/hittest.py`** — Hit-testing utilities for all click region types. Includes `point_in_rect`, `point_in_circle`, `point_in_polygon`, and a dispatch `hit_test` function.
|
|
114
|
+
|
|
115
|
+
- **`core/viewport_system.py`** — `ViewportSystem` managing a collection of `ViewportElement`s. Provides `hit_test()` for point queries against clickable elements, `update_visibility()`/`update_selectability()` for bulk rule evaluation, and `refresh()` to re-evaluate all elements after a selection change.
|
|
116
|
+
|
|
117
|
+
- **`core/interaction.py`** — `InteractionController` coordinating the full click flow: hit-test → selection update → viewport refresh → optional callback. Provides `handle_click()`, `get_clickable_at()`, `select_object()`, and `get_inspector_stack()`.
|
|
118
|
+
|
|
119
|
+
- **`core/adapter.py`** — `InspectableAdapter` protocol for wrapping external object types into `InspectableObject`s. `DictAdapter` for adapting plain dicts. `adapt()` function as the generic conversion entry point.
|
|
120
|
+
|
|
121
|
+
- **`pyproject.toml`** — Package metadata for `object-tree` (v2.0.0). Zero runtime dependencies. Supports Python ≥3.10.
|
|
122
|
+
|
|
123
|
+
- **`.github/workflows/tests.yml`** — CI running `pytest` against Python 3.10–3.13 on every push/PR to `main`.
|
|
124
|
+
|
|
125
|
+
- **`.github/workflows/publish.yml`** — Automated PyPI publishing on tagged releases via `twine`.
|
|
126
|
+
|
|
127
|
+
- **Tests** — Pytest suites for hit-testing (17 tests), ViewportSystem (9 tests), InteractionController (7 tests), and adapter (3 tests).
|
|
128
|
+
|
|
129
|
+
#### Changed
|
|
130
|
+
|
|
131
|
+
- `ClickRegion` union type and region dataclasses (`RectRegion`, `CircleRegion`, `PolygonRegion`) moved to `core/viewport.py` (used by both viewport and hittest modules).
|
|
132
|
+
|
|
133
|
+
- Package exports expanded to include all new types and functions.
|
|
134
|
+
|
|
135
|
+
## [1.0.0] — 2026-07-02
|
|
136
|
+
|
|
137
|
+
### Phase 1 — Core Types & Protocol
|
|
138
|
+
|
|
139
|
+
Initial implementation of the nested selection and inspection framework.
|
|
140
|
+
|
|
141
|
+
#### Added
|
|
142
|
+
|
|
143
|
+
- **`core/node.py`** — `InspectableObject` dataclass with parent/child tree, property management, and ancestry/sibling relationship queries. `Property` dataclass with typed values.
|
|
144
|
+
|
|
145
|
+
- **`core/selection.py`** — `SelectionState` with centralized single selection (`current`/`previous`), optional multi-selection set, editing group root detection, and same-group membership checks.
|
|
146
|
+
|
|
147
|
+
- **`core/inspector.py`** — `InspectorSystem` that builds a stack of `BoxSpec` objects from a selected object by walking upward through parents. Respects `show_parent_box` stop condition. Supports ascending (root-first) and descending (leaf-first) order.
|
|
148
|
+
|
|
149
|
+
- **`core/viewport.py`** — `ViewportElement` connecting an inspectable object to its screen representation, click region types (`RectRegion`, `CircleRegion`, `PolygonRegion`), and a composable rule system (`BooleanRule`, `ParentSelectedRule`, `SelfOrAncestorSelectedRule`, `SiblingSelectedRule`, `SameGroupRule`, `AndRule`, `OrRule`, `NotRule`).
|
|
150
|
+
|
|
151
|
+
- **`rules/boolean_flags.py`** — `VisibilityFlags` and `SelectabilityFlags` dataclasses that translate boolean configurations into rule lists for easy viewport element setup.
|
|
152
|
+
|
|
153
|
+
- **`rules/function.py`** — `CustomRule` for arbitrary callable-based rules, plus convenience functions (`always_visible`, `always_hidden`, `always_selectable`, `always_not_selectable`).
|
|
154
|
+
|
|
155
|
+
- **Tests** — Pytest suite covering all core types, selection behavior, inspector box stacking, viewport element evaluation, rule composition, boolean flag translation, and the full Line/Segment example scenario from the design doc.
|
|
156
|
+
|
|
157
|
+
#### Architecture
|
|
158
|
+
|
|
159
|
+
- Zero dependencies (stdlib only: `dataclasses`, `typing`).
|
|
160
|
+
- Clean separation: object model ↔ selection state ↔ inspector system ↔ viewport rules.
|
|
161
|
+
- Framework-agnostic: no UI toolkit coupling.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 GrayJou
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
include LICENSE README.md CHANGELOG.md
|
|
2
|
+
recursive-include docs *.md
|
|
3
|
+
recursive-include examples *.md
|
|
4
|
+
recursive-include tests *.py
|
|
5
|
+
recursive-include tools *.py
|
|
6
|
+
include unified_publish.py
|
|
7
|
+
prune build
|
|
8
|
+
prune dist
|
|
9
|
+
prune _requests
|
|
10
|
+
global-exclude __pycache__ *.py[cod]
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: object-tree
|
|
3
|
+
Version: 4.0.0a1
|
|
4
|
+
Summary: A zero-dependency, general-purpose nested selection and inspection framework
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/GrayJou/object_tree
|
|
7
|
+
Project-URL: Repository, https://github.com/GrayJou/object_tree
|
|
8
|
+
Keywords: selection,inspection,viewport,editor,framework
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Provides-Extra: demo
|
|
21
|
+
Requires-Dist: dearpygui>=1.10; extra == "demo"
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
24
|
+
Requires-Dist: build>=1; extra == "dev"
|
|
25
|
+
Requires-Dist: twine>=6; extra == "dev"
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# ObjectTree
|
|
29
|
+
|
|
30
|
+
A small, zero-runtime-dependency Python foundation for hierarchical selection,
|
|
31
|
+
inspection and context-dependent interaction. Framework-agnostic: your domain
|
|
32
|
+
model stays authoritative and your application owns rendering and gestures.
|
|
33
|
+
|
|
34
|
+
**4.0.0a1 is a breaking stabilization alpha, not a published stable release.**
|
|
35
|
+
Public 3.1/3.2 imports and selection contracts differ; read the
|
|
36
|
+
[migration guide](docs/migration.md) before upgrading a consumer.
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
Python 3.10–3.14 is the supported test matrix. From this checkout:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
python -m pip install .
|
|
44
|
+
# Development and optional GUI example:
|
|
45
|
+
python -m pip install -e ".[dev]"
|
|
46
|
+
python -m pip install -e ".[demo]"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`pip install object-tree` installs the current public PyPI release, which may
|
|
50
|
+
not be this revision. Core uses only the standard library. DearPyGui belongs
|
|
51
|
+
solely to the optional demo extra and is imported only at GUI startup.
|
|
52
|
+
|
|
53
|
+
## Quick start
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from object_tree import (
|
|
57
|
+
InspectableObject, Property, SelectionState, InspectorSystem,
|
|
58
|
+
ViewportElement, ViewportSystem, RectRegion, RelationshipRule,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
curve = InspectableObject("Curve", kind="curve")
|
|
62
|
+
point = InspectableObject("Point", parent=curve)
|
|
63
|
+
point.add_property(Property("x", "float", 1.0, metadata={"unit": "px"}))
|
|
64
|
+
|
|
65
|
+
selection = SelectionState()
|
|
66
|
+
selection.replace([point])
|
|
67
|
+
boxes = InspectorSystem().get_box_stack(selection.active) # Curve → Point
|
|
68
|
+
|
|
69
|
+
viewport = ViewportSystem(selection)
|
|
70
|
+
viewport.add_element(ViewportElement(
|
|
71
|
+
point, RectRegion(0, 0, 20, 20), selectable=True,
|
|
72
|
+
visible_rules=[RelationshipRule("self_or_ancestor", subset="any")],
|
|
73
|
+
))
|
|
74
|
+
snapshot = viewport.evaluate()
|
|
75
|
+
assert snapshot.hit_test(10, 10).target is point
|
|
76
|
+
assert snapshot.visible_elements[0].target is point
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Architecture
|
|
80
|
+
|
|
81
|
+
| Subsystem | Responsibility |
|
|
82
|
+
|---|---|
|
|
83
|
+
| `object_tree.node` | Identity-based nodes, validated hierarchy, iterative traversal |
|
|
84
|
+
| `object_tree.selection` | Ordered membership, active/secondary selection, snapshots |
|
|
85
|
+
| `object_tree.context` | Configurable editing scopes independent of document roots |
|
|
86
|
+
| `object_tree.property` | Opaque type identifiers, metadata, validation, optional domain bindings |
|
|
87
|
+
| `object_tree.inspector` | Hierarchical boxes and multi-object inspection models |
|
|
88
|
+
| `object_tree.adapter` | Minimal structural protocol, fresh tree projections |
|
|
89
|
+
| `object_tree.viewport` / `rules` | Callable relationship/reveal/constraint policies |
|
|
90
|
+
| `object_tree.viewport_system` | Explicit evaluated states and ordered spatial candidates |
|
|
91
|
+
| `object_tree.regions` | Extensible `contains(x, y)` protocol and basic immutable regions |
|
|
92
|
+
| `object_tree.events` | Typed post-mutation events and notification batching |
|
|
93
|
+
| `object_tree.diagnostics` | Optional structured short-circuit rule explanations |
|
|
94
|
+
|
|
95
|
+
### Important contracts
|
|
96
|
+
|
|
97
|
+
- Nodes compare by identity. Display names, source IDs and paths are distinct.
|
|
98
|
+
- Parent and children are read-only. Use explicit mutation methods; adding an
|
|
99
|
+
already-parented child raises, while `reparent` transfers it atomically.
|
|
100
|
+
- Selection is ordered, deduplicated, and may span roots. Active belongs to it.
|
|
101
|
+
Removing active promotes the first remaining node. Detached nodes remain selected.
|
|
102
|
+
- New relationship names are target-relative. The historical misnamed
|
|
103
|
+
`SelfOrAncestorSelectedRule` is deprecated **without reversing its behavior**.
|
|
104
|
+
- Reveal alternatives use OR; mandatory constraints use AND. Semantic parentage
|
|
105
|
+
does not implicitly define representation visibility.
|
|
106
|
+
- A viewport snapshot freezes decisions, not the whole domain. Re-evaluate after
|
|
107
|
+
relevant changes, and share one snapshot between rendering and hit-testing.
|
|
108
|
+
- Arbitrary property type strings are allowed without mutating a global registry.
|
|
109
|
+
Metadata describes; validators enforce. Bound getters read the domain directly.
|
|
110
|
+
- Inspector boxes hold live descriptors. Multi-values use explicit MIXED/MISSING,
|
|
111
|
+
preserving None as a real value. Bulk domain writes are not implemented.
|
|
112
|
+
- Events are synchronous, ordered and post-mutation. Batching delays notifications;
|
|
113
|
+
it does not promise rollback. Share a dispatcher explicitly for model-wide events.
|
|
114
|
+
|
|
115
|
+
See [full contracts](docs/contracts.md), [migration](docs/migration.md), and
|
|
116
|
+
[audit](docs/audit.md). Original design documents remain unchanged in
|
|
117
|
+
[`docs/history`](docs/history).
|
|
118
|
+
|
|
119
|
+
## Examples
|
|
120
|
+
|
|
121
|
+
```sh
|
|
122
|
+
python -m object_tree.examples.nested # headless, stdlib only
|
|
123
|
+
python -m object_tree.examples.app # introductory DearPyGui shapes
|
|
124
|
+
python -m object_tree.examples.nested_app # Document → Group → Curve → Point → Handle
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The nested model demonstrates persistent curve scopes, multi-selection, mixed
|
|
128
|
+
values, live domain bindings, multiple representations, diagnostics and structural
|
|
129
|
+
events. See [example instructions](examples/README.md).
|
|
130
|
+
|
|
131
|
+
## Verification and release
|
|
132
|
+
|
|
133
|
+
```sh
|
|
134
|
+
python -m pytest -q -W error
|
|
135
|
+
python tools/verify_distribution.py
|
|
136
|
+
python tools/verify_distribution.py --demo
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The distribution verifier builds wheel + sdist, checks metadata/contents, installs
|
|
140
|
+
each with `--no-deps` in fresh virtual environments, imports all package modules,
|
|
141
|
+
runs the full copied tests outside the repository, and executes the headless
|
|
142
|
+
example. `--python PATH` is repeatable; `--output EMPTY_DIRECTORY` retains verified
|
|
143
|
+
artifacts. GUI-extra installation/import is separate from manual GUI validation.
|
|
144
|
+
|
|
145
|
+
CI targets `master`, tests Python 3.10–3.14 installed distributions, and tests the
|
|
146
|
+
optional demo on Windows/Python 3.12. Publication is manual, version-tag checked,
|
|
147
|
+
and depends on the complete verification workflow. Configure the `pypi` environment
|
|
148
|
+
and PyPI trusted publisher before authorized use. `unified_publish.py` now only
|
|
149
|
+
runs verification; it cannot upload. No release is created by these scripts.
|
|
150
|
+
|
|
151
|
+
## Non-goals and current limits
|
|
152
|
+
|
|
153
|
+
No rendering engine, cameras, GUI widgets, domain-specific adapters, networking,
|
|
154
|
+
general graph synchronization, expression parser, or undo/redo framework. Core
|
|
155
|
+
does not depend on consumer libraries. Bindings and adapters belong in host
|
|
156
|
+
integration layers, not as mandatory dependencies of mathematical libraries.
|
|
157
|
+
|
|
158
|
+
This alpha is synchronous and single-threaded. Reconciliation, transactional
|
|
159
|
+
bulk edits, general selection-region intersection and advanced geometry are
|
|
160
|
+
deliberately deferred. Predicates must be pure; tree mutation during traversal is
|
|
161
|
+
unsupported. See [roadmap](docs/roadmap.md) and [receipt](docs/implementation-receipt.md)
|
|
162
|
+
for verified results, remaining risks and publication recommendation.
|
|
163
|
+
|
|
164
|
+
## License
|
|
165
|
+
|
|
166
|
+
[MIT](LICENSE).
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# ObjectTree
|
|
2
|
+
|
|
3
|
+
A small, zero-runtime-dependency Python foundation for hierarchical selection,
|
|
4
|
+
inspection and context-dependent interaction. Framework-agnostic: your domain
|
|
5
|
+
model stays authoritative and your application owns rendering and gestures.
|
|
6
|
+
|
|
7
|
+
**4.0.0a1 is a breaking stabilization alpha, not a published stable release.**
|
|
8
|
+
Public 3.1/3.2 imports and selection contracts differ; read the
|
|
9
|
+
[migration guide](docs/migration.md) before upgrading a consumer.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Python 3.10–3.14 is the supported test matrix. From this checkout:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
python -m pip install .
|
|
17
|
+
# Development and optional GUI example:
|
|
18
|
+
python -m pip install -e ".[dev]"
|
|
19
|
+
python -m pip install -e ".[demo]"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`pip install object-tree` installs the current public PyPI release, which may
|
|
23
|
+
not be this revision. Core uses only the standard library. DearPyGui belongs
|
|
24
|
+
solely to the optional demo extra and is imported only at GUI startup.
|
|
25
|
+
|
|
26
|
+
## Quick start
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from object_tree import (
|
|
30
|
+
InspectableObject, Property, SelectionState, InspectorSystem,
|
|
31
|
+
ViewportElement, ViewportSystem, RectRegion, RelationshipRule,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
curve = InspectableObject("Curve", kind="curve")
|
|
35
|
+
point = InspectableObject("Point", parent=curve)
|
|
36
|
+
point.add_property(Property("x", "float", 1.0, metadata={"unit": "px"}))
|
|
37
|
+
|
|
38
|
+
selection = SelectionState()
|
|
39
|
+
selection.replace([point])
|
|
40
|
+
boxes = InspectorSystem().get_box_stack(selection.active) # Curve → Point
|
|
41
|
+
|
|
42
|
+
viewport = ViewportSystem(selection)
|
|
43
|
+
viewport.add_element(ViewportElement(
|
|
44
|
+
point, RectRegion(0, 0, 20, 20), selectable=True,
|
|
45
|
+
visible_rules=[RelationshipRule("self_or_ancestor", subset="any")],
|
|
46
|
+
))
|
|
47
|
+
snapshot = viewport.evaluate()
|
|
48
|
+
assert snapshot.hit_test(10, 10).target is point
|
|
49
|
+
assert snapshot.visible_elements[0].target is point
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Architecture
|
|
53
|
+
|
|
54
|
+
| Subsystem | Responsibility |
|
|
55
|
+
|---|---|
|
|
56
|
+
| `object_tree.node` | Identity-based nodes, validated hierarchy, iterative traversal |
|
|
57
|
+
| `object_tree.selection` | Ordered membership, active/secondary selection, snapshots |
|
|
58
|
+
| `object_tree.context` | Configurable editing scopes independent of document roots |
|
|
59
|
+
| `object_tree.property` | Opaque type identifiers, metadata, validation, optional domain bindings |
|
|
60
|
+
| `object_tree.inspector` | Hierarchical boxes and multi-object inspection models |
|
|
61
|
+
| `object_tree.adapter` | Minimal structural protocol, fresh tree projections |
|
|
62
|
+
| `object_tree.viewport` / `rules` | Callable relationship/reveal/constraint policies |
|
|
63
|
+
| `object_tree.viewport_system` | Explicit evaluated states and ordered spatial candidates |
|
|
64
|
+
| `object_tree.regions` | Extensible `contains(x, y)` protocol and basic immutable regions |
|
|
65
|
+
| `object_tree.events` | Typed post-mutation events and notification batching |
|
|
66
|
+
| `object_tree.diagnostics` | Optional structured short-circuit rule explanations |
|
|
67
|
+
|
|
68
|
+
### Important contracts
|
|
69
|
+
|
|
70
|
+
- Nodes compare by identity. Display names, source IDs and paths are distinct.
|
|
71
|
+
- Parent and children are read-only. Use explicit mutation methods; adding an
|
|
72
|
+
already-parented child raises, while `reparent` transfers it atomically.
|
|
73
|
+
- Selection is ordered, deduplicated, and may span roots. Active belongs to it.
|
|
74
|
+
Removing active promotes the first remaining node. Detached nodes remain selected.
|
|
75
|
+
- New relationship names are target-relative. The historical misnamed
|
|
76
|
+
`SelfOrAncestorSelectedRule` is deprecated **without reversing its behavior**.
|
|
77
|
+
- Reveal alternatives use OR; mandatory constraints use AND. Semantic parentage
|
|
78
|
+
does not implicitly define representation visibility.
|
|
79
|
+
- A viewport snapshot freezes decisions, not the whole domain. Re-evaluate after
|
|
80
|
+
relevant changes, and share one snapshot between rendering and hit-testing.
|
|
81
|
+
- Arbitrary property type strings are allowed without mutating a global registry.
|
|
82
|
+
Metadata describes; validators enforce. Bound getters read the domain directly.
|
|
83
|
+
- Inspector boxes hold live descriptors. Multi-values use explicit MIXED/MISSING,
|
|
84
|
+
preserving None as a real value. Bulk domain writes are not implemented.
|
|
85
|
+
- Events are synchronous, ordered and post-mutation. Batching delays notifications;
|
|
86
|
+
it does not promise rollback. Share a dispatcher explicitly for model-wide events.
|
|
87
|
+
|
|
88
|
+
See [full contracts](docs/contracts.md), [migration](docs/migration.md), and
|
|
89
|
+
[audit](docs/audit.md). Original design documents remain unchanged in
|
|
90
|
+
[`docs/history`](docs/history).
|
|
91
|
+
|
|
92
|
+
## Examples
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
python -m object_tree.examples.nested # headless, stdlib only
|
|
96
|
+
python -m object_tree.examples.app # introductory DearPyGui shapes
|
|
97
|
+
python -m object_tree.examples.nested_app # Document → Group → Curve → Point → Handle
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The nested model demonstrates persistent curve scopes, multi-selection, mixed
|
|
101
|
+
values, live domain bindings, multiple representations, diagnostics and structural
|
|
102
|
+
events. See [example instructions](examples/README.md).
|
|
103
|
+
|
|
104
|
+
## Verification and release
|
|
105
|
+
|
|
106
|
+
```sh
|
|
107
|
+
python -m pytest -q -W error
|
|
108
|
+
python tools/verify_distribution.py
|
|
109
|
+
python tools/verify_distribution.py --demo
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The distribution verifier builds wheel + sdist, checks metadata/contents, installs
|
|
113
|
+
each with `--no-deps` in fresh virtual environments, imports all package modules,
|
|
114
|
+
runs the full copied tests outside the repository, and executes the headless
|
|
115
|
+
example. `--python PATH` is repeatable; `--output EMPTY_DIRECTORY` retains verified
|
|
116
|
+
artifacts. GUI-extra installation/import is separate from manual GUI validation.
|
|
117
|
+
|
|
118
|
+
CI targets `master`, tests Python 3.10–3.14 installed distributions, and tests the
|
|
119
|
+
optional demo on Windows/Python 3.12. Publication is manual, version-tag checked,
|
|
120
|
+
and depends on the complete verification workflow. Configure the `pypi` environment
|
|
121
|
+
and PyPI trusted publisher before authorized use. `unified_publish.py` now only
|
|
122
|
+
runs verification; it cannot upload. No release is created by these scripts.
|
|
123
|
+
|
|
124
|
+
## Non-goals and current limits
|
|
125
|
+
|
|
126
|
+
No rendering engine, cameras, GUI widgets, domain-specific adapters, networking,
|
|
127
|
+
general graph synchronization, expression parser, or undo/redo framework. Core
|
|
128
|
+
does not depend on consumer libraries. Bindings and adapters belong in host
|
|
129
|
+
integration layers, not as mandatory dependencies of mathematical libraries.
|
|
130
|
+
|
|
131
|
+
This alpha is synchronous and single-threaded. Reconciliation, transactional
|
|
132
|
+
bulk edits, general selection-region intersection and advanced geometry are
|
|
133
|
+
deliberately deferred. Predicates must be pure; tree mutation during traversal is
|
|
134
|
+
unsupported. See [roadmap](docs/roadmap.md) and [receipt](docs/implementation-receipt.md)
|
|
135
|
+
for verified results, remaining risks and publication recommendation.
|
|
136
|
+
|
|
137
|
+
## License
|
|
138
|
+
|
|
139
|
+
[MIT](LICENSE).
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Stabilization audit and dependency plan
|
|
2
|
+
|
|
3
|
+
Baseline: commit `5439e6e`, version 3.2.0. Read all implementation, tests,
|
|
4
|
+
README, changelog, original design documents, demo and publishing script.
|
|
5
|
+
`python -m pytest -q`: 122 passed; `python -m pytest -q tests demo/tests`:
|
|
6
|
+
145 passed (Python 3.14, Windows). Existing tests miss invariant violations.
|
|
7
|
+
|
|
8
|
+
## Verified findings
|
|
9
|
+
|
|
10
|
+
- Structural dataclass equality contradicts identity hashing, may recurse through
|
|
11
|
+
parent links and makes list removal unsafe for similar nodes.
|
|
12
|
+
- Public parent/children and unchecked construction/addition allow cycles,
|
|
13
|
+
duplicates, multiple parents and inconsistent links. DFS adaptation/traversal
|
|
14
|
+
recurse without depth or source-graph protection.
|
|
15
|
+
- Primary SelfOrAncestorSelectedRule actually checks selected descendants;
|
|
16
|
+
its tests and changelog establish that behavior. Multi counterpart checks
|
|
17
|
+
selected ancestors. README disagrees with primary implementation.
|
|
18
|
+
- requires_parent_visible does nothing. Refresh evaluates and discards results.
|
|
19
|
+
Object hierarchy cannot select an unambiguous parent representation.
|
|
20
|
+
- Multi-selection exposes its mutable set and is independent of primary state.
|
|
21
|
+
Editing group is always the entire root tree.
|
|
22
|
+
- Property construction mutates a global registry; inferred identifiers differ
|
|
23
|
+
from historical labels. No bindings, validation or change notifications.
|
|
24
|
+
- Inspector boxes copy mappings but retain live properties, not detached values.
|
|
25
|
+
- Protocol defaults fail for structural adapters; names are used as source IDs;
|
|
26
|
+
tuple-valued DictAdapter properties are ambiguous. Parent capability is unused.
|
|
27
|
+
- Installed packages occupy core/rules/demo. Optional demo imports can exit the
|
|
28
|
+
interpreter and manipulate sys.path. Tracked build copies, bytecode and egg-info
|
|
29
|
+
exist; dist files exist locally but are not tracked. No standalone LICENSE.
|
|
30
|
+
- setuptools>=69 does not guarantee SPDX metadata support (requires >=77).
|
|
31
|
+
Remote HEAD is master, CI targets main; advertised 3.14 omitted. Publication
|
|
32
|
+
has no test gate; the 863-line generic publisher can bypass verification.
|
|
33
|
+
|
|
34
|
+
## Release and consumer evidence (2026-11-25)
|
|
35
|
+
|
|
36
|
+
PyPI JSON https://pypi.org/pypi/object-tree/json lists 3.1.0 and 3.2.0,
|
|
37
|
+
each with wheel and sdist; latest is 3.2.0. Remote has no tags. `gh repo view`
|
|
38
|
+
and `gh release list` blocked by missing authentication; GitHub releases unverified.
|
|
39
|
+
Local Chromatica2 pyproject declares object-tree>=3.2.0. Its ui_prototype
|
|
40
|
+
object_tree_adapter.py, dpg_runner.py, lab_runner.py and adapter tests import core;
|
|
41
|
+
tests also assert registry mutation. This is a real migration dependency.
|
|
42
|
+
Targeted searches of curve_manager and Harmonic-Loop-Visualizer-Prototype found
|
|
43
|
+
no dependency declarations/imports; this is not an exhaustive consumer census.
|
|
44
|
+
The untracked _requests integration document is user material and is preserved.
|
|
45
|
+
|
|
46
|
+
## Implementation order
|
|
47
|
+
|
|
48
|
+
1. Unique src namespace, identity and atomic structural validation; retain
|
|
49
|
+
meaningful regression tests and archive original design unchanged.
|
|
50
|
+
2. Small event dispatch contract, ordered selection and immutable membership
|
|
51
|
+
snapshots; property validation/bindings and explicit scope resolution.
|
|
52
|
+
3. Target-relative relationship vocabulary with parameterized membership;
|
|
53
|
+
explicit viewport results and custom hit regions; controller state consistency.
|
|
54
|
+
4. Minimal adapter capabilities and graph rejection; inspection aggregation.
|
|
55
|
+
5. Examples, contracts and migration; packaging/license/CI verification gates.
|
|
56
|
+
6. Installed wheel/sdist testing outside checkout, review and coherent commits.
|
|
57
|
+
|
|
58
|
+
Use 4.0.0a1 to signal breaking contracts. No publication. Reconciliation, bulk
|
|
59
|
+
domain writes and generalized region queries require consumer contracts and will
|
|
60
|
+
be explicitly deferred rather than guessed. Event dispatch precedes any future
|
|
61
|
+
reconciliation. Core remains dependency-free.
|