Skip to content
This repository has been archived by the owner on Feb 14, 2024. It is now read-only.

Update docs using 0.3.0 #19

Merged
merged 5 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
194 changes: 0 additions & 194 deletions docs/Makefile

This file was deleted.

2 changes: 2 additions & 0 deletions docs/source/conf.py → docs/conf.py
Expand Up @@ -14,3 +14,5 @@
exclude_patterns = []

html_theme = "pydata_sphinx_theme"

jupyterlite_config = "jupyterlite_config.json"
67 changes: 67 additions & 0 deletions docs/configuration.rst
@@ -0,0 +1,67 @@
.. _configuration:

Configuration
=============

Pre-installed packages
----------------------

xeus-python allows you to pre-install packages in the Python runtime.

Requirements
~~~~~~~~~~~~

This feature requires you to have at least ``conda``, `mamba <https://github.com/mamba-org/mamba>`_ or ``micromamba`` installed.

You also need to install ``emsdk``, this can be done by installing it from ``conda-forge``:

.. code::

conda install -c conda-forge emsdk

# OR

mamba install -c conda-forge emsdk

# OR

micromamba install -c conda-forge emsdk

Usage
~~~~~

You can pre-install packages by passing the ``XeusPythonEnv.packages`` CLI option to ``jupyter lite build``.

.. note::
This will automatically install any labextension that it founds, for example installing ipyleaflet will make ipyleaflet work without the need to manually install the jupyter-leaflet labextension.

For example, say you want to install NumPy, Matplotlib and ipyleaflet, it can be done with the following command:

.. code::

jupyter lite build --XeusPythonEnv.packages=numpy,matplotlib,ipyleaflet

The same can be achieved through a `jupyterlite_config.json` file:

.. code::

{
"XeusPythonEnv": {
"packages": ["numpy", "matplotlib", "ipyleaflet"]
}
}

Then those packages are usable directly:

.. replite::
:kernel: xeus-python
:height: 600px

%matplotlib inline

import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()
plt.plot(np.sin(np.linspace(0, 20, 100)))
plt.show();
10 changes: 6 additions & 4 deletions docs/environment.yml
Expand Up @@ -4,11 +4,13 @@ channels:
- conda-forge

dependencies:
- yarn
- jupyterlab
- jupyter-packaging
- mamba
- pydata-sphinx-theme
- emsdk
# - empack

- pip:
- jupyterlite-xeus-python
- jupyterlite
- jupyterlite-sphinx
- jupyterlite-xeus-python==0.3.0
- empack
26 changes: 26 additions & 0 deletions docs/index.rst
@@ -0,0 +1,26 @@
xeus-python in JupyterLite
==========================

The `xeus-python <https://github.com/jupyter-xeus/xeus-python>`_ kernel compiled to wasm and installable in JupyterLite!!

Features:

- all IPython features included (magics, matplotlib inline `etc`)
- code completion
- code inspection
- interactive widgets (ipywidgets, ipyleaflet, bqplot, ipycanvas `etc`)
- ``from time import sleep`` works!
- pre-installed packages: you can install the packages you want in your xeus-python lite installation (see :ref:`configuration` page)

.. replite::
:kernel: xeus-python
:height: 600px

print("Hello from xeus-python!")

.. toctree::
:caption: Installation
:maxdepth: 2

installation
configuration
13 changes: 13 additions & 0 deletions docs/installation.rst
@@ -0,0 +1,13 @@
.. _installation:

Installation
============

You can install ``jupyterlite-xeus-python`` with ``pip``:

.. code::

pip install jupyterlite jupyterlite-xeus-python

# This should pick up the xeus-python kernel automatically
jupyter lite build
5 changes: 5 additions & 0 deletions docs/jupyterlite_config.json
@@ -0,0 +1,5 @@
{
"XeusPythonEnv": {
"packages": ["numpy", "matplotlib", "ipyleaflet"]
}
}