docs: move notebooks to docs and use nbsphinx to include them in the html

- update env image to install pandoc required by nbsphinx
This commit is contained in:
Arthur Meyre
2021-09-14 17:38:53 +02:00
parent e382c899cf
commit a69975742f
9 changed files with 54 additions and 18 deletions

View File

@@ -169,7 +169,7 @@ strip_nb:
.PHONY: strip_nb
pytest_nb:
poetry run pytest --nbmake examples/*.ipynb
poetry run pytest --nbmake docs/user/advanced_examples/*.ipynb
.PHONY: pytest_nb
benchmark:

View File

@@ -7,7 +7,8 @@ RUN apt-get update && apt-get upgrade --no-install-recommends -y && \
python3.8-venv \
python-is-python3 \
git \
graphviz* && \
graphviz* \
pandoc && \
rm -rf /var/lib/apt/lists/* && \
pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir poetry

View File

@@ -30,7 +30,13 @@ release = "0.1"
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ["sphinx.ext.napoleon", "myst_parser", "sphinx.ext.autodoc", "sphinx.ext.autosummary"]
extensions = [
"myst_parser",
"nbsphinx",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
]
myst_enable_extensions = [
"amsmath",

View File

@@ -27,6 +27,13 @@ Concrete Framework's documentation
user/howto/DEBUG_SUPPORT_SUBMIT_ISSUES.md
user/howto/FAQ.md
.. toctree::
:maxdepth: 2
:caption: Advanced Examples
user/advanced_examples/QuantizedLinearRegression.ipynb
user/advanced_examples/QuantizedLogisticRegression.ipynb
.. toctree::
:maxdepth: 2
:caption: Explanation

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

51
poetry.lock generated
View File

@@ -155,7 +155,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
[[package]]
name = "charset-normalizer"
version = "2.0.4"
version = "2.0.5"
description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
category = "dev"
optional = false
@@ -376,7 +376,7 @@ python-versions = "*"
[[package]]
name = "ipywidgets"
version = "7.6.4"
version = "7.6.5"
description = "IPython HTML widgets for Jupyter"
category = "dev"
optional = false
@@ -546,7 +546,7 @@ pygments = ">=2.4.1,<3"
[[package]]
name = "jupyterlab-widgets"
version = "1.0.1"
version = "1.0.2"
description = "A JupyterLab extension."
category = "dev"
optional = false
@@ -800,6 +800,22 @@ pydantic = ">=1.7.2,<2.0.0"
Pygments = ">=2.7.3,<3.0.0"
pytest = ">=6.1.2,<7.0.0"
[[package]]
name = "nbsphinx"
version = "0.8.7"
description = "Jupyter Notebook Tools for Sphinx"
category = "dev"
optional = false
python-versions = ">=3.6"
[package.dependencies]
docutils = "*"
jinja2 = "*"
nbconvert = "!=5.4"
nbformat = "*"
sphinx = ">=1.8"
traitlets = "*"
[[package]]
name = "nest-asyncio"
version = "1.5.1"
@@ -873,7 +889,7 @@ pyparsing = ">=2.0.2"
[[package]]
name = "pandocfilters"
version = "1.4.3"
version = "1.5.0"
description = "Utilities for writing pandoc filters in python"
category = "dev"
optional = false
@@ -1243,7 +1259,7 @@ test = ["flaky", "pytest", "pytest-qt"]
[[package]]
name = "qtpy"
version = "1.11.0"
version = "1.11.1"
description = "Provides an abstraction layer on top of the various Qt bindings (PyQt5, PyQt4 and PySide) and additional custom QWidgets."
category = "dev"
optional = false
@@ -1569,7 +1585,7 @@ python-versions = "*"
[metadata]
lock-version = "1.1"
python-versions = ">=3.8,<3.9"
content-hash = "b2650d98938713e30a9141050ab90466bd9ba8a1eb38eedffcaa5bbd0f150cc5"
content-hash = "ada0e822f539bf819ccb21e005b48d868fad05746132a871a85549e2b7f8a0be"
[metadata.files]
alabaster = [
@@ -1681,8 +1697,8 @@ chardet = [
{file = "chardet-4.0.0.tar.gz", hash = "sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa"},
]
charset-normalizer = [
{file = "charset-normalizer-2.0.4.tar.gz", hash = "sha256:f23667ebe1084be45f6ae0538e4a5a865206544097e4e8bbcacf42cd02a348f3"},
{file = "charset_normalizer-2.0.4-py3-none-any.whl", hash = "sha256:0c8911edd15d19223366a194a513099a302055a962bca2cec0f54b8b63175d8b"},
{file = "charset-normalizer-2.0.5.tar.gz", hash = "sha256:7098e7e862f6370a2a8d1a6398cd359815c45d12626267652c3f13dec58e2367"},
{file = "charset_normalizer-2.0.5-py3-none-any.whl", hash = "sha256:fa471a601dfea0f492e4f4fca035cd82155e65dc45c9b83bf4322dfab63755dd"},
]
click = [
{file = "click-8.0.1-py3-none-any.whl", hash = "sha256:fba402a4a47334742d782209a7c79bc448911afe1149d07bdabdf480b3e2f4b6"},
@@ -1807,8 +1823,8 @@ ipython-genutils = [
{file = "ipython_genutils-0.2.0.tar.gz", hash = "sha256:eb2e116e75ecef9d4d228fdc66af54269afa26ab4463042e33785b887c628ba8"},
]
ipywidgets = [
{file = "ipywidgets-7.6.4-py2.py3-none-any.whl", hash = "sha256:3ffd1baa741eb631e7a3a69d4df290de074ef697e0ef3176e33361b44cd91711"},
{file = "ipywidgets-7.6.4.tar.gz", hash = "sha256:028bf014a0b1d77cb676fe163115f145aacdde0bb9a51c4166940e5b62a7d1d0"},
{file = "ipywidgets-7.6.5-py2.py3-none-any.whl", hash = "sha256:d258f582f915c62ea91023299603be095de19afb5ee271698f88327b9fe9bf43"},
{file = "ipywidgets-7.6.5.tar.gz", hash = "sha256:00974f7cb4d5f8d494c19810fedb9fa9b64bffd3cda7c2be23c133a1ad3c99c5"},
]
isort = [
{file = "isort-5.9.3-py3-none-any.whl", hash = "sha256:e17d6e2b81095c9db0a03a8025a957f334d6ea30b26f9ec70805411e5c7c81f2"},
@@ -1852,8 +1868,8 @@ jupyterlab-pygments = [
{file = "jupyterlab_pygments-0.1.2.tar.gz", hash = "sha256:cfcda0873626150932f438eccf0f8bf22bfa92345b814890ab360d666b254146"},
]
jupyterlab-widgets = [
{file = "jupyterlab_widgets-1.0.1-py3-none-any.whl", hash = "sha256:841925a349bd9a9197c5506bd5461a321b09e6659a9b179a0096b561a92898c3"},
{file = "jupyterlab_widgets-1.0.1.tar.gz", hash = "sha256:f94fb7fa1ddc8668e3f98d67a97cabe322e8d04b78b9eb988c7fde415d7a02df"},
{file = "jupyterlab_widgets-1.0.2-py3-none-any.whl", hash = "sha256:f5d9efface8ec62941173ba1cffb2edd0ecddc801c11ae2931e30b50492eb8f7"},
{file = "jupyterlab_widgets-1.0.2.tar.gz", hash = "sha256:7885092b2b96bf189c3a705cc3c412a4472ec5e8382d0b47219a66cccae73cfa"},
]
kiwisolver = [
{file = "kiwisolver-1.3.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:1d819553730d3c2724582124aee8a03c846ec4362ded1034c16fb3ef309264e6"},
@@ -2077,6 +2093,10 @@ nbmake = [
{file = "nbmake-0.5-py3-none-any.whl", hash = "sha256:8a0b3ce9ca26320165c6de532c3d36445da1dd53c2c8fac4870ed900b3cbe538"},
{file = "nbmake-0.5.tar.gz", hash = "sha256:da9bf1bbc377c9d1d697f99952834017c39b4983e7e482a038dec705955a8ae9"},
]
nbsphinx = [
{file = "nbsphinx-0.8.7-py3-none-any.whl", hash = "sha256:8862f291f98c1a163bdb5bac8adf25c61585a81575ac5c613320c6f3fe5c472f"},
{file = "nbsphinx-0.8.7.tar.gz", hash = "sha256:ff91b5b14ceb1a9d44193b5fc3dd3617e7b8ab59c788f7710049ce5faff2750c"},
]
nest-asyncio = [
{file = "nest_asyncio-1.5.1-py3-none-any.whl", hash = "sha256:76d6e972265063fe92a90b9cc4fb82616e07d586b346ed9d2c89a4187acea39c"},
{file = "nest_asyncio-1.5.1.tar.gz", hash = "sha256:afc5a1c515210a23c461932765691ad39e8eba6551c055ac8d5546e69250d0aa"},
@@ -2126,7 +2146,8 @@ packaging = [
{file = "packaging-21.0.tar.gz", hash = "sha256:7dc96269f53a4ccec5c0670940a4281106dd0bb343f47b7471f779df49c2fbe7"},
]
pandocfilters = [
{file = "pandocfilters-1.4.3.tar.gz", hash = "sha256:bc63fbb50534b4b1f8ebe1860889289e8af94a23bff7445259592df25a3906eb"},
{file = "pandocfilters-1.5.0-py2.py3-none-any.whl", hash = "sha256:33aae3f25fd1a026079f5d27bdd52496f0e0803b3469282162bafdcbdf6ef14f"},
{file = "pandocfilters-1.5.0.tar.gz", hash = "sha256:0b679503337d233b4339a817bfc8c50064e2eff681314376a47cb582305a7a38"},
]
parso = [
{file = "parso-0.8.2-py2.py3-none-any.whl", hash = "sha256:a8c4922db71e4fdb90e0d0bc6e50f9b273d3397925e5e60a717e719201778d22"},
@@ -2451,8 +2472,8 @@ qtconsole = [
{file = "qtconsole-5.1.1.tar.gz", hash = "sha256:bbc34bca14f65535afcb401bc74b752bac955e5313001ba640383f7e5857dc49"},
]
qtpy = [
{file = "QtPy-1.11.0-py2.py3-none-any.whl", hash = "sha256:bd8baebb80c4d0d97e4e5a5cf15695522f6acc1fecc20b94a70a01ddf6c9e27e"},
{file = "QtPy-1.11.0.tar.gz", hash = "sha256:bbd61f8d6480a01cec39ad94249dbde7d0a8fce2aca61ff5037b645c4fd13e02"},
{file = "QtPy-1.11.1-py2.py3-none-any.whl", hash = "sha256:78f48d7cee7848f92c49ab998f63ca932fddee4b1f89707d6b73eeb0a7110324"},
{file = "QtPy-1.11.1.tar.gz", hash = "sha256:d471fcb9cf96315b564ad3b42ca830d0286d1049d6a44c578d3dc3836381bb91"},
]
regex = [
{file = "regex-2021.8.28-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:9d05ad5367c90814099000442b2125535e9d77581855b9bee8780f1b41f2b1a2"},

View File

@@ -32,6 +32,7 @@ flake8-bugbear = "^21.4.3"
Sphinx = "^4.1.1"
sphinx-rtd-theme = "^0.5.2"
myst-parser = "^0.15.1"
nbsphinx = "^0.8.7"
tqdm = "^4.62.2"
psutil = "^5.8.0"
py-cpuinfo = "^8.0.0"