Skip to content

Commit

Permalink
Don't build the JupyterLab extension by default
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed May 5, 2024
1 parent 4552393 commit eb65063
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/comment-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
Also, the version of Jupytext developed in this PR can be installed with `pip`:
```
pip install git+${{ github.event.pull_request.head.repo.clone_url }}@${{ github.event.pull_request.head.ref }}
HATCH_BUILD_HOOKS_ENABLE=true pip install git+${{ github.event.pull_request.head.repo.clone_url }}@${{ github.event.pull_request.head.ref }}
```
(this requires `nodejs`, see more at [Developing Jupytext](https://jupytext.readthedocs.io/en/latest/developing.html))
comment_tag: binder_link
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
- name: Build package
run: |
python -m pip install wheel build
python -m build
HATCH_BUILD_HOOKS_ENABLE=true python -m build
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion .github/workflows/step_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
python_version: 3.x

- name: Install from source
run: HATCH_BUILD_HOOKS_ENABLE=false python -m pip install -e '.[test-cov,test-${{ matrix.coverage }}]'
run: python -m pip install -e '.[test-cov,test-${{ matrix.coverage }}]'

- name: Install a Jupyter Kernel
run: python -m ipykernel install --name python_kernel --user
Expand Down
2 changes: 1 addition & 1 deletion binder/postBuild
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e
# Install from sources
# NB: If you want to use Jupytext on your binder, don't install it from source,
# just add "jupytext" to your "binder/requirements.txt" instead.
pip install .
HATCH_BUILD_HOOKS_ENABLE=true pip install .

mkdir -p ${HOME}/.jupyter/labconfig
cp binder/labconfig/* ${HOME}/.jupyter/labconfig
Expand Down
9 changes: 4 additions & 5 deletions docs/developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@

If you want to test a feature that has been integrated in `main` but not delivered yet to `pip` or `conda`, use
```
pip install git+https://github.com/mwouts/jupytext.git
HATCH_BUILD_HOOKS_ENABLE=true pip install git+https://github.com/mwouts/jupytext.git
```

The above requires `node`. You can install it with e.g.
```
conda install 'nodejs>=20' -c conda-forge
```

Alternatively you can build only Jupytext core (e.g. skip the JupyterLab extension). To do so, prefix the
above with `HATCH_BUILD_HOOKS_ENABLE=false`.
Alternatively you can build only Jupytext core (e.g. skip the JupyterLab extension). To do so, remove `HATCH_BUILD_HOOKS_ENABLE=true` in the above.

Finally, if you want to test a development branch, use
```
pip install git+https://github.com/mwouts/jupytext.git@branch
HATCH_BUILD_HOOKS_ENABLE=true pip install git+https://github.com/mwouts/jupytext.git@branch
```
where `branch` is the name of the branch you want to test.

Expand All @@ -31,7 +30,7 @@ conda activate jupytext-dev

Install the `jupytext` package in development mode with
```
pip install -e '.[dev]'
HATCH_BUILD_HOOKS_ENABLE=true pip install -e '.[dev]'
```

We use the [pre-commit](https://pre-commit.com) package to run pre-commit scripts like `black` and `ruff` on the code.
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ packages = ["src/jupytext", "src/jupytext_config", "jupyterlab/jupyterlab_jupyte
"jupyterlab/jupyterlab_jupytext/labextension" = "share/jupyter/labextensions/jupyterlab-jupytext"

[tool.hatch.build.hooks.jupyter-builder]
# Enable running hook by default.
# We disable this hook only by setting env var HATCH_BUILD_HOOKS_ENABLE=false
# So `HATCH_BUILD_HOOKS_ENABLE=false pip install .` will **not** build JupyterLab related
# extension. A simple `pip install .` will **always** build extension
enable-by-default = true
enable-by-default = false
# We enable this hook by setting env var HATCH_BUILD_HOOKS_ENABLE=true
# So `pip install .` will **not** build JupyterLab related
# extension. To install the extension, it is required to run
# `HATCH_BUILD_HOOKS_ENABLE=true pip install .`
# Runtime dependency for this build hook
# We need jupyterlab as build time depdendency to get jlpm (wrapper around yarn)
dependencies = [
Expand Down

0 comments on commit eb65063

Please sign in to comment.