Skip to content

DOC: Add replite console to the users docs #22634

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
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
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ commands:
python -m pip install --upgrade --user wheel
python -m pip install --upgrade --user 'setuptools!=60.6.0'

mamba-install:
description: Install micromamba so it can be used for building the emscripten-forge environment
steps:
- run:
name: Install micromamba
command: |
curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba
pwd
ls

doc-deps-install:
parameters:
numpy_version:
Expand Down Expand Up @@ -133,6 +143,8 @@ commands:
- run:
name: Build documentation
command: |
export PATH="$(pwd)/../bin:$PATH"
echo $PATH
# Set epoch to date of latest tag.
export SOURCE_DATE_EPOCH="$(git log -1 --format=%at $(git describe --abbrev=0))"
# Set release mode only when deploying to devdocs.
Expand Down Expand Up @@ -217,6 +229,7 @@ jobs:
- apt-install
- fonts-install
- pip-install
- mamba-install

- mpl-install
- doc-deps-install
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ sphinxcontrib-svg2pdfconverter>=1.1.0
sphinx-gallery>=0.10
sphinx-copybutton
sphinx-design
jupyterlite-sphinx>=0.7.1
jupyterlite-xeus-python>=0.5.3