Skip to content

Add DataGraphsITensorVisualizationBaseExt#119

Merged
mtfishman merged 4 commits into
mainfrom
mf/visualize-ext
May 13, 2026
Merged

Add DataGraphsITensorVisualizationBaseExt#119
mtfishman merged 4 commits into
mainfrom
mf/visualize-ext

Conversation

@mtfishman
Copy link
Copy Markdown
Member

@mtfishman mtfishman commented May 12, 2026

Summary

  • Adds a new package extension DataGraphsITensorVisualizationBaseExt, keyed on ITensorVisualizationBase, that overloads visualize(::AbstractDataGraph, ...) to delegate to visualize(underlying_graph(graph), ...). This method previously lived in ITensorNetworks.jl/src/visualize.jl as type piracy (DataGraphs owns the type but the method was defined elsewhere); moving it here removes the piracy on AbstractDataGraph.
  • Adds a test_itensorvisualizationbase_ext.jl smoke test that confirms the extension loads and the method is dispatchable.
  • Bumps the Julia compat floor to 1.10 to match the rest of the ITensor ecosystem.
  • Bumps version to 0.4.1.

Companion to NamedGraphs.jl#166 (same pattern for AbstractNamedGraph). A follow-up PR will drop the stale methods from ITensorNetworks.jl/src/visualize.jl.

Move the `visualize(::AbstractDataGraph, ...)` overload that previously
lived in ITensorNetworks.jl (where it was type piracy on a DataGraphs
type) into DataGraphs as a package extension keyed on
ITensorVisualizationBase. The method delegates to
`visualize(underlying_graph(graph), ...)`.

Bumps version to 0.4.1.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mtfishman mtfishman enabled auto-merge (squash) May 12, 2026 20:46
@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.89%. Comparing base (559b0cb) to head (1043c5f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #119      +/-   ##
==========================================
+ Coverage   59.75%   59.89%   +0.14%     
==========================================
  Files           9       10       +1     
  Lines         564      566       +2     
==========================================
+ Hits          337      339       +2     
  Misses        227      227              
Flag Coverage Δ
docs 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

mtfishman and others added 3 commits May 12, 2026 16:51
The DataGraphsITensorVisualizationBaseExt method delegates to
visualize(underlying_graph(graph)), which is typically a NamedGraph.
NamedGraphs 0.11.1 (PR #166) adds the matching extension for
AbstractNamedGraph, so without that floor a DataGraph wrapping a
NamedGraph would silently fall back to the no-op stub instead of the
labeled path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mtfishman mtfishman closed this May 12, 2026
auto-merge was automatically disabled May 12, 2026 23:49

Pull request was closed

@mtfishman mtfishman reopened this May 12, 2026
@mtfishman mtfishman closed this May 13, 2026
@mtfishman mtfishman reopened this May 13, 2026
@mtfishman mtfishman enabled auto-merge (squash) May 13, 2026 00:04
@mtfishman mtfishman merged commit 99d2088 into main May 13, 2026
37 of 55 checks passed
@mtfishman mtfishman deleted the mf/visualize-ext branch May 13, 2026 00:23
mtfishman added a commit to ITensor/ITensorNetworks.jl that referenced this pull request May 13, 2026
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>
mtfishman added a commit to ITensor/ITensorNetworks.jl that referenced this pull request May 13, 2026
## Summary

- Adds `ITensorNetworksITensorVisualizationBaseExt`, a new package
extension keyed on `ITensorVisualizationBase`, holding the
`visualize(::AbstractITensorNetwork, ...)` overload that previously
lived in `src/abstractitensornetwork.jl`.
- Drops `src/visualize.jl` entirely. The two methods it held (overloads
of `visualize` on `AbstractNamedGraph` and `AbstractDataGraph`, which
were type piracy from here) move upstream into the packages that own
those types: see
[ITensor/NamedGraphs.jl#166](ITensor/NamedGraphs.jl#166)
and
[ITensor/DataGraphs.jl#119](ITensor/DataGraphs.jl#119).
- Bumps `[compat]` floors to `NamedGraphs = "0.11.1"` and `DataGraphs =
"0.4.1"` to ensure the upstream extensions are present.
- The extensions are keyed on the registered standalone
`ITensorVisualizationBase` package. The methods overload
`ITensorVisualizationBase.visualize`, which shares a binding with
`ITensors.ITensorVisualizationCore.visualize` (the in-tree submodule),
so rendering backends pick them up.

Adds `test/test_itensorvisualizationbase_ext.jl` covering the new
method.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
mtfishman added a commit to ITensor/ITensorNetworks.jl 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>
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