Move visualize overloads to ITensorVisualizationBase extension#367
Merged
Conversation
Replace the in-source `visualize(::AbstractITensorNetwork, ...)` method (in `src/abstractitensornetwork.jl`) and the two type-piracy methods on `AbstractNamedGraph` / `AbstractDataGraph` (in `src/visualize.jl`) with a single `ITensorNetworksITensorVisualizationBaseExt` package extension that overloads `visualize(::AbstractITensorNetwork, ...)` only. The type-piracy methods migrate upstream: - `NamedGraphs.jl` v0.11.1 (PR ITensor/NamedGraphs.jl#166) adds the `AbstractNamedGraph` overload via its own `NamedGraphsITensorVisualizationBaseExt`. - `DataGraphs.jl` v0.4.1 (PR ITensor/DataGraphs.jl#119) adds the `AbstractDataGraph` overload via `DataGraphsITensorVisualizationBaseExt`. Each method now lives in the package that owns the type, removing the piracy. The extensions are all keyed on the registered standalone `ITensorVisualizationBase` package; the methods overload `ITensorVisualizationBase.visualize`, which shares its binding with `ITensors.ITensorVisualizationCore.visualize` (the in-tree submodule) so rendering backends pick them up. Bumps `[compat]` floors to `NamedGraphs = "0.11.1"` and `DataGraphs = "0.4.1"`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
700e0a8 to
b334c9e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #367 +/- ##
===========================================
+ Coverage 52.39% 77.06% +24.67%
===========================================
Files 56 57 +1
Lines 2546 2625 +79
===========================================
+ Hits 1334 2023 +689
+ Misses 1212 602 -610
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mtfishman
added a commit
that referenced
this pull request
May 13, 2026
…21.2 (#369) ## Summary Backport of #367 onto the new `release-0.21` branch. Replaces the in-source `visualize(::AbstractITensorNetwork, ...)` method (in `src/abstractitensornetwork.jl`) and the two type-piracy methods on `AbstractNamedGraph` / `AbstractDataGraph` (in `src/visualize.jl`) with a single `ITensorNetworksITensorVisualizationBaseExt` package extension that overloads `visualize(::AbstractITensorNetwork, ...)` only. The type-piracy methods migrate upstream: - `NamedGraphs.jl` v0.11.1 ([#166](ITensor/NamedGraphs.jl#166)) adds the `AbstractNamedGraph` overload via its own `NamedGraphsITensorVisualizationBaseExt`. - `DataGraphs.jl` v0.4.1 ([#119](ITensor/DataGraphs.jl#119)) adds the `AbstractDataGraph` overload via `DataGraphsITensorVisualizationBaseExt`. ## Motivation for backporting Once NamedGraphs v0.11.1 and DataGraphs v0.4.1 register, any user on legacy ITensorNetworks v0.21.x alongside the new NamedGraphs/DataGraphs would hit method-overwrite warnings on the two type-pirated `visualize` methods. v0.22 may take a while to ship (its prerelease accumulator is still receiving changes), so we publish a v0.21.2 patch carrying the equivalent fix. ## Changes - Adds `ext/ITensorNetworksITensorVisualizationBaseExt/`. - Removes `src/visualize.jl` (and its `include` from `src/ITensorNetworks.jl`). - Removes the `visualize(::AbstractITensorNetwork, ...)` block from `src/abstractitensornetwork.jl`. - Adds `ITensorVisualizationBase` to `[weakdeps]` / `[extensions]` / `[compat]`. - Bumps `[compat]` floors: `NamedGraphs = "0.11.1"`, `DataGraphs = "0.4.1"`. - Bumps package version `0.21.1` → `0.21.2`. ## Release-branch workflow This is the first PR against the new `release-0.21` branch, modeled on Julia's `release-X.Y` convention (simplified — no `backports-release-X.Y` staging tier, since we expect only 1–2 backports before v0.22 ships). After merge, registration needs to be triggered manually via a `/register <merge-sha>` commit comment on the merge commit (the `Registrator.yml` workflow's `push` trigger only fires on `main`/`master` by default; the `issue_comment` path uses `force=true` and works regardless of branch). ## Status CI will be red until NamedGraphs v0.11.1 and DataGraphs v0.4.1 actually land in the registry. Opening the PR now mostly for tracking. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
ITensorNetworksITensorVisualizationBaseExt, a new package extension keyed onITensorVisualizationBase, holding thevisualize(::AbstractITensorNetwork, ...)overload that previously lived insrc/abstractitensornetwork.jl.src/visualize.jlentirely. The two methods it held (overloads ofvisualizeonAbstractNamedGraphandAbstractDataGraph, which were type piracy from here) move upstream into the packages that own those types: see ITensor/NamedGraphs.jl#166 and ITensor/DataGraphs.jl#119.[compat]floors toNamedGraphs = "0.11.1"andDataGraphs = "0.4.1"to ensure the upstream extensions are present.ITensorVisualizationBasepackage. The methods overloadITensorVisualizationBase.visualize, which shares a binding withITensors.ITensorVisualizationCore.visualize(the in-tree submodule), so rendering backends pick them up.Adds
test/test_itensorvisualizationbase_ext.jlcovering the new method.