Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

Fix viz bugs and bring graphblas/viz.py under test and coverage - #597

Open
eriknw wants to merge 6 commits into
39b-from-coo-broadcast-isofrom
17-viz-fixes
Open

eriknw wants to merge 6 commits into
39b-from-coo-broadcast-isofrom
17-viz-fixes

Conversation

@eriknw

@eriknw eriknw commented Aug 4, 2026 •

Copy link
Copy Markdown
Member

graphblas/viz.py had zero tests and was omitted from coverage. This branch
adds smoke tests, fixes the bugs the tests uncovered plus two reported in the
pyOpenSci review, and un-omits the module.

  • Add smoke tests (c5084cf): nine Agg-backend tests covering spy, draw,
    and datashade, with importorskip guards so minimal environments see clean
    skips.
  • Fix NameError in viz.spy (b7839b5): spy(A, figure=fig) and
    spy(A, axes=ax) both crashed because the fig local was only bound when
    spy created the figure itself. Regression tests cover both forms.
  • Fix datashade cell positioning ([pyos][visualization] viz.datashade() wrong positioning of matrix elements #473) and reciprocal edges in draw
    ([pyos][visualization] Reciprocal directed edges overlap #474)
    (e9be195): datashade rendered each element half a cell off
    from the tick, disagreeing with spy; it now uses the imshow
    integer-center convention. Reciprocal directed edges drew as coincident
    lines with one weight label hidden; they now draw as arcs with separated
    labels. The arc rendering needs networkx 3.3, so draw() feature-detects
    the connectionstyle parameter and keeps the straight rendering on older
    networkx.
  • Measure coverage (d79de95): removes the coverage omit block (viz.py
    was its only entry); 87.6% covered counting statements and branches.
  • Install the datashade stack in the notebooks CI jobs (3d623c4): the
    datashade tests skip unless datashader, holoviews, hvplot and bokeh are
    installed, and no CI job installed them, so viz.datashade never ran in CI.
    The notebooks jobs, which already add matplotlib for the rest of viz, add
    these four where Numba is installed (datashader needs it). Every distinct
    notebooks draw (673 combinations of Python 3.11-3.15 with its numpy, pandas
    and numba pins) solves with them on linux-64, osx-arm64 and win-64, and
    test_viz.py passes with them on the newest and the oldest of those draws.

Stack created with GitHub Stacks CLI • Give Feedback 💬

@eriknw eriknw changed the title 17 viz fixes Fix viz bugs and bring graphblas/viz.py under test and coverage Aug 4, 2026
@eriknw
eriknw marked this pull request as ready for review August 4, 2026 16:07
@eriknw
eriknw force-pushed the 17-viz-fixes branch 2 times, most recently from 491bbf3 to cf2817d Compare August 5, 2026 00:06
@eriknw
eriknw force-pushed the 17-viz-fixes branch 2 times, most recently from 992c102 to 926d31d Compare October 1, 2026 17:10
@eriknw
eriknw force-pushed the 17-viz-fixes branch 3 times, most recently from 84a47e5 to a9709ed Compare October 3, 2026 04:57
@eriknw
eriknw removed this pull request from stack #634 October 8, 2026 21:02
@eriknw
eriknw added this pull request to stack #635 October 8, 2026 21:46
@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.18310% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.82%. Comparing base (88f582c) to head (4a7f5e2).

Additional details and impacted files
@@                      Coverage Diff                       @@
##           39b-from-coo-broadcast-iso     #597      +/-   ##
==============================================================
- Coverage                       99.05%   98.82%   -0.23%     
==============================================================
  Files                             108      109       +1     
  Lines                           32686    32828     +142     
  Branches                         3743     3746       +3     
==============================================================
+ Hits                            32377    32443      +66     
- Misses                            206      251      +45     
- Partials                          103      134      +31     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

viz.py previously had zero tests. Nine Agg-backend smoke tests cover
spy (default, centered, explicit axes), draw (renders nodes/labels,
rejects non-Matrix), and datashade (single, list, grid, empty agg).
Every optional dependency is guarded with importorskip so a
minimal-environment run sees clean skips: without matplotlib the whole
module skips; without datashader the four datashade tests skip and the
rest run (both verified by simulation).
spy() bound the ``fig`` local only when it created the figure itself, so
``spy(A, figure=fig)`` crashed creating the axes and ``spy(A, axes=ax)``
crashed in the auto-markersize path (found while writing the smoke
tests). The figure kwarg is now used when given, and auto-markersize
reads dpi from ``axes.figure``, which is correct in all three call
forms. Regression tests cover both previously-crashing forms.
…iz.draw

Two bugs reported in the pyOpenSci review.  Both change viz.py, so they
are itemized in a single commit.

gh-473: datashade binned element (r, c) into the pixel spanning
[c, c+1) x [r, r+1), so it rendered centered at (c+0.5, r+0.5), half a
cell off the tick labeled (c, r); spy centers the same element exactly
on the tick.  The axis limits now use the imshow integer-center
convention (-0.5 to n-0.5), making datashade agree with spy.  The
issue's other symptom (elements invisible until zoom-out) does not
reproduce on the current holoviews/hvplot/bokeh stack; it was a
2023-era library artifact.

gh-474: reciprocal directed edges drew as coincident straight lines
with both weight labels on the same midpoint, hiding one weight.
Reciprocal pairs now draw with an arc (connectionstyle arc3, rad 0.1)
and matching label placement, so both arrows and both weights are
visible; other edges and self-loops stay straight.

The gh-474 fix needs networkx 3.3, the release that gave
draw_networkx_edge_labels its connectionstyle parameter.  We support
networkx >=2.8, so draw() feature-detects that parameter and keeps the
previous straight rendering when it is missing; passing it to an older
networkx raises TypeError.  Curving the edges but not the labels would
be worse than not curving at all, since the labels would sit back on the
shared chord midpoint (the overlap gh-474 is about) and would no longer
track their arrows.

Both fixes carry display-free regression tests: datashade pixel centers
match spy's convention, and draw places the two weight labels at
separated anchors.  The label check measures separation as a fraction of
the edge length rather than comparing positions for exact inequality,
because networkx returns two midpoint anchors that differ by
floating-point noise even when the labels coincide on screen.  A third
test stands in a pre-3.3 signature to cover the fallback.
Removes the coverage omit block (viz.py was its only entry, with a TODO
to un-omit once tests existed; they do now).  The viz test module covers
87.6% of viz.py counting statements and branches, 91.1% counting
statements alone.  The misses are the optional-import failure path, the
interactive plt.show() path, and guards for inputs the tests do not
construct: matrices too large for int64 indices, ragged aggregator
grids, and caller-supplied opts_kwargs.
graphblas/tests/test_viz.py's datashade tests skip unless datashader,
holoviews, hvplot and bokeh are installed, and no CI job installed them,
so they never ran and viz.datashade never counted for coverage. The
notebooks jobs already add matplotlib for the rest of viz, so add these
four there too.

datashader depends on numba, so they are installed only where numba is.
The notebooks jobs never skip numba at random; this keeps a pypy draw, or
a draw the version picker leaves without a compatible numba, solvable.

Every distinct notebooks draw the picker makes (673 combinations of
Python 3.11-3.15 with its numpy, pandas and numba pins, from 20000 draws
per Python) solves with the four added on linux-64, osx-arm64 and win-64,
picking the newest datashader (0.19.1), holoviews (1.23.2) and hvplot
(0.12.2) every time. test_viz.py passes with them on the newest stack
(Python 3.13, numpy 2.5, pandas 3.1, numba 0.68) and on the oldest draw
(Python 3.11, numpy 1.24, pandas 1.5, numba 0.57).

scripts/check_versions.sh lists them with the other dependencies CI
tests.
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.

1 participant