Drop GraphMatrixT export and make GraphPostprocessor a PEP 695 type alias#1223
Open
selmanozleyen wants to merge 1 commit into
Open
Drop GraphMatrixT export and make GraphPostprocessor a PEP 695 type alias#1223selmanozleyen wants to merge 1 commit into
selmanozleyen wants to merge 1 commit into
Conversation
…695 type alias Follow-up to scverse#1222, which deliberately left these two breaking changes out. Now that the graph-builder API is still experimental, apply both: - Drop `GraphMatrixT` from `squidpy.gr` and `squidpy.gr.neighbors` `__all__` (and remove it from the autosummary in docs/api.md). It was only exported to back the `GraphPostprocessor` alias. - Convert `GraphPostprocessor` to a PEP 695 `type` alias whose type parameter is scoped to the alias itself. This removes the now-unused module-level `GraphMatrixT`/`TypeVar`. Runtime type of `GraphPostprocessor` changes from a plain `typing` form to `TypeAliasType`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
timtreis
approved these changes
Jun 20, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1223 +/- ##
==========================================
- Coverage 76.53% 76.53% -0.01%
==========================================
Files 63 63
Lines 9070 9069 -1
Branches 1523 1523
==========================================
- Hits 6942 6941 -1
Misses 1544 1544
Partials 584 584
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #1222. That PR deliberately left out two breaking changes (see its "Deliberately not done" section); now that the graph-builder API is still experimental, this applies both.
Changes
GraphMatrixTfrom the public API. Removed from__all__insquidpy.grandsquidpy.gr.neighbors, plus the two autosummary entries indocs/api.md. It was only exported to back theGraphPostprocessoralias.GraphPostprocessorto a PEP 695typealias whose type parameter is scoped to the alias itself. This removes the now-unused module-levelGraphMatrixT = TypeVar(...)and theTypeVarimport.Breaking changes
from squidpy.gr import GraphMatrixT(andfrom squidpy.gr.neighbors import GraphMatrixT) no longer works — the name is gone.GraphPostprocessor's runtime type changes from a plaintypingCallableform toTypeAliasType. Type-level usage (GraphPostprocessor[csr_matrix], annotations) is unchanged.The
GraphBuilder[CoordT, GraphMatrixT]class param andSpatialNeighborsResult[GraphMatrixT]are independent PEP 695 params and are unaffected.Verification
ruff check src/squidpy/gr/clean.type(GraphPostprocessor).__name__ == "TypeAliasType",GraphPostprocessor[csr_matrix]still subscriptable,GraphMatrixTabsent from both__all__s and no longer an attribute ofsquidpy.gr.neighbors.tests/graph/test_spatial_neighbors.py: 50 passed.🤖 Generated with Claude Code