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

Commit 96aea3e

Browse files
authored
Align repo with the extension template (#168)
* Align with the extension template * Lint * Update tsconfig.json * Fix prettier config * Disable noImplicitAny for now * Fix outputDir * Fix handling of _version.py * Update check-release workflow * Update actions/checkout * Install empack * Restore addon and script * Add empack to build deps * Remove _version.py * Update init
1 parent ee180ad commit 96aea3e

19 files changed

+1496
-2378
lines changed

.copier-answers.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2+
_commit: v4.2.1
3+
_src_path: https://github.com/jupyterlab/extension-template
4+
author_email: ''
5+
author_name: JupyterLite Contributors
6+
data_format: string
7+
file_extension: ''
8+
has_binder: false
9+
has_settings: false
10+
kind: frontend
11+
labextension_name: '@jupyterlite/xeus-python-kernel'
12+
mimetype: ''
13+
mimetype_name: ''
14+
project_short_description: A Python kernel for JupyterLite, powered by Xeus
15+
python_name: jupyterlite-xeus-python
16+
repository: https://github.com/jupyterlite/xeus-python-kernel
17+
test: false
18+
viewer_name: ''
19+

.github/workflows/build.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v2
18+
uses: actions/checkout@v4
1919

2020
- name: Install Conda environment with Micromamba
2121
uses: mamba-org/setup-micromamba@v1
@@ -52,7 +52,7 @@ jobs:
5252

5353
steps:
5454
- name: Checkout
55-
uses: actions/checkout@v2
55+
uses: actions/checkout@v4
5656
- name: Install Python
5757
uses: actions/setup-python@v2
5858
with:
@@ -80,12 +80,12 @@ jobs:
8080

8181
steps:
8282
- name: Checkout
83-
uses: actions/checkout@v2
83+
uses: actions/checkout@v4
8484

8585
- uses: actions/download-artifact@v2
8686
with:
8787
name: jupyterlite-xeus-python-sdist
88-
88+
8989
- name: Install Conda environment with Micromamba
9090
uses: mamba-org/setup-micromamba@v1
9191
with:
@@ -111,12 +111,12 @@ jobs:
111111

112112
steps:
113113
- name: Checkout
114-
uses: actions/checkout@v2
114+
uses: actions/checkout@v4
115115

116116
- uses: actions/download-artifact@v2
117117
with:
118118
name: jupyterlite-xeus-python-sdist
119-
119+
120120
- name: Install Conda environment with Micromamba
121121
uses: mamba-org/setup-micromamba@v1
122122
with:
@@ -137,7 +137,7 @@ jobs:
137137

138138
steps:
139139
- name: Checkout
140-
uses: actions/checkout@v2
140+
uses: actions/checkout@v4
141141

142142
- uses: actions/download-artifact@v2
143143
with:
@@ -163,7 +163,7 @@ jobs:
163163

164164
steps:
165165
- name: Checkout
166-
uses: actions/checkout@v2
166+
uses: actions/checkout@v4
167167

168168
- uses: actions/download-artifact@v2
169169
with:

.github/workflows/check-release.yml

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,26 @@
11
name: Check Release
22
on:
33
push:
4-
branches:
5-
- main
4+
branches: ["main"]
65
pull_request:
7-
branches:
8-
- main
9-
10-
permissions:
11-
contents: write
6+
branches: ["*"]
127

138
jobs:
149
check_release:
1510
runs-on: ubuntu-latest
1611
steps:
1712
- name: Checkout
18-
uses: actions/checkout@v2
19-
- name: Install Python
20-
uses: actions/setup-python@v2
21-
with:
22-
python-version: '3.10'
23-
architecture: 'x64'
24-
- name: Install node
25-
uses: actions/setup-node@v2
26-
with:
27-
node-version: '16.x'
28-
- name: Get pip cache dir
29-
id: pip-cache
30-
run: |
31-
echo "::set-output name=dir::$(pip cache dir)"
32-
- name: Cache pip
33-
uses: actions/cache@v1
34-
with:
35-
path: ${{ steps.pip-cache.outputs.dir }}
36-
key: ${{ runner.os }}-pip-${{ hashFiles('package.json') }}
37-
restore-keys: |
38-
${{ runner.os }}-pip-
39-
- name: Cache checked links
40-
uses: actions/cache@v2
41-
with:
42-
path: ~/.cache/pytest-link-check
43-
key: ${{ runner.os }}-linkcheck-${{ hashFiles('**/.md') }}-md-links
44-
restore-keys: |
45-
${{ runner.os }}-linkcheck-
46-
- name: Upgrade packaging dependencies
47-
run: |
48-
pip install --upgrade pip setuptools wheel jupyter-packaging~=0.10 --user
13+
uses: actions/checkout@v4
14+
- name: Base Setup
15+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
4916
- name: Check Release
5017
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
5118
with:
19+
5220
token: ${{ secrets.GITHUB_TOKEN }}
21+
5322
- name: Upload Distributions
54-
uses: actions/upload-artifact@v2
23+
uses: actions/upload-artifact@v3
5524
with:
5625
name: jupyterlite-xeus-python-releaser-dist-${{ github.run_number }}
5726
path: .jupyter_releaser_checkout/dist

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ src/worker.ts
125125
src/web_worker_kernel.ts
126126

127127
# Labextension
128-
share
128+
jupyterlite_xeus_python/labextension
129+
130+
# Version file is handled by hatchling
131+
jupyterlite_xeus_python/_version.py
129132

130133
# venv
131134
.venv

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ node_modules
33
**/lib
44
**/package.json
55
jupyterlite_xeus_python
6-
/_output
6+
_output

.prettierrc

Lines changed: 0 additions & 5 deletions
This file was deleted.

LICENSE

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
BSD 3-Clause License
22

33
Copyright (c) 2021, Thorsten Beier
4-
Copyright (c) 2021, JupyterLite Contributors
4+
Copyright (c) 2021-2023, JupyterLite Contributors
55
All rights reserved.
66

77
Redistribution and use in source and binary forms, with or without
88
modification, are permitted provided that the following conditions are met:
99

10-
* Redistributions of source code must retain the above copyright notice, this
11-
list of conditions and the following disclaimer.
10+
1. Redistributions of source code must retain the above copyright notice, this
11+
list of conditions and the following disclaimer.
1212

13-
* Redistributions in binary form must reproduce the above copyright notice,
14-
this list of conditions and the following disclaimer in the documentation
15-
and/or other materials provided with the distribution.
13+
2. Redistributions in binary form must reproduce the above copyright notice,
14+
this list of conditions and the following disclaimer in the documentation
15+
and/or other materials provided with the distribution.
1616

17-
* Neither the name of the copyright holder nor the names of its
18-
contributors may be used to endorse or promote products derived from
19-
this software without specific prior written permission.
17+
3. Neither the name of the copyright holder nor the names of its
18+
contributors may be used to endorse or promote products derived from
19+
this software without specific prior written permission.
2020

2121
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2222
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Then you only need to build JupyterLite:
5656
jupyter lite build
5757
```
5858

59-
You can also pick another name for that environment file (*e.g.* `custom.yml`), by doing so, you will need to specify that name to xeus-python:
59+
You can also pick another name for that environment file (_e.g._ `custom.yml`), by doing so, you will need to specify that name to xeus-python:
6060

6161
```bash
6262
jupyter lite build --XeusPythonEnv.environment_file=custom.yml
@@ -74,7 +74,7 @@ The `jlpm` command is JupyterLab's pinned version of
7474

7575
```bash
7676
# Clone the repo to your local environment
77-
# Change directory to the jupyterlite_xeus_python directory
77+
# Change directory to the jupyterlite-xeus-python directory
7878
# Install package in development mode
7979
python -m pip install -e .
8080

@@ -99,7 +99,7 @@ With the watch command running, every saved change will immediately be built loc
9999
### Development uninstall
100100

101101
```bash
102-
pip uninstall jupyterlite_xeus_python
102+
pip uninstall jupyterlite-xeus-python
103103
```
104104

105105
In development mode, you will also need to remove the symlink created by `jupyter labextension develop`

RELEASE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Making a new release of jupyterlite_xeus_python
1+
# Making a new release of `jupyterlite-xeus-python`
22

33
The recommended way to make a release is to use [`jupyter_releaser`](https://jupyter-releaser.readthedocs.io/en/latest/get_started/making_release_from_repo.html).
44

docs/configuration.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Then you only need to build JupyterLite:
2727
jupyter lite build
2828
```
2929

30-
You can also pick another name for that environment file (*e.g.* `custom.yml`), by doing so, you will need to specify that name to xeus-python:
30+
You can also pick another name for that environment file (_e.g._ `custom.yml`), by doing so, you will need to specify that name to xeus-python:
3131

3232
```
3333
jupyter lite build --XeusPythonEnv.environment_file=custom.yml
@@ -62,6 +62,7 @@ Then those packages are usable directly:
6262
`xeus-python` provides a way to install packages with pip.
6363

6464
There are a couple of limitations that you should be aware of:
65+
6566
- it can **only** install **pure Python packages** (Python code + data files)
6667
- it **does not install the package dependencies**, you should make sure to install them yourself using conda-forge/emscripten-forge.
6768
- it does not work (yet?) using `-r requirements.txt` in your environment file
@@ -78,7 +79,7 @@ dependencies:
7879
- pillow
7980
- ipywidgets
8081
- pip:
81-
- ipycanvas
82+
- ipycanvas
8283
```
8384
8485
You can also install a local Python package, this is very practical if you want to embed
@@ -91,7 +92,7 @@ channels:
9192
- https://repo.mamba.pm/conda-forge
9293
dependencies:
9394
- pip:
94-
- ..
95+
- ..
9596
```
9697
9798
## Advanced Configuration

docs/deploy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## On Github Pages
66

7-
In order to make your own JupyterLite deployment, you can use the [xeus-python-demo repository template](https://github.com/jupyterlite/xeus-python-demo)
7+
In order to make your own JupyterLite deployment, you can use the [xeus-python-demo repository template](https://github.com/jupyterlite/xeus-python-demo)
88
that allows you to easily make a JupyteLite deployment on Github pages with xeus-python as default kernel.
99

1010
This template repository contains an `environment.yml` file where you can specify the packages you need. You can also add Notebooks to the `content` folder.

install.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"packageManager": "python",
3-
"packageName": "jupyterlite_xeus_python",
4-
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlite_xeus_python"
3+
"packageName": "jupyterlite-xeus-python",
4+
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlite-xeus-python"
55
}

jupyterlite_xeus_python/__init__.py

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,16 @@
1-
import sys
2-
import json
3-
from pathlib import Path
4-
5-
from ._version import __version__
6-
7-
HERE = Path(__file__).parent.resolve()
1+
try:
2+
from ._version import __version__
3+
except ImportError:
4+
# Fallback when using the package in dev mode without installing
5+
# in editable mode with pip. It is highly recommended to install
6+
# the package from a stable release or in editable mode: https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs
7+
import warnings
8+
warnings.warn("Importing 'jupyterlite-xeus-python' outside a proper installation.")
9+
__version__ = "dev"
810

911

1012
def _jupyter_labextension_paths():
11-
prefix = sys.prefix
12-
# For when in dev mode
13-
if (
14-
HERE.parent
15-
/ "share"
16-
/ "jupyter"
17-
/ "labextensions"
18-
/ "@jupyterlite"
19-
/ "xeus-python-kernel"
20-
).parent.exists():
21-
prefix = HERE.parent
22-
23-
return [
24-
{
25-
"src": prefix
26-
/ "share"
27-
/ "jupyter"
28-
/ "labextensions"
29-
/ "@jupyterlite"
30-
/ "xeus-python-kernel",
31-
"dest": "@jupyterlite/xeus-python-kernel",
32-
}
33-
]
13+
return [{
14+
"src": "labextension",
15+
"dest": "@jupyterlite/xeus-python-kernel"
16+
}]

jupyterlite_xeus_python/_version.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)