|
| 1 | +[](https://opensource.org/licenses/MIT) |
| 2 | + |
1 | 3 | # Jupyter Fairly
|
2 | 4 | A jupyterLab extension for the [fairly](https://github.com/ITC-CRIB/fairly) package, and the seamless integration of Jupyter-based research environments and research data repositories.
|
3 | 5 |
|
4 |
| -## Set up Dev Environment |
| 6 | +This extension is composed of a Python package named `jupyter_fairly` |
| 7 | +for the server extension and a NPM package named `jupyter-fairly` |
| 8 | +for the frontend extension. |
| 9 | + |
| 10 | +## Requirements |
| 11 | + |
| 12 | +- JupyterLab >= 3.0 |
| 13 | + |
| 14 | +## Install |
| 15 | + |
| 16 | +To install the extension, execute: |
| 17 | + |
| 18 | +```bash |
| 19 | +pip install jupyter_fairly |
| 20 | +``` |
| 21 | + |
| 22 | +To configure the extension |
5 | 23 |
|
6 |
| -1. Create a conda environment with |
7 |
| - ```shell |
8 |
| - conda create -n jupyterfair --override-channels --strict-channel-priority -c conda-forge -c nodefaults jupyterlab=3 cookiecutter nodejs jupyter-packaging git |
9 |
| - ``` |
10 |
| -2. Clone repository |
11 |
| -3. Activate conda environment |
12 |
| -4. Create a `config.json` and store it in `~/.fairly`. |
13 |
| -5. Copy the example below to `config.json`. You must add the tokens for your repository accounts |
| 24 | +1. Create a `config.json` and store it in `~/.fairly`. |
| 25 | +2. Copy the example below to `config.json`. You must add the tokens for your repository accounts |
| 26 | + |
14 | 27 | ```json
|
15 | 28 | {
|
16 | 29 | "fairly": {
|
|
26 | 39 | }
|
27 | 40 | }
|
28 | 41 | ```
|
29 |
| -6. Go to `jupyter_fairly` directory, and install, activate and build extension |
30 |
| - ```shell |
31 |
| - # Link your development version of the extension with JupyterLab |
32 |
| - jupyter labextension develop . --overwrite |
33 |
| - # Enable the server extension |
34 |
| - jupyter server extension enable jupyter-fairly |
35 |
| - # Rebuild extension Typescript source after making changes |
36 |
| - jlpm run build |
37 |
| - ``` |
38 |
| -7. On a new terminal, start the JupyterLab |
39 |
| - ```shell |
40 |
| - jupyter lab |
41 |
| - ``` |
42 |
| -8. Open the link in the terminal in a browser. You should see the commands of the extension in the context menu of the side panel. |
43 | 42 |
|
44 |
| -  |
| 43 | +## Uninstall |
| 44 | + |
| 45 | +To remove the extension, execute: |
| 46 | + |
| 47 | +```bash |
| 48 | +pip uninstall jupyter_fairly |
| 49 | +``` |
| 50 | + |
| 51 | +## Troubleshoot |
| 52 | + |
| 53 | +If you are seeing the frontend extension, but it is not working, check |
| 54 | +that the server extension is enabled: |
| 55 | + |
| 56 | +```bash |
| 57 | +jupyter server extension list |
| 58 | +``` |
| 59 | + |
| 60 | +If the server extension is installed and enabled, but you are not seeing |
| 61 | +the frontend extension, check the frontend extension is installed: |
| 62 | + |
| 63 | +```bash |
| 64 | +jupyter labextension list |
| 65 | +``` |
| 66 | + |
| 67 | +## Contributing |
| 68 | + |
| 69 | +### Development install |
| 70 | + |
| 71 | +Note: You will need NodeJS to build the extension package. |
| 72 | + |
| 73 | +The `jlpm` command is JupyterLab's pinned version of |
| 74 | +[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use |
| 75 | +`yarn` or `npm` in lieu of `jlpm` below. |
| 76 | + |
| 77 | +```bash |
| 78 | +# Clone the repo to your local environment |
| 79 | +# Change directory to the jupyter_fairly directory |
| 80 | +# Install package in development mode |
| 81 | +pip install -e ".[test]" |
| 82 | +# Link your development version of the extension with JupyterLab |
| 83 | +jupyter labextension develop . --overwrite |
| 84 | +# Server extension must be manually installed in develop mode |
| 85 | +jupyter server extension enable jupyter_fairly |
| 86 | +# Rebuild extension Typescript source after making changes |
| 87 | +jlpm build |
| 88 | +``` |
| 89 | + |
| 90 | +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. |
| 91 | + |
| 92 | +```bash |
| 93 | +# Watch the source directory in one terminal, automatically rebuilding when needed |
| 94 | +jlpm watch |
| 95 | +# Run JupyterLab in another terminal |
| 96 | +jupyter lab |
| 97 | +``` |
| 98 | + |
| 99 | +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). |
| 100 | + |
| 101 | +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: |
| 102 | + |
| 103 | +```bash |
| 104 | +jupyter lab build --minimize=False |
| 105 | +``` |
| 106 | + |
| 107 | +### Development uninstall |
| 108 | + |
| 109 | +```bash |
| 110 | +# Server extension must be manually disabled in develop mode |
| 111 | +jupyter server extension disable jupyter_fairly |
| 112 | +pip uninstall jupyter_fairly |
| 113 | +``` |
| 114 | + |
| 115 | +In development mode, you will also need to remove the symlink created by `jupyter labextension develop` |
| 116 | +command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions` |
| 117 | +folder is located. Then you can remove the symlink named `jupyter-fairly` within that folder. |
| 118 | + |
| 119 | +### Testing the extension |
| 120 | + |
| 121 | +#### Server tests |
| 122 | + |
| 123 | +This extension is using [Pytest](https://docs.pytest.org/) for Python code testing. |
| 124 | + |
| 125 | +Install test dependencies (needed only once): |
| 126 | + |
| 127 | +```sh |
| 128 | +pip install -e ".[test]" |
| 129 | +# Each time you install the Python package, you need to restore the front-end extension link |
| 130 | +jupyter labextension develop . --overwrite |
| 131 | +``` |
| 132 | + |
| 133 | +To execute them, run: |
| 134 | + |
| 135 | +```sh |
| 136 | +pytest -vv -r ap --cov jupyter_fairly |
| 137 | +``` |
| 138 | + |
| 139 | +#### Frontend tests |
| 140 | + |
| 141 | +This extension is using [Jest](https://jestjs.io/) for JavaScript code testing. |
| 142 | + |
| 143 | +To execute them, execute: |
| 144 | + |
| 145 | +```sh |
| 146 | +jlpm |
| 147 | +jlpm test |
| 148 | +``` |
| 149 | + |
| 150 | +#### Integration tests |
| 151 | + |
| 152 | +This extension uses [Playwright](https://playwright.dev/docs/intro/) for the integration tests (aka user level tests). |
| 153 | +More precisely, the JupyterLab helper [Galata](https://github.com/jupyterlab/jupyterlab/tree/master/galata) is used to handle testing the extension in JupyterLab. |
| 154 | + |
| 155 | +More information are provided within the [ui-tests](./ui-tests/README.md) README. |
| 156 | + |
| 157 | +### Packaging the extension |
| 158 | + |
| 159 | +See [RELEASE](RELEASE.md) |
| 160 | + |
| 161 | + |
| 162 | +## Citation |
| 163 | + |
| 164 | +Please cite this software using as follows: |
| 165 | + |
| 166 | + *Garcia Alvarez, M., Girgin, S., & Urra Llanusa, J., Jupyter-fairly: a JupyterLab extension for the fairly pacakage [Computer software]* |
| 167 | + |
| 168 | + |
| 169 | +## Acknowledgements |
45 | 170 |
|
| 171 | +This research is funded by the [Dutch Research Council (NWO) Open Science Fund](https://www.nwo.nl/en/researchprogrammes/open-science/open-science-fund/), File No. 203.001.114. |
46 | 172 |
|
| 173 | +Project members: |
47 | 174 |
|
48 |
| -> You will need to re-build the extension with `jlpm run build` and re-start **jupyter server** for changes to the soruce code take effect. |
| 175 | +- [Center of Expertise in Big Geodata Science, University of Twente, Faculty ITC](https://itc.nl/big-geodata/) |
| 176 | +- [Digital Competence Centre, TU Delft](https://dcc.tudelft.nl/) |
| 177 | +- [4TU.ResearchData](https://data.4tu.nl/) |
0 commit comments