Skip to content

Commit 0f2dd91

Browse files
committed
Add custom launcher
1 parent 67401e5 commit 0f2dd91

File tree

18 files changed

+850
-20
lines changed

18 files changed

+850
-20
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,9 @@ jobs:
2323
- name: Build the JupyterLite site
2424
run: |
2525
cp README.md content
26+
cd tskit-launcher
27+
jlpm install
28+
jlpm run build
29+
pip install -e .
30+
cd ..
2631
jupyter lite build --contents content --output-dir dist

repl/jupyter-lite.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
"jupyter-lite-schema-version": 0,
33
"jupyter-config-data": {
44
"disabledExtensions": [
5-
"@jupyterlab/drawio-extension",
6-
"jupyterlab-kernel-spy",
7-
"jupyterlab-tour"
5+
// "@jupyterlab/drawio-extension",
6+
// "jupyterlab-kernel-spy",
7+
"@jupyterlab/launcher",
8+
"@jupyterlab/launcher-extension",
9+
"@jupyterlab/launcher-extension:plugin"
10+
"@jupyterlab/application-extension:logo"
811
]
912
}
1013
}

repl/jupyter_lite_config.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"LiteBuildConfig": {
3+
"contents": ["content"],
4+
"output_dir": "dist"
5+
},
6+
"FederatedExtensionAddon": {
7+
"enabled_extensions": ["tskit_custom_jupyter_launcher"]
8+
}
9+
}

requirements.txt

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,13 @@ notebook~=7.4.3
77
# Python kernel (optional)
88
jupyterlite-pyodide-kernel==0.6.1
99

10-
# JavaScript kernel (optional)
11-
jupyterlite-javascript-kernel==0.3.0
12-
13-
# Language support (optional)
14-
jupyterlab-language-pack-fr-FR
15-
jupyterlab-language-pack-zh-CN
16-
17-
# P5 kernel (optional)
18-
jupyterlite-p5-kernel==0.1.0
1910

2011
# JupyterLab: Fasta file renderer (optional)
2112
jupyterlab-fasta>=3.3.0,<4
2213
# JupyterLab: Geojson file renderer (optional)
2314
jupyterlab-geojson>=3.4.0,<4
2415
# JupyterLab: guided tour (optional)
25-
# TODO: re-enable after https://github.com/jupyterlab-contrib/jupyterlab-tour/issues/82
26-
# jupyterlab-tour
16+
jupyterlab-tour
2717
# JupyterLab: dark theme
2818
jupyterlab-night
2919
# JupyterLab: Miami nights theme (optional)
@@ -37,9 +27,3 @@ ipyevents>=2.0.1
3727
ipympl>=0.8.2
3828
# Python: ipycanvas library for Jupyter notebooks (optional)
3929
ipycanvas>=0.9.1
40-
# Python: ipyleaflet library for Jupyter notebooks (optional)
41-
ipyleaflet
42-
43-
# Python: plotting libraries (optional)
44-
plotly>=6,<7
45-
bqplot

