Skip to content

Commit cef9ea7

Browse files
mtfishmanclaude
andauthored
Fix Documentation build broken by README port (#22)
## Summary - The README port in #21 split the runnable Julia in `examples/README.jl` into two bare-Julia code blocks (imports, then setup + `@visualize` calls) separated by prose. Literate's `DocumenterFlavor` turned each into its own `@example index` block in `docs/src/index.md`. Inter-block state did not propagate on the Documentation CI runner, so `Index` was undefined when the second block ran. Independently, `docs/Project.toml` was missing `ITensors` as a dependency — so even a single-block setup couldn't have resolved `using ITensors: Index, random_itensor` during the Documenter build. - Consolidate the runnable Julia in `examples/README.jl` into one bare-Julia block so it lands as a single `@example index` block in `index.md`. Both `@visualize` calls now sit together; the surrounding prose was rearranged so the lead-in still flows. - Add `ITensors` to `docs/Project.toml` `[deps]` and `[compat]` (matching the root `Project.toml` compat range) so the Documenter build can resolve the import. - Bump `Project.toml` patch version 0.1.16 → 0.1.17. Verified locally: `docs/make.jl` now completes successfully, and `include("examples/README.jl")` from the test environment still runs the example through the no-op default backend. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b5f7eec commit cef9ea7

4 files changed

Lines changed: 19 additions & 41 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ITensorVisualizationBase"
22
uuid = "cd2553d2-8bef-4d93-8a38-c62f17d5ad23"
3-
version = "0.1.16"
3+
version = "0.1.17"
44
authors = ["Matthew Fishman <mfishman@flatironinstitute.org> and contributors"]
55

66
[workspace]

README.md

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,15 @@ or `ITensorGLMakie`. The main purpose is to use it with the
4949
[ITensors.jl](https://github.com/ITensor/ITensors.jl) package to view and debug tensor
5050
network contractions, for example:
5151

52+
Load a visualization backend (such as `using ITensorUnicodePlots`) to actually render
53+
the diagrams; without one, the `@visualize` macro is a no-op so that the example below
54+
still runs in test environments that do not have a backend installed.
55+
`ITensorVisualizationBase` handles the logic of switching between backends.
56+
5257
````julia
5358
using ITensorVisualizationBase: ITensorVisualizationBase, @visualize
5459
using ITensors: Index, random_itensor
55-
````
56-
57-
Load a visualization backend, which will reexport the interface of
58-
`ITensorVisualizationBase` automatically:
59-
```julia
60-
using ITensorUnicodePlots
61-
```
62-
63-
(we leave the `using ITensorUnicodePlots` line out of this example so it can run in
64-
test environments that do not have the backend installed.)
65-
66-
`ITensorVisualizationBase` handles the logic of switching between backends:
67-
68-
````julia
6960
@show ITensorVisualizationBase.get_backend()
70-
7161
i = Index(2, "i")
7262
j = Index(10, "j")
7363
k = Index(40, "k")
@@ -77,9 +67,10 @@ A = random_itensor(i, j, k)
7767
B = random_itensor(i, j, l, m)
7868
C = random_itensor(k, l)
7969
ABC = @visualize A * B * C
70+
ABC_tags = @visualize A * B * C edge_labels = (tags = true,)
8071
````
8172

82-
With the `ITensorUnicodePlots` backend loaded, this outputs:
73+
With `ITensorUnicodePlots` loaded, the first `@visualize` call outputs:
8374

8475
```julia
8576
ITensorVisualizationBase.get_backend() = ITensorVisualizationBase.Backend{:UnicodePlots}()⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
@@ -106,11 +97,7 @@ ITensorVisualizationBase.get_backend() = ITensorVisualizationBase.Backend{:Unico
10697
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
10798
```
10899

109-
You can show the visualization with tags with:
110-
111-
````julia
112-
ABC_tags = @visualize A * B * C edge_labels = (tags = true,)
113-
````
100+
And the second `@visualize` call (with `edge_labels = (tags = true,)`) outputs:
114101

115102
```julia
116103
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀

docs/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
33
ITensorFormatter = "b6bf39f1-c9d3-4bad-aad8-593d802f65fd"
44
ITensorVisualizationBase = "cd2553d2-8bef-4d93-8a38-c62f17d5ad23"
5+
ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5"
56

67
[sources.ITensorVisualizationBase]
78
path = ".."
@@ -10,3 +11,4 @@ path = ".."
1011
Documenter = "1"
1112
ITensorFormatter = "0.2.27"
1213
ITensorVisualizationBase = "0.1"
14+
ITensors = "0.7, 0.8, 0.9"

examples/README.jl

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,14 @@ julia> Pkg.add("ITensorVisualizationBase")
5151
# [ITensors.jl](https://github.com/ITensor/ITensors.jl) package to view and debug tensor
5252
# network contractions, for example:
5353

54+
# Load a visualization backend (such as `using ITensorUnicodePlots`) to actually render
55+
# the diagrams; without one, the `@visualize` macro is a no-op so that the example below
56+
# still runs in test environments that do not have a backend installed.
57+
# `ITensorVisualizationBase` handles the logic of switching between backends.
58+
5459
using ITensorVisualizationBase: ITensorVisualizationBase, @visualize
5560
using ITensors: Index, random_itensor
56-
57-
# Load a visualization backend, which will reexport the interface of
58-
# `ITensorVisualizationBase` automatically:
59-
#=
60-
```julia
61-
using ITensorUnicodePlots
62-
```
63-
=#
64-
65-
# (we leave the `using ITensorUnicodePlots` line out of this example so it can run in
66-
# test environments that do not have the backend installed.)
67-
68-
# `ITensorVisualizationBase` handles the logic of switching between backends:
69-
7061
@show ITensorVisualizationBase.get_backend()
71-
7262
i = Index(2, "i")
7363
j = Index(10, "j")
7464
k = Index(40, "k")
@@ -78,8 +68,9 @@ A = random_itensor(i, j, k)
7868
B = random_itensor(i, j, l, m)
7969
C = random_itensor(k, l)
8070
ABC = @visualize A * B * C
71+
ABC_tags = @visualize A * B * C edge_labels = (tags = true,)
8172

82-
# With the `ITensorUnicodePlots` backend loaded, this outputs:
73+
# With `ITensorUnicodePlots` loaded, the first `@visualize` call outputs:
8374

8475
#=
8576
```julia
@@ -108,9 +99,7 @@ ITensorVisualizationBase.get_backend() = ITensorVisualizationBase.Backend{:Unico
10899
```
109100
=#
110101

111-
# You can show the visualization with tags with:
112-
113-
ABC_tags = @visualize A * B * C edge_labels = (tags = true,)
102+
# And the second `@visualize` call (with `edge_labels = (tags = true,)`) outputs:
114103

115104
#=
116105
```julia

0 commit comments

Comments
 (0)