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

Updates to JupyterLite 0.2.0, hatch, pixi #114

Merged
merged 14 commits into from
Dec 6, 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
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# GitHub syntax highlighting
pixi.lock linguist-language=YAML

119 changes: 70 additions & 49 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,71 +2,92 @@ name: Build

on:
push:
branches: main
branches:
- main
pull_request:
branches: '*'
branches:
- '*'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install dependencies
run: python -m pip install -U "jupyterlab>=4.0.0,<5"

- name: Install dependencies
run: python -m pip install -U jupyterlab~=3.5.3 check-manifest
- name: Lint the extension
run: |
set -eux
jlpm
jlpm run lint:check

- name: Build the extension
run: |
set -eux
jlpm install
jlpm run eslint:check
python -m pip install .
- name: Build the extension
run: |
set -eux
python -m pip install .

jupyter labextension list 2>&1 | grep -ie "@p5-notebook/lab-extension.*OK"
jupyter labextension list 2>&1 | grep -ie "@p5-notebook/p5-theme-light.*OK"
jupyter labextension list 2>&1 | grep -ie "@p5-notebook/p5-theme-dark.*OK"
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "@p5-notebook/lab-extension.*OK"
jupyter labextension list 2>&1 | grep -ie "@p5-notebook/p5-theme-light.*OK"
jupyter labextension list 2>&1 | grep -ie "@p5-notebook/p5-theme-dark.*OK"
python -m jupyterlab.browser_check

check-manifest -v
- name: Package the extension
run: |
set -eux

