diff --git a/.github/workflows/render-docs.yml b/.github/workflows/render-docs.yml index c5c83dfc..3d8b5fc3 100644 --- a/.github/workflows/render-docs.yml +++ b/.github/workflows/render-docs.yml @@ -29,7 +29,12 @@ jobs: python-version: '3.11' cache: 'pip' cache-dependency-path: pyproject.toml - - run: pip install "python-wrapper/[dev, pandas, docs]" + - run: pip install "python-wrapper/[dev, pandas, gds, docs]" + + - name: Setup pandoc + uses: pandoc/actions/setup@v1 + with: + version: 3.6.2 - name: Render ref docs run: ./scripts/render_docs.sh diff --git a/docs/source/conf.py b/docs/source/conf.py index 58a73098..a3a5ef5e 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -21,11 +21,15 @@ "sphinx.ext.autodoc", # include docs from docstrings "enum_tools.autoenum", # specialised autoclass for enums "sphinx.ext.napoleon", # Support for NumPy and Google style docstrings + "nbsphinx", # support for jupyter notebooks + "nbsphinx_link", # support for jupyter notebooks from other directories ] templates_path = ["_templates"] exclude_patterns: list[str] = [] +# -- Options for notebook extension ------------------------------------------- +nbsphinx_execute = "never" # -- Options for HTML output ------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output diff --git a/docs/source/example_cora_graph.png b/docs/source/example_cora_graph.png new file mode 100644 index 00000000..0c1dea7a Binary files /dev/null and b/docs/source/example_cora_graph.png differ diff --git a/docs/source/index.rst b/docs/source/index.rst index 151291c6..dea79647 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -10,10 +10,9 @@ This API reference manual lists all available endpoints in the `neo4j_viz` `pack .. toctree:: - :maxdepth: 2 + :glob: + :maxdepth: 1 :caption: Contents: - from_gds - from_pandas - graph - render_options + * + tutorials/* diff --git a/docs/source/themes/sphinx_neo4j/layout.html b/docs/source/themes/sphinx_neo4j/layout.html index ff523d38..8af6fedf 100644 --- a/docs/source/themes/sphinx_neo4j/layout.html +++ b/docs/source/themes/sphinx_neo4j/layout.html @@ -20,20 +20,13 @@ @@ -68,4 +61,4 @@ {% endif %} {%- endblock %} - \ No newline at end of file + diff --git a/docs/source/tutorials/example_cora_graph.png b/docs/source/tutorials/example_cora_graph.png new file mode 100644 index 00000000..0c1dea7a Binary files /dev/null and b/docs/source/tutorials/example_cora_graph.png differ diff --git a/docs/source/tutorials/gds-nvl-example.nblink b/docs/source/tutorials/gds-nvl-example.nblink new file mode 100644 index 00000000..96bcb5c0 --- /dev/null +++ b/docs/source/tutorials/gds-nvl-example.nblink @@ -0,0 +1,6 @@ +{ + "path": "../../../examples/gds-nvl-example.ipynb", + "extra-media": [ + "../../../examples/example_cora_graph.png" + ] +} diff --git a/docs/source/tutorials/neo4j-nvl-example.nblink b/docs/source/tutorials/neo4j-nvl-example.nblink new file mode 100644 index 00000000..74cf40a0 --- /dev/null +++ b/docs/source/tutorials/neo4j-nvl-example.nblink @@ -0,0 +1,3 @@ +{ + "path": "../../../examples/neo4j-nvl-example.ipynb" +} diff --git a/docs/source/tutorials/snowpark-nvl-example.nblink b/docs/source/tutorials/snowpark-nvl-example.nblink new file mode 100644 index 00000000..39c60981 --- /dev/null +++ b/docs/source/tutorials/snowpark-nvl-example.nblink @@ -0,0 +1,3 @@ +{ + "path": "../../../examples/snowpark-nvl-example.ipynb" +} diff --git a/examples/gds-nvl-example.ipynb b/examples/gds-nvl-example.ipynb index 73bfddf3..de366650 100644 --- a/examples/gds-nvl-example.ipynb +++ b/examples/gds-nvl-example.ipynb @@ -52,7 +52,7 @@ "metadata": {}, "outputs": [], "source": [ - "G = gds.graph.load_cora()" + "G = gds.graph.load_cora(graph_name=\"c2\")" ] }, { @@ -118,9 +118,40 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 11, + "metadata": { + "tags": [ + "preserve-output" + ] + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "
\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "VG.render()" ] @@ -142,6 +173,16 @@ " node.caption = str(node.subject)" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "for node in VG.nodes:\n", + " node.caption = str(node.id)" + ] + }, { "cell_type": "code", "execution_count": null, @@ -170,9 +211,40 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 14, + "metadata": { + "tags": [ + "preserve-output" + ] + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "
\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "VG.color_nodes(\"subject\")\n", "VG.render()" @@ -227,9 +299,40 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 18, + "metadata": { + "tags": [ + "preserve-output" + ] + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "
\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "VG.render()" ] @@ -251,9 +354,40 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 24, + "metadata": { + "tags": [ + "preserve-output" + ] + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "
\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "from neo4j_viz import Layout\n", "\n", diff --git a/examples/neo4j-nvl-example.ipynb b/examples/neo4j-nvl-example.ipynb index a1660522..1bcac6e8 100644 --- a/examples/neo4j-nvl-example.ipynb +++ b/examples/neo4j-nvl-example.ipynb @@ -5,9 +5,7 @@ "id": "0d3ffc27", "metadata": {}, "source": [ - "# NVL Python Wrapper\n", - "\n", - "NVL (Neo4j Visualization Library) is a JavaScript library developed to display large graphs. This notebook showcases an experimental Python wrapper for this libary." + "# Visualizing Neo4j Graphs" ] }, { diff --git a/examples/snowpark-nvl-example.ipynb b/examples/snowpark-nvl-example.ipynb index 0d91fabe..13c0e9d4 100644 --- a/examples/snowpark-nvl-example.ipynb +++ b/examples/snowpark-nvl-example.ipynb @@ -228,10 +228,41 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "e8b0f4c6", - "metadata": {}, - "outputs": [], + "metadata": { + "tags": [ + "preserve-output" + ] + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "
\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "VG.render()" ] diff --git a/python-wrapper/pyproject.toml b/python-wrapper/pyproject.toml index d7c7ebed..a997496b 100644 --- a/python-wrapper/pyproject.toml +++ b/python-wrapper/pyproject.toml @@ -51,8 +51,9 @@ dev = [ ] docs = [ "sphinx==8.1.3", - "autodoc_pydantic", - "enum-tools[sphinx]" + "enum-tools[sphinx]", + "nbsphinx==0.9.6", + "nbsphinx-link==1.3.1", ] pandas = ["pandas>=2, <3", "pandas-stubs>=2, <3"] gds = ["graphdatascience>=1, <2"] # not compatible yet with Python 3.13