Skip to content

Merge util file into utils folder#92

Open
gselzer wants to merge 6 commits into
pyapp-kit:mainfrom
gselzer:merge-utils
Open

Merge util file into utils folder#92
gselzer wants to merge 6 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 Outdated
Comment thread tests/test_basic_scene.py Outdated
Comment thread src/scenex/utils/_tree.py
Comment thread src/scenex/__init__.py
@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.13%. Comparing base (c719690) to head (0303c95).

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 (83.33%) 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.12%   88.13%           
=======================================
  Files          64       65    +1     
  Lines        3309     3311    +2     
=======================================
+ Hits         2916     2918    +2     
  Misses        393      393           

☔ 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.

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