|
1 | | -# vpython |
| 1 | +# jupyterlab_vpython |
2 | 2 |
|
3 | | -VPython labextension |
| 3 | +A VPython extension for JupyterLab |
4 | 4 |
|
| 5 | +## Requirements |
5 | 6 |
|
6 | | -## Prerequisites |
| 7 | +- JupyterLab >= 3.0.0 |
| 8 | +- VPython >= 7.6.4 |
7 | 9 |
|
8 | | -* JupyterLab ^0.35.0 |
9 | | -* VPython Package >=7.4.8 (pip install vpython) or (conda install -c vpython vpython) |
| 10 | +## Install |
10 | 11 |
|
11 | | -## Installation |
| 12 | +To install the extension, execute: |
12 | 13 |
|
13 | 14 | ```bash |
14 | | -jupyter labextension install vpython |
| 15 | +pip install jupyterlab_vpython |
15 | 16 | ``` |
16 | 17 |
|
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 |
26 | 19 |
|
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: |
28 | 21 |
|
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 | +``` |
36 | 25 |
|
37 | | -2) git clone the repository (the branch from the pull request) somewhere using whatever git machinery you prefer. |
| 26 | +## Development |
38 | 27 |
|
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: |
40 | 29 |
|
41 | | -3) In the ‘vpython-jupyter/labextension/vpython’ directory of that repository execute: |
| 30 | +https://jupyterlab.readthedocs.io/en/latest/extension/extension_tutorial.html |
42 | 31 |
|
43 | | - cp -r ../../vpython/vpython_{libraries,data} . |
| 32 | +Follow the steps in the tutorial |
44 | 33 |
|
45 | | - yarn install |
| 34 | +Step 1: |
46 | 35 |
|
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 | +``` |
48 | 39 |
|
49 | | -4) Install vpyton in this virtual environment: |
| 40 | +Step 2: |
50 | 41 |
|
51 | | - cd ../.. |
| 42 | +```bash |
| 43 | +conda activate jupyterlab-ext |
| 44 | +``` |
52 | 45 |
|
53 | | - pip install -e . |
54 | | - |
55 | | -And then to run a lab notebook: |
| 46 | +Step 3: Get the jupyterlab_vpython repository |
56 | 47 |
|
57 | | - jupyter lab |
| 48 | +```bash |
| 49 | +git clone https://github.com/jcoady/jupyterlab_vpython.git |
| 50 | +``` |
58 | 51 |
|
59 | | -Then you should be able to import vpython now and run notebooks in jupyterlab. |
| 52 | +Step 4: |
60 | 53 |
|
61 | | -Original instructions: |
| 54 | +```bash |
| 55 | +cd jupyterlab_vpython |
| 56 | +``` |
62 | 57 |
|
| 58 | +Step 5: |
63 | 59 | ```bash |
64 | 60 | jlpm install |
65 | 61 | jlpm add @jupyterlab/application |
66 | 62 | jlpm add @jupyterlab/apputils |
67 | 63 | jlpm add @jupyterlab/coreutils |
68 | 64 | jlpm add @jupyterlab/docregistry |
69 | 65 | 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 |
71 | 69 | jlpm add script-loader |
72 | 70 |
|
73 | 71 | cp -r ../../vpython/vpython_{libraries,data} . |
74 | 72 | jlpm run build |
75 | | -jupyter labextension install . |
76 | 73 | ``` |
77 | 74 |
|
78 | | -To rebuild the package and the JupyterLab app: |
| 75 | +Step 6: install the extension into the JupyterLab environment. |
79 | 76 |
|
80 | 77 | ```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 |
83 | 108 | ``` |
0 commit comments