Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't build the JupyterLab extension by default #1233

Merged
merged 2 commits into from
May 5, 2024
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 .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_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
python_version: "3.x"

- name: Build package
run: hatch build
run: HATCH_BUILD_HOOKS_ENABLE=true hatch build

- name: Archive build artifacts
uses: actions/upload-artifact@v3
Expand Down
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 .github/workflows/step_tests-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
environment-file: .ci/environment-ci.yml

- name: Install from source
run: python -m pip install -e '.[test-external,test-cov]'
run: HATCH_BUILD_HOOKS_ENABLE=true python -m pip install -e '.[test-external,test-cov]'

- name: Conda list
run: conda list
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/step_tests-pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:

- name: Install from source
run: >
python -m pip install
HATCH_BUILD_HOOKS_ENABLE=true python -m pip install
-e '.[test-cov,test-external]'
jupyterlab
${{ format('markdown-it-py{0}', matrix.markdown-it-py) }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/step_tests-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
python_version: 3.x

- name: Install from source
run: python -m pip install -e '.[test-ui]'
run: HATCH_BUILD_HOOKS_ENABLE=true python -m pip install -e '.[test-ui]'

- name: Install galata
working-directory: jupyterlab/packages/jupyterlab-jupytext-extension/ui-tests
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Jupytext ChangeLog
- Added support for Xonsh notebooks ([#1213](https://github.com/mwouts/jupytext/pull/1213)) - thanks to [Jeffrey Odongo](https://github.com/jsquaredosquared) for this contribution

**Changed**
- By default, the JupyterLab extension for Jupytext is not included in the build (set `HATCH_BUILD_HOOKS_ENABLE=true` to include it). This simplifies the installation of Jupytext in pre-commit hooks ([#1210](https://github.com/mwouts/jupytext/issues/1210))
- Temporary text notebooks for the `--pipe` or `--check` commands are now created in the notebook directory ([#1206](https://github.com/mwouts/jupytext/issues/1206))
- Jupytext uses the standard library `tomllib` in Python 3.11, or `tomli` in Python 3.10 or older, to match JupyterLab's dependencies ([#1195](https://github.com/mwouts/jupytext/issues/1195))

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
Loading