Skip to content
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

Add Pyodide and other features. Update README #1

Merged
merged 6 commits into from
Apr 16, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
name: Build and Deploy
name: build and deploy

on:
push:
branches:
- main
paths:
- 'build-environment.yml'
- 'environment.yml'
- 'content/'
pull_request:
branches:
- '*'
paths:
- 'build-environment.yml'
- 'environment.yml'
- 'content/'

jobs:
build:
Expand Down
53 changes: 6 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,10 @@
# xeus-python + JupyterLite demo
# psa-notebook: Jupyter notebook for power system analysis in the browser

[![lite-badge](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)](https://jupyterlite.github.io/xeus-python-demo/retro/notebooks/?path=demo.ipynb)
[![lite-badge](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)](https://edxu96.github.io/psa-notebook) [![Build and Deploy](https://github.com/edxu96/psa-notebook/actions/workflows/deploy.yml/badge.svg)](https://github.com/edxu96/psa-notebook/actions/workflows/deploy.yml)

xeus-python + JupyterLite deployed as a static site to GitHub Pages, for demo purposes.
## Requirements

## ✨ Try it in your browser ✨
JupyterLite is being tested against modern web browsers:

https://jupyterlite.github.io/xeus-python-demo/retro/notebooks/?path=demo.ipynb

## ≠ How does it compare to the Pyodide kernel?

#### Pyodide kernel:

- Is based on [Pyodide](https://github.com/pyodide/pyodide)
- Uses [IPython](https://github.com/ipython/ipython) for the code execution (access to IPython magics, support for the inline Matplotlib backend, *etc*)
- Provides a way to dynamically install packages with ``piplite`` (**e.g.** ``await piplite.install("ipywidgets")``)
- **Does not support** sleeping with ``from time import sleep``
- **Does not support** pre-installing packages

#### jupyterlite-xeus-python:

- Is based on [xeus-python](https://github.com/jupyter-xeus/xeus-python)
- Uses [IPython](https://github.com/ipython/ipython) for the code execution (access to IPython magics, support for the inline Matplotlib backend, *etc*)
- **Does not provide** a way to dynamically install packages (yet. We are working on building a ``mamba`` package manager for WASM)
- **Supports** sleeping with ``from time import sleep``
- **Supports** pre-installing packages from ``emscripten-forge`` and ``conda-forge``, by providing an ``environment.yml`` file defining the runtime environment

## 💡 How to make your own deployment

![Deploy your own](deploy.gif)

Then your site will be published under https://{USERNAME}.github.io/{DEMO_REPO_NAME}

## 📦 How to install extra packages

You can pre-install extra packages for xeus-python by adding them to the ``environment.yml`` file.

Only ``no-arch`` packages from ``conda-forge`` and packages from ``emscripten-forge`` can be installed.

For example, if you want to create a JupyterLite deployment with NumPy and Matplotlib pre-installed, you would need to edit the ``environment.yml`` file as following:

```yml
name: xeus-python-kernel
channels:
- https://repo.mamba.pm/emscripten-forge
- https://repo.mamba.pm/conda-forge
dependencies:
- numpy
- matplotlib
```
- Firefox 90+
- Chromium 89+
4 changes: 4 additions & 0 deletions build-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ dependencies:
- jupyterlite-core >=0.1.0,<0.2.0
- pip:
- jupyterlite-xeus-python >=0.8.0,<0.9.0
- jupyterlite-xeus-sqlite
- jupyterlite-pyodide-kernel
- ipyleaflet
- jupyterlab-geojson
Binary file removed deploy.gif
Binary file not shown.
2,548 changes: 2,548 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions poetry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[virtualenvs]
create = true
in-project = true
20 changes: 20 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[tool.poetry]
name = "psa-notebook"
version = "0.1.0"
description = "Jupyter notebook for power system analysis in the browser."
authors = ["Edward Xu <edxu96@outlook.com>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "~3.8"
jupyterlite-core = "~0.1.0"
jupyterlab = "~3.6.3"
jupyterlite-pyodide-kernel = "~0.0.6"
jupyterlite-xeus-sqlite = "~0.2.1"
jupyterlab-geojson = "~3.3.1"
jupyterlite-xeus-python = "~0.8.0"
ipyleaflet = "~0.17.2"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
857 changes: 857 additions & 0 deletions requirements.txt

Large diffs are not rendered by default.