-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from martinRenou/add_jupyterlite_directive
Add jupyterlite directive and rework docs
- Loading branch information
Showing
7 changed files
with
197 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
Configuration | ||
============= | ||
|
||
You can provide custom configuration to your JupyterLite deployment. | ||
|
||
For example, if you want to have bqplot working in this deployment, you need to install the bqplot federated extension | ||
and you can serve the bqplot wheel to ``piplite``, this is done by telling your ``conf.py`` where to look for the jupyterlite config: | ||
|
||
.. code-block:: python | ||
jupyterlite_config = "jupyterlite_config.json" | ||
The ``jupyterlite_config.json`` containing the following: | ||
|
||
.. code-block:: json | ||
{ | ||
"LiteBuildConfig": { | ||
"federated_extensions": [ | ||
"https://github.com/conda-forge/releases/releases/download/noarch/bqplot-0.12.33-pyhd8ed1ab_0.tar.bz2/bqplot-0.12.33-pyhd8ed1ab_0.tar.bz2", | ||
], | ||
"ignore_sys_prefix": true, | ||
"piplite_urls": [ | ||
"https://files.pythonhosted.org/packages/py2.py3/b/bqplot/bqplot-0.12.33-py2.py3-none-any.whl", | ||
] | ||
} | ||
} | ||
Then you should be able to show Notebooks working with bqplot! | ||
|
||
.. code-block:: rst | ||
.. retrolite:: bqplot.ipynb | ||
.. retrolite:: bqplot.ipynb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,121 +1,27 @@ | ||
jupyterlite-sphinx | ||
================== | ||
|
||
Installation | ||
------------ | ||
|
||
You can install ``jupyterlite-sphinx`` with ``pip``: | ||
|
||
.. code-block:: | ||
pip install jupyterlite-sphinx | ||
then you need to add the ``jupyterlite-sphinx`` extension to your ``conf.py`` file of your sphinx docs: | ||
|
||
.. code-block:: python | ||
extensions = [ | ||
'jupyterlite_sphinx', | ||
# And other sphinx extensions | ||
# ... | ||
] | ||
Replite directive | ||
----------------- | ||
|
||
``jupyterlite-sphinx`` provides a ``replite`` directive that allows you to embed a replite console in your docs. | ||
This directive takes the same options as the ``replite`` package, see https://github.com/jtpio/replite for reference. | ||
|
||
.. code-block:: rst | ||
.. replite:: | ||
:kernel: python | ||
:toolbar: 1 | ||
:theme: JupyterLab Light | ||
:width: 100% | ||
:height: 600px | ||
print('Hello, World!') | ||
.. replite:: | ||
:kernel: python | ||
:toolbar: 1 | ||
:theme: JupyterLab Light | ||
:width: 100% | ||
:height: 600px | ||
|
||
print('Hello, World!') | ||
|
||
Retrolite directive | ||
------------------- | ||
|
||
``jupyterlite-sphinx`` provides a ``retrolite`` directive that allows you to embed an entire executable Notebook in your docs. | ||
It takes the name of the Notebook as argument: | ||
|
||
.. code-block:: rst | ||
.. retrolite:: my_notebook.ipynb | ||
:width: 100% | ||
:height: 600px | ||
.. retrolite:: my_notebook.ipynb | ||
:width: 100% | ||
:height: 600px | ||
|
||
Or you can simply show the filetree: | ||
|
||
.. code-block:: rst | ||
.. retrolite:: | ||
:width: 100% | ||
:height: 600px | ||
.. retrolite:: | ||
:width: 100% | ||
:height: 600px | ||
|
||
|
||
JupyterLab and RetroLab deployed for you | ||
---------------------------------------- | ||
A Sphinx extension that provides utilities for embedding JupyterLite in your docs. | ||
|
||
``jupyterlite-sphinx`` makes a full deployment of JupyterLite for you, you can access the JupyterLab UI and RetroLab UI following the | ||
``./lite/lab/index.html`` and ``./lite/retro/index.html`` relative URLs: | ||
|
||
`JupyterLab <./lite/lab/index.html>`_ | ||
`Retrolab <./lite/retro/index.html>`_ | ||
|
||
Configuration | ||
------------- | ||
|
||
You can provide custom configuration to your JupyterLite deployment. | ||
|
||
For example, if you want to have bqplot working in this deployment, you need to install the bqplot federated extension | ||
and you can serve the bqplot wheel to ``piplite``, this is done by telling your ``conf.py`` where to look for the jupyterlite config: | ||
|
||
.. code-block:: python | ||
jupyterlite_config = "jupyterlite_config.json" | ||
The ``jupyterlite_config.json`` containing the following: | ||
|
||
.. code-block:: json | ||
`Retrolab <./lite/retro/index.html>`_ | ||
|
||
{ | ||
"LiteBuildConfig": { | ||
"federated_extensions": [ | ||
"https://github.com/conda-forge/releases/releases/download/noarch/bqplot-0.12.33-pyhd8ed1ab_0.tar.bz2/bqplot-0.12.33-pyhd8ed1ab_0.tar.bz2", | ||
], | ||
"ignore_sys_prefix": true, | ||
"piplite_urls": [ | ||
"https://files.pythonhosted.org/packages/py2.py3/b/bqplot/bqplot-0.12.33-py2.py3-none-any.whl", | ||
] | ||
} | ||
} | ||
|
||
Then you should be able to show Notebooks working with bqplot! | ||
.. toctree:: | ||
:caption: Installation | ||
:maxdepth: 2 | ||
|
||
.. code-block:: rst | ||
installation | ||
configuration | ||
|
||
.. retrolite:: bqplot.ipynb | ||
.. toctree:: | ||
:caption: Usage | ||
:maxdepth: 2 | ||
|
||
.. retrolite:: bqplot.ipynb | ||
jupyterlite | ||
retrolite | ||
replite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Installation | ||
============ | ||
|
||
You can install ``jupyterlite-sphinx`` with ``pip``: | ||
|
||
.. code-block:: | ||
pip install jupyterlite-sphinx | ||
then you need to add the ``jupyterlite-sphinx`` extension to your ``conf.py`` file of your sphinx docs: | ||
|
||
.. code-block:: python | ||
extensions = [ | ||
'jupyterlite_sphinx', | ||
# And other sphinx extensions | ||
# ... | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
JupyterLite directive | ||
===================== | ||
|
||
``jupyterlite-sphinx`` provides a ``jupyterlite`` directive that allows you to embed JupyterLab in your docs. | ||
|
||
.. code-block:: rst | ||
.. jupyterlite:: | ||
:width: 100% | ||
:height: 600px | ||
.. jupyterlite:: | ||
:width: 100% | ||
:height: 600px | ||
|
||
You can also pass a Notebook file to open automatically: | ||
|
||
.. code-block:: rst | ||
.. jupyterlite:: my_notebook.ipynb | ||
:width: 100% | ||
:height: 600px | ||
.. jupyterlite:: my_notebook.ipynb | ||
:width: 100% | ||
:height: 600px |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Replite directive | ||
================= | ||
|
||
``jupyterlite-sphinx`` provides a ``replite`` directive that allows you to embed a replite console in your docs. | ||
This directive takes the same options as the ``replite`` package, see https://github.com/jtpio/replite for reference. | ||
|
||
.. code-block:: rst | ||
.. replite:: | ||
:kernel: python | ||
:toolbar: 1 | ||
:theme: JupyterLab Light | ||
:width: 100% | ||
:height: 600px | ||
print('Hello, World!') | ||
.. replite:: | ||
:kernel: python | ||
:toolbar: 1 | ||
:theme: JupyterLab Light | ||
:width: 100% | ||
:height: 600px | ||
|
||
print('Hello, World!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
RetroLite directive | ||
=================== | ||
|
||
``jupyterlite-sphinx`` provides a ``retrolite`` directive that allows you to embed Retrolab in your docs. | ||
|
||
.. code-block:: rst | ||
.. retrolite:: | ||
:width: 100% | ||
:height: 600px | ||
.. retrolite:: | ||
:width: 100% | ||
:height: 600px | ||
|
||
You can also pass a Notebook file to open: | ||
|
||
.. code-block:: rst | ||
.. retrolite:: my_notebook.ipynb | ||
:width: 100% | ||
:height: 600px | ||
.. retrolite:: my_notebook.ipynb | ||
:width: 100% | ||
:height: 600px |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters