Skip to content

Merge util file into utils folder - #92

Merged
gselzer merged 7 commits into
pyapp-kit:mainfrom
gselzer:merge-utils
Nov 18, 2026
Merged

gselzer merged 7 commits into
pyapp-kit:mainfrom
gselzer:merge-utils

Conversation

@gselzer

@gselzer gselzer commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Closes #91.

The functions that previously existed in scenex.util have been moved to either scenex.util._app or scenex.util._tree. The way things got partitioned out, all of the functions moved to scenex.util._app are still exported by the toplevel scenex module. We could also make scenex.util._app public at some point if there's reason to do so.

@tlambert03 note that as a part of this, I've made your tree_repr and tree_dict functions private. I think that's fine, they're more debugging tools than API that should be depended on - let me know if you disagree

@gselzer

gselzer commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator Author

Alternatively, tree_repr and tree_dict could just go into scenex.model._nodes/node.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR consolidates the former scenex.util helpers into the scenex.utils package, splitting app-related utilities into scenex.utils._app and tree/debug helpers into scenex.utils._tree, and updates internal imports/tests accordingly.

Changes:

  • Added scenex.utils._tree with tree_repr/tree_dict and removed the same logic from the app utilities module.
  • Updated exports so scenex.utils exposes app-level helpers (show, run, etc.) and scenex top-level imports those from scenex.utils._app.
  • Updated tests and Node.tree_repr() to use the new locations.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/test_basic_scene.py Updates tests to call tree helpers from the new location (currently needs an explicit import of the _tree submodule).
src/scenex/utils/_tree.py New module containing tree debugging utilities (contains a leaf-detection bug for generator-like children).
src/scenex/utils/_app.py Removes tree utilities and focuses on application/canvas helpers; updates a backend registry import.
src/scenex/utils/init.py Re-exports app helpers from _app as the scenex.utils public surface.
src/scenex/model/_nodes/node.py Updates Node.tree_repr() to import tree_repr from scenex.utils._tree.
src/scenex/init.py Updates top-level exports to import app helpers from scenex.utils._app (breaking change for import scenex.util consumers unless shimmed).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_basic_scene.py Resolved
Comment thread tests/test_basic_scene.py Resolved
Comment thread src/scenex/utils/_tree.py Resolved
Comment thread src/scenex/__init__.py Resolved
@codecov

codecov Bot commented Jun 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.50000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.86%. Comparing base (12a1e02) to head (fbce0ed).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/scenex/utils/_tree.py 82.85% 6 Missing ⚠️
src/scenex/model/_nodes/node.py 0.00% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (82.50%) is below the target coverage (85.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #92   +/-   ##
=======================================
  Coverage   88.86%   88.86%           
=======================================
  Files          64       65    +1     
  Lines        3349     3350    +1     
=======================================
+ Hits         2976     2977    +1     
  Misses        373      373           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

These imports were new anyways, so it doesn't hurt to remove them and
just keep them importable from the base package (where they already
were)
@gselzer
gselzer merged commit 21675e1 into pyapp-kit:main Nov 18, 2026
39 of 40 checks passed
@gselzer
gselzer deleted the merge-utils branch November 18, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Merge scenex.util into scenex.utils

2 participants