Skip to content

Commit

Permalink
Merge pull request #51 from jtpio/lab3
Browse files Browse the repository at this point in the history
Update to JupyterLab 3 new extension system
  • Loading branch information
jtpio authored Jan 12, 2021
2 parents 753443a + a2cb791 commit 5f66cbe
Show file tree
Hide file tree
Showing 17 changed files with 4,870 additions and 814 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: TMP fix - install libgbm1
run: sudo apt install -y libgbm1
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Install Python
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: '3.7'
architecture: 'x64'
- name: Install JupyterLab
run: python -m pip install jupyterlab
- name: Install the ipylab Python package
run: python -m pip install -e .
- name: Install the ipylab JupyterLab extension
- name: Install dependencies
run: |
jlpm && jlpm run build
jupyter labextension install .
python -m pip install --upgrade pip
python -m pip install jupyter_packaging
python -m pip install --pre jupyterlab
- name: Install the ipylab Python package and JupyterLab extension
run: |
python -m pip install .
jupyter labextension list 2>&1 | grep -ie "ipylab.*enabled.*ok" -
- name: Browser check
run: python -m jupyterlab.browser_check
run: |
python -m jupyterlab.browser_check
95 changes: 95 additions & 0 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Packaging

on:
push:
branches: [ master ]
pull_request:
branches: '*'

env:
PIP_DISABLE_PIP_VERSION_CHECK: 1

defaults:
run:
shell: bash -l {0}

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '14.x'
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install setuptools jupyter_packaging "jupyterlab>=3,<4"
- name: Build pypi distributions
run: |
python setup.py sdist bdist_wheel
- name: Build npm distributions
run: |
npm pack
cp *.tgz dist
- name: Build checksum file
run: |
cd dist
sha256sum * | tee SHA256SUMS
- name: Upload distributions
uses: actions/upload-artifact@v2
with:
name: dist ${{ github.run_number }}
path: ./dist

install:
runs-on: ${{ matrix.os }}-latest
needs: [build]
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
python: ['3.6', '3.9']
include:
- python: '3.6'
dist: 'ipylab*.tar.gz'
- python: '3.9'
dist: 'ipylab*.whl'
- os: windows
py_cmd: python
- os: macos
py_cmd: python3
- os: ubuntu
py_cmd: python
steps:
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
architecture: 'x64'
- uses: actions/download-artifact@v2
with:
name: dist ${{ github.run_number }}
path: ./dist
- name: Install the prerequisites
run: |
${{ matrix.py_cmd }} -m pip install pip wheel
- name: Install the package
run: |
cd dist
${{ matrix.py_cmd }} -m pip install -vv ${{ matrix.dist }}
- name: Validate environment
run: |
${{ matrix.py_cmd }} -m pip freeze
${{ matrix.py_cmd }} -m pip check
- name: Validate the install
run: |
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "ipylab.*enabled.*ok" -
12 changes: 6 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '10.x'
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install setuptools wheel twine jupyter-packaging jupyterlab
- name: Build and publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
Expand All @@ -31,12 +31,12 @@ jobs:
twine upload dist/*
- uses: actions/setup-node@v1
with:
node-version: '10.x'
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
npm publish
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,5 @@ ipylab/labextension/*.tgz
ipylab/labextension

package-lock.json
yarn.lock

.vscode
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
**/node_modules
**/lib
**/package.json
ipylab/labextension
7 changes: 4 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
include LICENSE.txt
include README.md

include setupbase.py
include setup.py
include pyproject.toml
include pytest.ini
include .coverage.rc

include tsconfig.json
include package.json
include ipylab/labextension/*.tgz

# Documentation
graft docs
Expand All @@ -24,8 +24,9 @@ graft tests
prune tests/build

# Javascript files
graft ipylab/nbextension
graft ipylab/labextension
graft src
graft style
prune **/node_modules
prune coverage
prune lib
Expand Down
21 changes: 6 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,10 @@ You can install using `pip`:
pip install ipylab
```

Or with `conda`:
Or with `mamba` / `conda`:

```bash
conda install -c conda-forge ipylab
```

To install the JupyterLab extension:

```bash
jupyter labextension install @jupyter-widgets/jupyterlab-manager ipylab
mamba install -c conda-forge ipylab
```

## Running the examples locally
Expand All @@ -69,9 +63,6 @@ To try out the examples locally, the recommended way is to create a new environm
conda create -n ipylab-examples -c conda-forge jupyterlab ipylab ipytree bqplot ipywidgets numpy
conda activate ipylab-examples

# install the JupyterLab extensions
jupyter labextension install @jupyter-widgets/jupyterlab-manager ipylab bqplot ipytree

# start JupyterLab
jupyter lab
```
Expand All @@ -86,19 +77,19 @@ jupyter lab

```bash
# create a new conda environment
conda create -n ipylab -c conda-forge jupyterlab nodejs
mamba create -n ipylab -c conda-forge jupyter-packaging nodejs python -y

# activate the environment
conda activate ipylab

# install the Python package
python -m pip install -e ".[dev]"

# link the extension files
jupyter labextension develop . --overwrite

# compile the extension
jlpm && jlpm run build

# install the widgets extension and the ipylab extension locally
jupyter labextension install @jupyter-widgets/jupyterlab-manager . --debug
```

## Related projects
Expand Down
12 changes: 12 additions & 0 deletions ipylab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,19 @@
# Copyright (c) ipylab contributors.
# Distributed under the terms of the Modified BSD License.

import json
import os.path as osp

from .jupyterfrontend import JupyterFrontEnd
from .widgets import Panel, SplitPanel

from ._version import __version__, version_info

HERE = osp.abspath(osp.dirname(__file__))

with open(osp.join(HERE, "labextension", "package.json")) as fid:
data = json.load(fid)


def _jupyter_labextension_paths():
return [{"src": "labextension", "dest": data["name"]}]
10 changes: 8 additions & 2 deletions ipylab/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@ def add(self, widget, area, args=None):

def expand_left(self):
self.send(
{"func": "expandLeft", "payload": {},}
{
"func": "expandLeft",
"payload": {},
}
)

def expand_right(self):
self.send(
{"func": "expandRight", "payload": {},}
{
"func": "expandRight",
"payload": {},
}
)
Loading

0 comments on commit 5f66cbe

Please sign in to comment.