Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ node_modules/
package-lock.json
.yarn-packages/
*.tsbuildinfo

.DS_Store

# Copy pasted entries from:
# https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore
Expand Down
30 changes: 25 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ the README.md file.
### Python package

```bash
# Clone the repo to your local environment
git clone https://github.com/jupyterhub/jupyter-server-proxy.git
# Change directory to the jupyter-server-proxy directory
cd jupyter-server-proxy
# Install package in development mode
pip install -e ".[test]"

# explicit install needed with editable mode (-e) jupyter
jupyter serverextension enable --sys-prefix jupyter_server_proxy
jupyter server extension enable --sys-prefix jupyter_server_proxy
# Link your development version of the extension with JupyterLab (only for JupyterLab 3)
jupyter labextension develop --overwrite .
# Server extension must be manually installed in develop mode
jupyter server extension enable jupyter_server_proxy
```

Before running tests, you need a server that we can test against.
Expand Down Expand Up @@ -79,7 +84,22 @@ and `jupyter_server_proxy/labextension` folders:

```bash
cd labextension
jlpm watch
# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm run watch
# Run JupyterLab in another terminal
jupyter lab
```

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).

By default, the `jlpm run 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:

```bash
jupyter lab build --minimize=False
```

### Documentation
Expand Down
6 changes: 6 additions & 0 deletions jupyter_server_proxy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ def _jupyter_nbextension_paths():
"require": "jupyter_server_proxy/tree"
}]

def _jupyter_labextension_paths():
return [{
"src": "labextension",
"dest": "@jupyterhub/jupyter-server-proxy",
}]


def _load_jupyter_server_extension(nbapp):
# Set up handlers picked up via config
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ npm = ["jlpm"]

[tool.hatch.build.hooks.jupyter-builder.editable-build-kwargs]
path = "labextension"
build_cmd = "install:extension"
build_cmd = "build"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% confident on the change from install:extension to build, but I see this be done also in another project and Jeremy that made the that change is experienced with these matters.


Do you think we should have force = true as well as they have in that project? I think it relates to forcing rebuild of the labextension if it already exists.

https://github.com/jupyterlab/hatch-jupyter-builder/blob/12ef08143544fb954a4e5dfeb54b61f6e2ad084d/hatch_jupyter_builder/utils.py#L106-L109

But, our contributing docs mentions jlpm watch, which seem to trigger build of this also... Overall I'm not at all confident here, but I've seen this to work and the previous to not work at all.

I feel confident this is an incremental improvement, so I'm okay with a merge.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been working on JupyterLab extensions for the past few months and I have noticed that build is used as a standard for editable installs in different extension sources and cookie-cutter examples. But I am happy to get feedback from JupyterLab developers.

I think we can set force = true without any side effect. Yes, jlpm run watch is more convenient way to develop extensions as every change to source code will be compiled in real time.

npm = ["jlpm"]
source_dir = "labextension/src"
build_dir = "jupyter_server_proxy/labextension"
Expand Down