|
| 1 | +Development |
| 2 | +=========== |
| 3 | + |
| 4 | +Install |
| 5 | +------- |
| 6 | + |
| 7 | +**Requirements** |
| 8 | + |
| 9 | +* JupyterLab \>= 4.0 |
| 10 | + |
| 11 | +The ``jlpm`` command is JupyterLab's pinned version of |
| 12 | +`yarn <https://yarnpkg.com/>`_ that is installed with JupyterLab. You may use |
| 13 | +``yarn`` or ``npm`` in lieu of ``jlpm`` below. |
| 14 | + |
| 15 | +1. Copy the repo to your local environment |
| 16 | + |
| 17 | + .. code-block:: bash |
| 18 | +
|
| 19 | + git clone git@github.com:jupyter-robotics/jupyterlab-urdf.git |
| 20 | + cd jupyterlab-urdf |
| 21 | +
|
| 22 | +2. Install package in editable mode |
| 23 | + |
| 24 | + .. code-block:: bash |
| 25 | +
|
| 26 | + pip install -e . |
| 27 | +
|
| 28 | +3. Link your development version of the extension with JupyterLab |
| 29 | + |
| 30 | + .. code-block:: bash |
| 31 | +
|
| 32 | + jupyter labextension develop . --overwrite |
| 33 | +
|
| 34 | +4. Rebuild extension Typescript source after making changes |
| 35 | + |
| 36 | + .. code-block:: bash |
| 37 | +
|
| 38 | + jlpm build |
| 39 | +
|
| 40 | +5. Launch JupyterLab for testing the extension |
| 41 | + |
| 42 | + .. code-block:: bash |
| 43 | +
|
| 44 | + jupyter lab |
| 45 | +
|
| 46 | +
|
| 47 | +.. note:: |
| 48 | + **Troubleshooting** |
| 49 | + |
| 50 | + If you encounter the following error, install ``yarn=1.21`` |
| 51 | + |
| 52 | + .. highlight:: none |
| 53 | + .. code-block:: |
| 54 | +
|
| 55 | + note: This error originates from a subprocess, and is likely not a problem with pip. |
| 56 | + error: metadata-generation-failed |
| 57 | +
|
| 58 | + \× Encountered error while generating package metadata. |
| 59 | +
|
| 60 | +
|
| 61 | +You can watch the source directory and run JupyterLab at the same time in |
| 62 | +different terminals to watch for changes in the extension's source and |
| 63 | +automatically rebuild the extension. |
| 64 | + |
| 65 | +.. code-block:: bash |
| 66 | +
|
| 67 | + # Terminal 1 |
| 68 | + jlpm watch |
| 69 | +
|
| 70 | +.. code-block:: bash |
| 71 | +
|
| 72 | + # Terminal 2 |
| 73 | + jupyter lab |
| 74 | +
|
| 75 | +With the watch command running, every saved change will immediately be built |
| 76 | +locally and available in your running JupyterLab. Refresh JupyterLab to load |
| 77 | +the change in your browser (you may need to wait several seconds for the |
| 78 | +extension to be rebuilt). |
| 79 | + |
| 80 | +By default, the ``jlpm build`` command generates the source maps for this |
| 81 | +extension to make it easier to debug using the browser dev tools. To also |
| 82 | +generate source maps for the JupyterLab core extensions, you can run the |
| 83 | +following command: |
| 84 | + |
| 85 | +.. code-block:: bash |
| 86 | +
|
| 87 | + jupyter lab build --minimize=False |
| 88 | +
|
| 89 | +
|
| 90 | +Uninstall |
| 91 | +--------- |
| 92 | + |
| 93 | +.. code-block:: bash |
| 94 | +
|
| 95 | + pip uninstall jupyterlab_urdf |
| 96 | +
|
| 97 | +In development mode, you will also need to remove the symlink created by |
| 98 | +``jupyter labextension develop`` command. To find its location, you can run |
| 99 | +``jupyter labextension list`` to figure out where the ``labextensions`` |
| 100 | +folder is located. Then you can remove the symlink named ``jupyterlab_urdf`` |
| 101 | +within that folder. |
0 commit comments