Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #306 +/- ##
==========================================
- Coverage 99.94% 99.80% -0.15%
==========================================
Files 43 44 +1
Lines 3470 3519 +49
==========================================
+ Hits 3468 3512 +44
- Misses 2 7 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@copilot Address the mypy problem |
There was a problem hiding this comment.
Pull request overview
This PR addresses readability concerns for retrospective DAG data (#304) by adding a notebook-friendly .view() method to retrospective NodeData objects, rendering them as structured/collapsible JSON via IPython’s JSON display helper.
Changes:
- Add
NodeData.view()plus internal helpers to serialize retrospective objects into JSON-friendly structures and display them withIPython.display.JSON. - Add unit tests for
.view()and the JSON display helper (skipped when IPython is unavailable). - Add a minimal
identityatomic in the static test library to support the new view tests.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/flowrep/retrospective/datastructures.py |
Adds .view() to NodeData and implements _to_jsonable + _display_json to produce notebook-friendly JSON output. |
tests/unit/test_retrospective_wfms.py |
Adds tests validating .view() behavior and the _display_json helper, gated on IPython availability. |
tests/flowrep_static/library.py |
Adds a simple identity atomic used by the new view tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
liamhuber
left a comment
There was a problem hiding this comment.
Yep, I love the way it looks too!
Only technical notes:
- At 40 lines, let's go ahead an refactor it over to its own module
flowrep.retrospective.viewer, and haveNodeData.viewjust call the view routine from there (should have no trouble with circular imports becauseviewershould only needNodeDatabehind aIF_TYPE_CHECKING:) - Let's have a backup
strrepresentation when ipython is not available;NodeData.viewturns intoviewer._view_json, write a simpleviewer._view_str, and haveviewer.viewbranch to either depending on_has_ipython - Formalize the optionality, but adding a new optional dependency section to the pyproject.toml -- I think
"dataviewer"is an ok name but don't feel strongly - Fix the coverage by adding ipython to the
.ci_support/environment-optional.yml; the CI is already set up so this will get it into the main testing cycle and clock our coverage, but the skipif stuff is still brilliant because we also do a separate test run without these optional dependencies
I don't really care how pretty this is; if you're feeling lazy |
@copilot Address these points |
… dataviewer optional dep
|
oh my goodness what can I do without AI... |
liamhuber
left a comment
There was a problem hiding this comment.
Let's do Niklas' reprjson idea as well, then I'm happy
| Display this data object as structured JSON in a notebook and return the display | ||
| object. Falls back to a plain-text representation when IPython is not available. | ||
| """ | ||
| from flowrep.retrospective import viewer |
There was a problem hiding this comment.
Ruff should complain about this non-head import. Since viewer only imports this module behind a type checking flag, it should be perfectly safe to move this up to the top
|
And the moment this is in we can go ahead and make a patch release. It's great and simple so let's get it available |
Closes #304
I absolutely love it