diff --git a/.github/workflows/comment-pr.yml b/.github/workflows/comment-pr.yml index 267dcbb7..0500f369 100644 --- a/.github/workflows/comment-pr.yml +++ b/.github/workflows/comment-pr.yml @@ -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 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0a65697f..453bb109 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 diff --git a/.github/workflows/step_coverage.yml b/.github/workflows/step_coverage.yml index 8220545d..2a23c6e6 100644 --- a/.github/workflows/step_coverage.yml +++ b/.github/workflows/step_coverage.yml @@ -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 diff --git a/binder/postBuild b/binder/postBuild index 0efabf83..81c03c8f 100644 --- a/binder/postBuild +++ b/binder/postBuild @@ -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 diff --git a/docs/developing.md b/docs/developing.md index 05e3e2ce..68b9dada 100644 --- a/docs/developing.md +++ b/docs/developing.md @@ -4,7 +4,7 @@ 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. @@ -12,12 +12,11 @@ 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. @@ -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. diff --git a/pyproject.toml b/pyproject.toml index e6bd196d..fa624cff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 = [