pip install build
python -m build --sdist
cp dist/*.tar.gz myextension.tar.gz
pip uninstall -y myextension jupyterlab
rm -rf myextension
pip install build
python -m build
pip uninstall -y "p5_notebook" jupyterlab

- uses: actions/upload-artifact@v3
with:
name: myextension-sdist
path: myextension.tar.gz
- name: Upload extension packages
uses: actions/upload-artifact@v3
with:
name: extension-artifacts
path: dist/p5_notebook*
if-no-files-found: error

test_isolated:
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v3
with:
python-version: '3.8'
architecture: 'x64'
- uses: actions/download-artifact@v3
with:
name: myextension-sdist
- name: Install and Test
run: |
set -eux
# Remove NodeJS, twice to take care of system and locally installed node versions.
sudo rm -rf $(which node)
sudo rm -rf $(which node)
pip install myextension.tar.gz
pip install jupyterlab
jupyter labextension list 2>&1 | grep -ie "@p5-notebook/lab-extension.*OK"
jupyter labextension list 2>&1 | grep -ie "@p5-notebook/p5-theme-light.*OK"
jupyter labextension list 2>&1 | grep -ie "@p5-notebook/p5-theme-dark.*OK"
python -m jupyterlab.browser_check --no-chrome-test
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
architecture: 'x64'
- uses: actions/download-artifact@v3
with:
name: extension-artifacts
- name: Install and Test
run: |
set -eux
# Remove NodeJS, twice to take care of system and locally installed node versions.
sudo rm -rf $(which node)
sudo rm -rf $(which node)

pip install "jupyterlab>=4.0.0,<5" p5_notebook*.whl


jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "@p5-notebook/lab-extension.*OK"
jupyter labextension list 2>&1 | grep -ie "@p5-notebook/p5-theme-light.*OK"
jupyter labextension list 2>&1 | grep -ie "@p5-notebook/p5-theme-dark.*OK"
python -m jupyterlab.browser_check --no-browser-test

check_links:
name: Check Links
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,11 @@ junit.xml
test.ipynb
p5_notebook/labextension
p5_notebook/p5-theme-*
# pixi environments
.pixi

# Yarn 3
.yarn
.pnp*

_version.py
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2020, Jeremy Tuloup
Copyright (c) 2020-2023, Jeremy Tuloup
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
26 changes: 0 additions & 26 deletions MANIFEST.in

This file was deleted.

33 changes: 12 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ A minimal Jupyter Notebook UI for [p5.js](https://p5js.org) kernels.

## Usage

**✨ [Try it in your browser!](https://p5nb.now.sh/) ✨**
**✨ [Try it in your browser!](https://p5nb.vercel.app/) ✨**

## Features 🎁

### Opens with RetroLab by default 📒
### Opens with Jupyter Notebook by default 📒

By default, the p5 notebook opens with the simpler [retro](https://github.com/jupyterlab/retrolab) interface.
By default, the p5 notebook opens with the simpler [notebook](https://github.com/jupyter/notebook) interface.

![intro-retro](https://user-images.githubusercontent.com/591645/135836629-4fb3e6f7-fde5-41d7-bea7-7bd714c5f428.gif)
![intro-notebook](https://user-images.githubusercontent.com/591645/135836629-4fb3e6f7-fde5-41d7-bea7-7bd714c5f428.gif)

### JupyterLab interface 🧪

Expand All @@ -42,38 +42,29 @@ Just like in JupyterLab, the p5 notebook also supports additional display langua

![display-languages](https://user-images.githubusercontent.com/591645/135838407-2ff06596-10da-4d04-ad71-3139ae692211.gif)

### Real Time Collaboration

Users can edit code and work together on the same sketch:

![rtc](https://user-images.githubusercontent.com/591645/135981928-901c93a5-9c90-4ffe-8254-ad3e28d8a145.gif)

### JupyterLab and RetroLab features 🎨

Most of the JupyterLab and RetroLab features are also available, such as switching to the Simple Interface and opening the command palette:

![simple-palette](https://user-images.githubusercontent.com/591645/135837214-860c5a92-b46e-4cd6-aeac-3b0c47ad9329.gif)

### Real Time Collaboration

Coming soon!

## Dev install

This repo includes a couple of additional plugins to tweak the Jupyter UI. To setup a local environment and be able to iterate on them, make sure [Node.js](https://nodejs.org) is installed, then:

```bash
# Clone the repo to your local environment
# Change directory to the fork directory

# create a new enviroment
mamba create --name p5-notebook -c conda-forge python=3.9 yarn jupyterlab jupyter-packaging
conda activate p5-notebook
# install dependencies
pixi install

# Install package in development mode
python -m pip install -e .

# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
pixi run develop

# Rebuild the extension Typescript source after making changes
jlpm run build
pixi run build
```

## Related projects
Expand Down
27 changes: 5 additions & 22 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,10 @@
# small script to deploy to Vercel
set -xeu

# bootstrap the environment
yum install tar wget || true

# install micromamba
export MAMBA_VERSION=0.27.0
URL="https://anaconda.org/conda-forge/micromamba/${MAMBA_VERSION}/download/linux-64/micromamba-${MAMBA_VERSION}-0.tar.bz2"
wget -qO- ${URL} | tar -xvj bin/micromamba

./bin/micromamba shell init --shell=bash -p ~/micromamba

# install pixi
export PIXI_VERSION=v0.9.1 && curl -fsSL https://pixi.sh/install.sh | bash
source ~/.bashrc

micromamba activate
micromamba install python=3.10 -c conda-forge -y

# install dependencies
python -m pip install -r requirements-deploy.txt

# build the JupyterLite site
jupyter lite --version
jupyter lite build

# copy the favicon
cp ./favicon.ico ./_output/lab/favicon.ico
pixi install
pixi run build_lite
pixi run copy_favicon
6 changes: 3 additions & 3 deletions jupyter-lite.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"jupyter-lite-schema-version": 0,
"jupyter-config-data": {
"appName": "p5 notebook",
"appUrl": "./retro",
"appUrl": "./tree",
"collaborative": true,
"disabledExtensions": [
"@jupyterlab/application-extension:logo",
"@jupyterlite/retro-application-extension:logo",
"@jupyter-notebook/application-extension:logo",
"@jupyterlite/application-extension:logo",
"@jupyterlite/retro-application-extension:logo"
"@jupyterlite/notebook-application-extension:logo"
],
"faviconUrl": "./lab/favicon.ico"
}
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"npmClient": "yarn",
"npmClient": "jlpm",
"version": "0.1.0",
"useWorkspaces": true
}
25 changes: 0 additions & 25 deletions p5_notebook/_version.py

This file was deleted.

19 changes: 8 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,13 @@
"build:test": "lerna run build:test",
"bump:version": "lerna version --no-push --force-publish --no-git-tag-version --yes",
"clean": "lerna run clean",
"install": "lerna bootstrap",
"install:dev": "yarn run build:prod && yarn run develop",
"install:extension": "jupyter labextension develop --overwrite .",
"develop": "jupyter labextension develop --overwrite .",
"eslint": "eslint . --ext .ts,.tsx --fix",
"eslint:check": "eslint . --ext .ts,.tsx",
"lint": "yarn run eslint && yarn run prettier",
"lint:check": "yarn run eslint:check && yarn run prettier:check",
"lint": "jlpm run eslint && jlpm run prettier",
"lint:check": "jlpm run eslint:check && jlpm run prettier:check",
"prettier": "prettier --write \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
"prettier:check": "prettier --list-different \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
"publish": "yarn run clean && yarn run build && lerna publish",
"test": "lerna run test",
"watch": "lerna run watch"
},
"devDependencies": {
Expand All @@ -50,23 +46,24 @@
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"lerna": "^4.0.0",
"lint-staged": "^10.4.0",
"lerna": "^6",
"npm-run-all": "^4.1.5",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"shell-quote": "^1.7.2"
},
"jupyter-releaser": {
"skip": ["check-links"],
"skip": [
"check-links"
],
"options": {
"version-cmd": [
"jlpm run bump:version"
]
},
"hooks": {
"before-bump-version": [
"python -m pip install jupyterlab~=3.1",
"python -m pip install jupyterlab~=4.0",
"jlpm"
]
}
Expand Down
Loading