Skip to content

Commit

Permalink
feat: updating to jupyterlab 4 + altair 5
Browse files Browse the repository at this point in the history
  • Loading branch information
kirangadhave committed May 14, 2023
1 parent 31aafda commit 58ed5d9
Show file tree
Hide file tree
Showing 16 changed files with 16,289 additions and 11,014 deletions.
19 changes: 19 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v4.0.4
_src_path: https://github.com/jupyterlab/extension-template
author_email: [email protected]
author_name: Kiran Gadhave
data_format: string
file_extension: ''
has_binder: true
has_settings: true
kind: frontend
labextension_name: interactivede
mimetype: ''
mimetype_name: ''
project_short_description: A JupyterLab extension.
python_name: interactivede
repository: https://github.com/kirangadhave/interactivede.git
test: false
viewer_name: ''

17 changes: 2 additions & 15 deletions .github/workflows/binder-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,6 @@ jobs:
permissions:
pull-requests: write
steps:
- name: comment on PR with Binder link
uses: actions/github-script@v6
- uses: jupyterlab/maintainer-tools/.github/actions/binder-link@v1
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
var PR_HEAD_USERREPO = process.env.PR_HEAD_USERREPO;
var PR_HEAD_REF = process.env.PR_HEAD_REF;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${PR_HEAD_USERREPO}/${PR_HEAD_REF}) :point_left: Launch a binder notebook on branch _${PR_HEAD_USERREPO}/${PR_HEAD_REF}_`
})
env:
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
PR_HEAD_USERREPO: ${{ github.event.pull_request.head.repo.full_name }}
github_token: ${{ secrets.github_token }}
136 changes: 65 additions & 71 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,89 +2,83 @@ 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: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Install dependencies
run: python -m pip install -U jupyterlab~=3.6

- name: Lint the extension
run: |
set -eux
jlpm
jlpm run lint
jlpm run lint:check
- name: Build the extension
run: |
set -eux
python -m pip install .[test]
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "interactivede.*OK"
python -m jupyterlab.browser_check
- name: Package the extension
run: |
set -eux
pip install build
python -m build
pip uninstall -y "interactivede" jupyterlab
- name: Upload extension packages
uses: actions/upload-artifact@v3
with:
name: extension-artifacts
path: dist/interactivede*
if-no-files-found: warn

- name: Upload extension packages
uses: actions/upload-artifact@v3
with:
name: extension-artifacts
path: interactivede/dist/interactivede*
if-no-files-found: warn
- name: Checkout
uses: actions/checkout@v3

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

- name: Install dependencies
run: python -m pip install -U "jupyterlab>=4.0.0b0,<5"

- name: Lint the extension
run: |
set -eux
jlpm
jlpm run lint:check
- name: Build the extension
run: |
set -eux
python -m pip install .[test]
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "interactivede.*OK"
python -m jupyterlab.browser_check
- name: Package the extension
run: |
set -eux
pip install build
python -m build
pip uninstall -y "interactivede" jupyterlab
- name: Upload extension packages
uses: actions/upload-artifact@v3
with:
name: extension-artifacts
path: dist/interactivede*
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@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~=3.6" interactivede*.whl
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "interactivede.*OK"
python -m jupyterlab.browser_check --no-chrome-test
- name: Checkout
uses: actions/checkout@v3
- 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.0b0,<5" interactivede*.whl
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "interactivede.*OK"
python -m jupyterlab.browser_check --no-browser-test
check_links:
name: Check Links
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Check Release
on:
push:
branches: ['main']
branches: ["main"]
pull_request:
branches: ['*']
branches: ["*"]

jobs:
check_release:
Expand All @@ -16,10 +16,10 @@ jobs:
- name: Install Dependencies
run: |
pip install -e .
- name: Check Release
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
with:

token: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Distributions
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/enforce-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Enforce PR label

on:
pull_request:
types: [labeled, unlabeled, opened, edited, synchronize]
jobs:
enforce-label:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: enforce-triage-label
uses: jupyterlab/maintainer-tools/.github/actions/enforce-label@v1
15 changes: 8 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ node_modules/
*.egg-info/
.ipynb_checkpoints
*.tsbuildinfo
labextension/
interactivede/labextension
# Version file is handled by hatchling
_version.py

# Integration tests
*/ui-tests/test-results/
*/ui-tests/playwright-report/
interactivede/_version.py

# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python
Expand Down Expand Up @@ -84,6 +80,9 @@ docs/_build/
# PyBuilder
target/

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

Expand Down Expand Up @@ -118,5 +117,7 @@ dmypy.json
# OSX files
.DS_Store

package-lock.json
# Yarn cache
.yarn/
*.zwc
_temp_extension
3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
enableImmutableInstalls: false

nodeLinker: node-modules
19 changes: 8 additions & 11 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ The extension can be published to `PyPI` and `npm` manually or using the [Jupyte

### Python package

This extension can be distributed as Python
packages. All of the Python
packaging instructions in the `pyproject.toml` file to wrap your extension in a
Python package. Before generating a package, we first need to install `build`.
This extension can be distributed as Python packages. All of the Python
packaging instructions are in the `pyproject.toml` file to wrap your extension in a
Python package. Before generating a package, you first need to install some tools:

```bash
pip install build twine hatch
Expand Down Expand Up @@ -49,17 +48,15 @@ npm publish --access public

