DOC: Add replite console to the users docs by martinRenou · Pull Request #22634 · matplotlib/matplotlib · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .circleci/config.yml
7 changes: 7 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
'sphinxext.redirect_from',
'sphinx_copybutton',
'sphinx_design',
'jupyterlite_sphinx',
]

exclude_patterns = [
Expand Down Expand Up @@ -615,6 +616,12 @@ def js_tag_with_cache_busting(js):
1),
]

# jupyterlite config
jupyterlite_config = "jupyter_lite_config.json"
jupyterlite_dir = "."
jupyterlite_contents = ["gallery/**"]
jupyterlite_bind_ipynb_suffix = False

# numpydoc config

numpydoc_show_class_members = False
Expand Down
11 changes: 10 additions & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Installation

Further details are available in the :doc:`Installation Guide <users/installing/index>`.


******************
Learning resources
******************
Expand Down Expand Up @@ -90,6 +89,16 @@ Learning resources
- Subplots (`.pyplot.subplots`, `.pyplot.subplot_mosaic`)


************
Live example
************

Try Matplotlib directly in this documentation (Press ``shift+Enter`` to execute code)! Alternatively, you can try the gallery examples in `our JupyterLite deployment <./lite/lab>`__.

.. retrolite:: matplotlib.ipynb
:height: 600px
:prompt: Try Matplotlib!

********************
Third-party packages
********************
Expand Down
9 changes: 9 additions & 0 deletions doc/jupyter-lite.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"jupyter-lite-schema-version": 0,
"jupyter-config-data": {
"disabledExtensions": [
"@jupyterlite/javascript-kernel-extension",
"@jupyterlite/pyolite-kernel-extension"
]
}
}
8 changes: 8 additions & 0 deletions doc/jupyter_lite_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"XeusPythonEnv": {
"packages": ["numpy", "matplotlib", "ipympl"]
},
"LiteBuildConfig": {
"ignore_contents": ["\\.(rst|zip|pickle|py|md5|png|gif)"]
}
}
44 changes: 44 additions & 0 deletions doc/matplotlib.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "55c65d1e-870c-4358-b125-0595e497103b",
"metadata": {},
"outputs": [],
"source": [
"%matplotlib widget\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"fig = plt.figure()\n",
"n = 250\n",
"x = np.linspace(0, 200, n)\n",
"y = np.random.randint(200, size=n)\n",
"plt.plot(x, y);"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python (XPython)",
"language": "python",
"name": "xeus-python"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
2 changes: 2 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ dependencies:
- mpl-sphinx-theme
- sphinxcontrib-svg2pdfconverter
- pikepdf
- jupyterlite-sphinx>=0.7.1
- jupyterlite-xeus-python>=0.5.3
# testing
- coverage
- flake8>=3.8
Expand Down
2 changes: 2 additions & 0 deletions requirements/doc/doc-requirements.txt