Skip to content

Commit e1aedc1

Browse files
authored
Switch to DemoCards.jl (#206)
* Use DemoCards.jl * Add cache files to reduce load on CI * Fix notebooks * Add compat * Discussed changes * Remove the pre-rendered files
1 parent 3c9bbd5 commit e1aedc1

File tree

11 files changed

+80
-58
lines changed

11 files changed

+80
-58
lines changed

docs/Project.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
[deps]
2+
DemoCards = "311a05b2-6137-4a5a-b473-18580a3d38b5"
23
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
34
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
45
GraphNeuralNetworks = "cffab07f-9bc2-4db1-8861-388f63bf7694"
56
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
67
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
78
MarkdownLiteral = "736d6165-7244-6769-4267-6b50796e6954"
89
NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
9-
Pluto = "c3e4b0f8-55cb-11ea-2926-15256bba5781"
10-
PlutoStaticHTML = "359b1769-a58e-495b-9770-312e911026ad"
1110
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1211
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1312
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
13+
14+
15+
[compat]
16+
DemoCards = "^0.4.10"

docs/make.jl

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,10 @@
11
using Flux, NNlib, GraphNeuralNetworks, Graphs, SparseArrays
2-
using Documenter
2+
using Documenter, DemoCards
33

4-
# See this for a template of Pluto+Documenter
5-
# https://github.com/rikhuijzer/PlutoStaticHTML.jl/blob/main/docs/make.jl
6-
using Pluto, PlutoStaticHTML
7-
using Documenter: MathJax3
4+
tutorials, tutorials_cb, tutorial_assets = makedemos("tutorials")
85

9-
pluto_src_folder = joinpath(@__DIR__, "src", "tutorials")
10-
11-
"""
12-
build()
13-
14-
Run all Pluto notebooks (".jl" files) in `NOTEBOOK_DIR`.
15-
"""
16-
function build()
17-
println("Building notebooks")
18-
hopts = HTMLOptions(; append_build_context=false)
19-
output_format = documenter_output
20-
bopts = BuildOptions(pluto_src_folder; output_format)
21-
build_notebooks(bopts, hopts)
22-
return nothing
23-
end
24-
25-
# Build the notebooks; defaults to true.
26-
if get(ENV, "BUILD_DOCS_NOTEBOOKS", "true") == "true"
27-
build()
28-
end
6+
assets = []
7+
isnothing(tutorial_assets) || push!(assets, tutorial_assets)
298

309
DocMeta.setdocmeta!(GraphNeuralNetworks, :DocTestSetup,
3110
:(using GraphNeuralNetworks, Graphs, SparseArrays, NNlib, Flux);
@@ -38,19 +17,14 @@ makedocs(;
3817
modules = [GraphNeuralNetworks, NNlib, Flux, Graphs, SparseArrays],
3918
doctest = false,
4019
clean = true,
41-
format= Documenter.HTML(; mathengine, prettyurls),
20+
format= Documenter.HTML(; mathengine, prettyurls, assets=assets),
4221
sitename = "GraphNeuralNetworks.jl",
4322
pages = ["Home" => "index.md",
4423
"Graphs" => "gnngraph.md",
4524
"Message Passing" => "messagepassing.md",
4625
"Model Building" => "models.md",
4726
"Datasets" => "datasets.md",
48-
"Tutorials" =>
49-
[
50-
"Intro to Graph Neural Networks" => "tutorials/gnn_intro_pluto.md",
51-
"Graph Classification" => "tutorials/graph_classification_pluto.md",
52-
"Node Classification" => "tutorials/node_classification_pluto.md",
53-
],
27+
"Tutorials" => tutorials,
5428
"API Reference" =>
5529
[
5630
"GNNGraph" => "api/gnngraph.md",
@@ -65,4 +39,6 @@ makedocs(;
6539
],
6640
)
6741

42+
tutorials_cb()
43+
6844
deploydocs(repo="github.com/CarloLucibello/GraphNeuralNetworks.jl.git")

docs/src/tutorials/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/tutorials/config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"theme": "grid"
3+
}

docs/tutorials/index.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# [Tutorials](@id tutorials)
2+
3+
---
4+
5+
{{{democards}}}
6+
7+
---
8+
9+
## Contributions
10+
11+
If you have a suggestion on adding new tutorials, feel free to create a new issue
12+
[here](https://github.com/CarloLucibello/GraphNeuralNetworks.jl/issues/new).
13+
Users are invited to contribute demonstrations of their own.
14+
If you want to contribute new tutorials and looking for inspiration,
15+
checkout these tutorials from
16+
[PyTorch Geometric](https://pytorch-geometric.readthedocs.io/en/latest/notes/colabs.html).
17+
You are expected to use [Pluto.jl](https://github.com/fonsp/Pluto.jl) notebooks
18+
with [DemoCards.jl](https://github.com/JuliaDocs/DemoCards.jl).
19+
Please check out exsisting tutorials for more details.
748 KB
Loading
113 KB
Loading
96.9 KB
Loading

docs/src/tutorials/gnn_intro_pluto.jl renamed to docs/tutorials/introductory_tutorials/gnn_intro_pluto.jl

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
### A Pluto.jl notebook ###
2-
# v0.19.5
2+
# v0.19.11
33

44
using Markdown
55
using InteractiveUtils
@@ -10,13 +10,13 @@ begin
1010
using Pkg
1111
Pkg.activate(; temp=true)
1212
packages = [
13-
PackageSpec(; path=joinpath(@__DIR__,"..","..","..")),
13+
PackageSpec(; name="GraphNeuralNetworks", version="0.4"),
1414
PackageSpec(; name="Flux", version="0.13"),
15-
PackageSpec(; name="MLDatasets", version="0.7"),
16-
PackageSpec(; name="GraphMakie"),
17-
PackageSpec(; name="Graphs"),
18-
PackageSpec(; name="CairoMakie"),
19-
PackageSpec(; name="PlutoUI"),
15+
PackageSpec(; name="MLDatasets", version="0.7"),
16+
PackageSpec(; name="GraphMakie"),
17+
PackageSpec(; name="Graphs"),
18+
PackageSpec(; name="CairoMakie"),
19+
PackageSpec(; name="PlutoUI"),
2020
]
2121
Pkg.add(packages)
2222
end
@@ -36,10 +36,19 @@ begin
3636
Random.seed!(17) # for reproducibility
3737
end;
3838

39-
# ╔═╡ 03a9e023-e682-4ea3-a10b-14c4d101b291
39+
# ╔═╡ cc051aa1-b929-4bca-b261-7f797a644a2b
4040
md"""
41-
# Introduction: Hands-on Graph Neural Networks
41+
---
42+
title: Hands-on introduction to Graph Neural Networks
43+
cover: assets/intro_1.png
44+
author: "[Carlo Lucibello](https://github.com/CarloLucibello)"
45+
date: 2022-05-24
46+
description: A beginner level introduction to graph machine learning using GraphNeuralNetworks.jl.
47+
---
48+
"""
4249

50+
# ╔═╡ 03a9e023-e682-4ea3-a10b-14c4d101b291
51+
md"""
4352
*This Pluto notebook is a julia adaptation of the Pytorch Geometric tutorials that can be found [here](https://pytorch-geometric.readthedocs.io/en/latest/notes/colabs.html).*
4453
4554
Recently, deep learning on graphs has emerged to one of the hottest research fields in the deep learning community.
@@ -330,6 +339,7 @@ Furthermore, we did this all with a few lines of code, thanks to the GraphNeural
330339
"""
331340

332341
# ╔═╡ Cell order:
342+
# ╟─cc051aa1-b929-4bca-b261-7f797a644a2b
333343
# ╟─03a9e023-e682-4ea3-a10b-14c4d101b291
334344
# ╟─6f20e59c-b002-4d22-9ee0-b62596574776
335345
# ╠═361e0948-d91a-11ec-2d95-2db77435a0c1

docs/src/tutorials/graph_classification_pluto.jl renamed to docs/tutorials/introductory_tutorials/graph_classification_pluto.jl

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
### A Pluto.jl notebook ###
2-
# v0.19.6
3-
4-
#> [frontmatter]
5-
#> title = "Graph Classification with Graph Neural Networks"
6-
#> date = "2022-05-23"
2+
# v0.19.11
73

84
using Markdown
95
using InteractiveUtils
@@ -14,10 +10,10 @@ begin
1410
using Pkg
1511
Pkg.activate(; temp=true)
1612
Pkg.add([
17-
PackageSpec(; path=joinpath(@__DIR__,"..","..","..")),
13+
PackageSpec(; name="GraphNeuralNetworks", version="0.4"),
1814
PackageSpec(; name="Flux", version="0.13"),
19-
PackageSpec(; name="MLDatasets", version="0.7"),
20-
PackageSpec(; name="MLUtils"),
15+
PackageSpec(; name="MLDatasets", version="0.7"),
16+
PackageSpec(; name="MLUtils"),
2117
])
2218
Pkg.develop("GraphNeuralNetworks")
2319
end
@@ -36,10 +32,19 @@ begin
3632
Random.seed!(17) # for reproducibility
3733
end;
3834

39-
# ╔═╡ 15136fd8-f9b2-4841-9a95-9de7b8969687
35+
# ╔═╡ c07e1be9-adb6-4454-8128-bc8917406c58
4036
md"""
41-
# Graph Classification with Graph Neural Networks
37+
---
38+
title: Graph Classification with Graph Neural Networks
39+
cover: assets/graph_classification.gif
40+
author: "[Carlo Lucibello](https://github.com/CarloLucibello)"
41+
date: 2022-05-23
42+
description: Tutorial for Graph Classification using GraphNeuralNetworks.jl
43+
---
44+
"""
4245

46+
# ╔═╡ 15136fd8-f9b2-4841-9a95-9de7b8969687
47+
md"""
4348
*This Pluto notebook is a julia adaptation of the Pytorch Geometric tutorials that can be found [here](https://pytorch-geometric.readthedocs.io/en/latest/notes/colabs.html).*
4449
4550
In this tutorial session we will have a closer look at how to apply **Graph Neural Networks (GNNs) to the task of graph classification**.
@@ -271,9 +276,10 @@ You have learned how graphs can be batched together for better GPU utilization,
271276
"""
272277

273278
# ╔═╡ Cell order:
274-
# ╠═c97a0002-2253-45b6-9266-017189dbb6fe
279+
# ╟─c07e1be9-adb6-4454-8128-bc8917406c58
280+
# ╟─cc97a0002-2253-45b6-9266-017189dbb6fe
275281
# ╠═361e0948-d91a-11ec-2d95-2db77435a0c1
276-
# ╟─15136fd8-f9b2-4841-9a95-9de7b8969687
282+
# ╠═15136fd8-f9b2-4841-9a95-9de7b8969687
277283
# ╠═f6e86958-e96f-4c77-91fc-c72d8967575c
278284
# ╠═24f76360-8599-46c8-a49f-4c31f02eb7d8
279285
# ╠═5d5e5152-c860-4158-8bc7-67ee1022f9f8

0 commit comments

Comments
 (0)