tskit-launcher/.gitignore

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
*.bundle.*
2+
lib/
3+
node_modules/
4+
*.log
5+
.eslintcache
6+
.stylelintcache
7+
*.egg-info/
8+
.ipynb_checkpoints
9+
*.tsbuildinfo
10+
tskit_launcher/labextension
11+
# Version file is handled by hatchling
12+
tskit_launcher/_version.py
13+
14+
# Created by https://www.gitignore.io/api/python
15+
# Edit at https://www.gitignore.io/?templates=python
16+
17+
### Python ###
18+
# Byte-compiled / optimized / DLL files
19+
__pycache__/
20+
*.py[cod]
21+
*$py.class
22+
23+
# C extensions
24+
*.so
25+
26+
# Distribution / packaging
27+
.Python
28+
build/
29+
develop-eggs/
30+
dist/
31+
downloads/
32+
eggs/
33+
.eggs/
34+
lib/
35+
lib64/
36+
parts/
37+
sdist/
38+
var/
39+
wheels/
40+
pip-wheel-metadata/
41+
share/python-wheels/
42+
.installed.cfg
43+
*.egg
44+
MANIFEST
45+
46+
# PyInstaller
47+
# Usually these files are written by a python script from a template
48+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
49+
*.manifest
50+
*.spec
51+
52+
# Installer logs
53+
pip-log.txt
54+
pip-delete-this-directory.txt
55+
56+
# Unit test / coverage reports
57+
htmlcov/
58+
.tox/
59+
.nox/
60+
.coverage
61+
.coverage.*
62+
.cache
63+
nosetests.xml
64+
coverage/
65+
coverage.xml
66+
*.cover
67+
.hypothesis/
68+
.pytest_cache/
69+
70+
# Translations
71+
*.mo
72+
*.pot
73+
74+
# Scrapy stuff:
75+
.scrapy
76+
77+
# Sphinx documentation
78+
docs/_build/
79+
80+
# PyBuilder
81+
target/
82+
83+
# pyenv
84+
.python-version
85+
86+
# celery beat schedule file
87+
celerybeat-schedule
88+
89+
# SageMath parsed files
90+
*.sage.py
91+
92+
# Spyder project settings
93+
.spyderproject
94+
.spyproject
95+
96+
# Rope project settings
97+
.ropeproject
98+
99+
# Mr Developer
100+
.mr.developer.cfg
101+
.project
102+
.pydevproject
103+
104+
# mkdocs documentation
105+
/site
106+
107+
# mypy
108+
.mypy_cache/
109+
.dmypy.json
110+
dmypy.json
111+
112+
# Pyre type checker
113+
.pyre/
114+
115+
# End of https://www.gitignore.io/api/python
116+
117+
# OSX files
118+
.DS_Store
119+
120+
# Yarn cache
121+
.yarn/

tskit-launcher/.prettierignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
**/node_modules
3+
**/lib
4+
**/package.json
5+
!/package.json
6+
tskit_launcher

tskit-launcher/.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

tskit-launcher/README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# tskit_launcher
2+
3+
[![Github Actions Status](n/a/workflows/Build/badge.svg)](n/a/actions/workflows/build.yml)
4+
5+
Tskit custom launcher
6+
7+
## Requirements
8+
9+
- JupyterLab >= 4.0.0
10+
11+
## Install
12+
13+
To install the extension, execute:
14+
15+
```bash
16+
pip install tskit_launcher
17+
```
18+
19+
## Uninstall
20+
21+
To remove the extension, execute:
22+
23+
```bash
24+
pip uninstall tskit_launcher
25+
```
26+
27+
## Contributing
28+
29+
### Development install
30+
31+
Note: You will need NodeJS to build the extension package.
32+
33+
The `jlpm` command is JupyterLab's pinned version of
34+
[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
35+
`yarn` or `npm` in lieu of `jlpm` below.
36+
37+
```bash
38+
# Clone the repo to your local environment
39+
# Change directory to the tskit_launcher directory
40+
# Install package in development mode
41+
pip install -e "."
42+
# Link your development version of the extension with JupyterLab
43+
jupyter labextension develop . --overwrite
44+
# Rebuild extension Typescript source after making changes
45+
jlpm build
46+
```
47+
48+
You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.
49+
50+
```bash
51+
# Watch the source directory in one terminal, automatically rebuilding when needed
52+
jlpm watch
53+
# Run JupyterLab in another terminal
54+
jupyter lab
55+
```
56+
57+
With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).
58+
59+
By default, the `jlpm build` command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:
60+
61+
```bash
62+
jupyter lab build --minimize=False
63+
```
64+
65+
### Development uninstall
66+
67+
```bash
68+
pip uninstall tskit_launcher
69+
```
70+
71+
In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
72+
command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
73+
folder is located. Then you can remove the symlink named `tskit_launcher` within that folder.
74+
75+
### Packaging the extension
76+
77+
See [RELEASE](RELEASE.md)

tskit-launcher/install.json

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

0 commit comments

Comments
 (0)