Skip to content

Commit 1f5c7a4

Browse files
committed
Merge branch 'jupyterlab4' of https://github.com/jcoady/vpython-jupyter into jupyterlab4
2 parents 58f181e + a709905 commit 1f5c7a4

File tree

11 files changed

+291
-204
lines changed

11 files changed

+291
-204
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "labextension/jupyterlab-vpython"]
2+
path = labextension/jupyterlab-vpython
3+
url = https://github.com/jcoady/jupyterlab_vpython.git

labextension/jupyterlab-vpython

Submodule jupyterlab-vpython added at 1f4c433

labextension/vpython/BuildingJlabExtension.txt

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

labextension/vpython/README.md

Lines changed: 68 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,108 @@
1-
# vpython
1+
# jupyterlab_vpython
22

3-
VPython labextension
3+
A VPython extension for JupyterLab
44

5+
## Requirements
56

6-
## Prerequisites
7+
- JupyterLab >= 3.0.0
8+
- VPython >= 7.6.4
79

8-
* JupyterLab ^0.35.0
9-
* VPython Package >=7.4.8 (pip install vpython) or (conda install -c vpython vpython)
10+
## Install
1011

11-
## Installation
12+
To install the extension, execute:
1213

1314
```bash
14-
jupyter labextension install vpython
15+
pip install jupyterlab_vpython
1516
```
1617

17-
## Development
18-
19-
For a development install use the instructions for creating a custom jupyter labextension as a guide:
20-
21-
https://jupyterlab.readthedocs.io/en/stable/developer/extension_tutorial.html#extension-tutorial
22-
23-
Except where the tutorial says: `conda install -c conda-forge jupyterlab=2`, use `jupyterlab=1`
24-
and tailor the instructions for creating a vpython labextension. Also, the tutorial command
25-
`jupyter lab --watch` will fail. Just use `jupyter lab`.
18+
## Uninstall
2619

27-
The original instructions below caused trouble for me (steve, I got various React errors) but this is what worked:
20+
To remove the extension, execute:
2821

29-
1) Create and activate a conda environment, and then install jupyterlab:
30-
31-
conda create -n jupyterlab-ext --override-channels --strict-channel-priority -c conda-forge -c anaconda jupyterlab cookiecutter nodejs git
32-
33-
conda activate jupyterlab-ext
34-
35-
conda install -c conda-forge jupyterlab=1
22+
```bash
23+
pip uninstall jupyterlab_vpython
24+
```
3625

37-
2) git clone the repository (the branch from the pull request) somewhere using whatever git machinery you prefer.
26+
## Development
3827

39-
Then “cd” into the ‘vpython-jupyter/labextension/vpython’ of that repository.
28+
For a development install use the instructions for creating a custom jupyter labextension as a guide:
4029

41-
3) In the ‘vpython-jupyter/labextension/vpython’ directory of that repository execute:
30+
https://jupyterlab.readthedocs.io/en/latest/extension/extension_tutorial.html
4231

43-
cp -r ../../vpython/vpython_{libraries,data} .
32+
Follow the steps in the tutorial
4433

45-
yarn install
34+
Step 1:
4635

47-
jupyter labextension install .
36+
```bash
37+
conda create -n jupyterlab-ext --override-channels --strict-channel-priority -c conda-forge -c nodefaults jupyterlab=4 nodejs=18 git copier=7 jinja2-time
38+
```
4839

49-
4) Install vpyton in this virtual environment:
40+
Step 2:
5041

51-
cd ../..
42+
```bash
43+
conda activate jupyterlab-ext
44+
```
5245

53-
pip install -e .
54-
55-
And then to run a lab notebook:
46+
Step 3: Get the jupyterlab_vpython repository
5647

57-
jupyter lab
48+
```bash
49+
git clone https://github.com/jcoady/jupyterlab_vpython.git
50+
```
5851

59-
Then you should be able to import vpython now and run notebooks in jupyterlab.
52+
Step 4:
6053

61-
Original instructions:
54+
```bash
55+
cd jupyterlab_vpython
56+
```
6257

58+
Step 5:
6359
```bash
6460
jlpm install
6561
jlpm add @jupyterlab/application
6662
jlpm add @jupyterlab/apputils
6763
jlpm add @jupyterlab/coreutils
6864
jlpm add @jupyterlab/docregistry
6965
jlpm add @jupyterlab/notebook
70-
jlpm add @phosphor/disposable
66+
jlpm add @lumino/disposable
67+
jlpm add file-loader
68+
jlpm add plotly.js-dist-min
7169
jlpm add script-loader
7270

7371
cp -r ../../vpython/vpython_{libraries,data} .
7472
jlpm run build
75-
jupyter labextension install .
7673
```
7774

78-
To rebuild the package and the JupyterLab app:
75+
Step 6: install the extension into the JupyterLab environment.
7976

8077
```bash
81-
jlpm run build
82-
jupyter lab build
78+
pip install -ve .
79+
```
80+
81+
Step 7: After the install completes, open a second terminal.
82+
Run these commands to activate the jupyterlab-ext environment
83+
and start JupyterLab in your default web browser.
84+
85+
```bash
86+
conda activate jupyterlab-ext
87+
jupyter lab
88+
```
89+
90+
Step 8: Packaging the extension.
91+
92+
Before generating a package, we first need to install build.
93+
94+
```bash
95+
pip install build
96+
```
97+
98+
To create a Python source package (.tar.gz) in the dist/ directory, do:
99+
100+
```bash
101+
python -m build -s
102+
```
103+
104+
To create a Python wheel package (.whl) in the dist/ directory, do:
105+
106+
```bash
107+
python -m build
83108
```

0 commit comments

Comments
 (0)