Skip to content

fix: plot()/highlight_edge() crashes found by mypy; mypy to zero - #29

Merged
petercorke merged 4 commits into
mainfrom
chore/mypy-clean
Oct 11, 2026
Merged

petercorke merged 4 commits into
mainfrom
chore/mypy-clean

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Summary

The 7 baseline mypy errors turned out to be real runtime bugs in plot() and highlight_edge(), not noise. This fixes them and takes mypy to zero.

Finding Before After
plot(text=None), plot(text=True) TypeError: ** must be a mapping, although the docstring says None is default formatting work
plot() with vertices that have no coordinate 'NoneType' has no len() ValueError
plot() on an empty graph IndexError ValueError
3D plot with colorcomponents=False vertex markers drawn at z=0 drawn at their z
highlight_edge() on a removed edge AttributeError ValueError
vopt, eopt, text defaults mutable {} None
block annotated bool though None is documented and used bool | None; docs said "defaults to True", code is False, docs corrected

Config / CI

  • Removes python_version = "3.9" from [tool.mypy]; current mypy rejects it as unsupported. requires-python is unchanged.
  • Last commit makes the CI mypy job enforcing (drops continue-on-error). Happy to drop that commit if you want to keep it informational. Note all-tests-passed depends only on unittest, so this shows as a red check rather than blocking the gate.

Tests

tests/test_plot_args.py (14 tests, Agg backend); nine of them fail on main.

🤖 Generated with Claude Code

petercorke and others added 3 commits October 11, 2026 11:12
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… zero

mypy's 7 baseline errors were real runtime bugs, not noise:

- plot(text=None) and plot(text=True) raised TypeError ('** must be a
  mapping') although the docstring says None means default formatting
- plot() on a graph without coordinates raised 'NoneType has no len()',
  and on an empty graph IndexError; both are now a clear ValueError
- in 3D with colorcomponents=False the vertex marker was drawn at z=0
- highlight_edge() on a removed edge raised AttributeError; now ValueError
- vopt/eopt/text had mutable {} defaults; now None
- block is documented and used as bool|None (None = don't show)

Also drops python_version=3.9 from [tool.mypy], which current mypy rejects.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.37%. Comparing base (0566a68) to head (5b2e25f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #29      +/-   ##
==========================================
+ Coverage   87.60%   89.37%   +1.76%     
==========================================
  Files           2        2              
  Lines         815      828      +13     
==========================================
+ Hits          714      740      +26     
+ Misses        101       88      -13     

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

@codacy-production

codacy-production Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 31 complexity · -2 duplication

Metric Results
Complexity 31
Duplication -2

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@petercorke
petercorke merged commit 53890d1 into main Oct 11, 2026
14 checks passed
@petercorke
petercorke deleted the chore/mypy-clean branch October 11, 2026 04:09
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