The extension repository should already be compatible with the Jupyter Releaser.

Check out the [workflow documentation](https://github.com/jupyter-server/jupyter_releaser#typical-workflow) for more information.
Check out the [workflow documentation](https://jupyter-releaser.readthedocs.io/en/latest/get_started/making_release_from_repo.html) for more information.

Here is a summary of the steps to cut a new release:

- Fork the [`jupyter-releaser` repo](https://github.com/jupyter-server/jupyter_releaser)
- Add `ADMIN_GITHUB_TOKEN`, `PYPI_TOKEN` and `NPM_TOKEN` to the Github Secrets in the fork
- Add `ADMIN_GITHUB_TOKEN`, `PYPI_TOKEN` and `NPM_TOKEN` to the [Github Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets) in the repository
- Go to the Actions panel
- Run the "Draft Changelog" workflow
- Merge the Changelog PR
- Run the "Draft Release" workflow
- Run the "Publish Release" workflow
- Run the "Step 1: Prep Release" workflow
- Check the draft changelog
- Run the "Step 2: Publish Release" workflow

## Publishing to `conda-forge`

Expand Down
48 changes: 15 additions & 33 deletions binder/postBuild
Original file line number Diff line number Diff line change
Expand Up @@ -14,52 +14,34 @@ from pathlib import Path


ROOT = Path.cwd()
from pathlib import Path


def get_active_branch_name():
head_dir = Path(".") / ".git" / "HEAD"
with head_dir.open("r") as f:
content = f.read().splitlines()

for line in content:
if line[0:4] == "ref:":
return line.partition("refs/heads/")[2]


def _(*args, **kwargs):
"""Run a command, echoing the args
""" Run a command, echoing the args
fails hard if something goes wrong
fails hard if something goes wrong
"""
print("\n\t", " ".join(args), "\n")
return_code = subprocess.call(args, **kwargs)
if return_code != 0:
print("\nERROR", return_code, " ".join(args))
sys.exit(return_code)
return return_code

# verify the environment is self-consistent before even starting
_(sys.executable, "-m", "pip", "check")

branch = get_active_branch_name()
if branch == "main":
_(sys.executable, "-m", "pip", "install", "interactivede")
_("jupyter", "labextension", "enable", "interactivede")
else:
# verify the environment is self-consistent before even starting
_(sys.executable, "-m", "pip", "check")
# install the labextension
_(sys.executable, "-m", "pip", "install", "-e", ".")
_(sys.executable, "-m", "jupyter", "labextension", "develop", "--overwrite", ".")

# install the labextension
_(sys.executable, "-m", "pip", "install", "-e", ".")
_(sys.executable, "-m", "jupyter", "labextension", "develop", "--overwrite", ".")
# verify the environment the extension didn't break anything
_(sys.executable, "-m", "pip", "check")

# verify the environment the extension didn't break anything
_(sys.executable, "-m", "pip", "check")
# list the extensions
_("jupyter", "server", "extension", "list")

# list the extensions
_("jupyter", "server", "extension", "list")
# initially list installed extensions to determine if there are any surprises
_("jupyter", "labextension", "list")

# initially list installed extensions to determine if there are any surprises
_("jupyter", "labextension", "list")

print("JupyterLab with interactivede is ready to run with:\n")
print("\tjupyter lab\n")
print("JupyterLab with interactivede is ready to run with:\n")
print("\tjupyter lab\n")
Loading

0 comments on commit 58ed5d9

Please sign in to comment.