From 7d555985b3fe3b6e8d281d217c22d744ba160488 Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Thu, 9 Nov 2023 00:12:07 +0000 Subject: [PATCH 1/7] pre-commit autoupdate --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d26ef1e74..a4bae334a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,7 +18,7 @@ exclude: > repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-json - id: check-yaml @@ -26,19 +26,19 @@ repos: - id: trailing-whitespace - repo: https://github.com/asottile/pyupgrade - rev: v3.9.0 + rev: v3.15.0 hooks: - id: pyupgrade args: ["--py38-plus"] - repo: https://github.com/myint/autoflake - rev: v2.2.0 + rev: v2.2.1 hooks: - id: autoflake args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable'] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.0 + rev: v0.1.5 hooks: - id: ruff args: ["--fix", "--show-fixes"] @@ -52,6 +52,6 @@ repos: args: ["--profile", "black"] - repo: https://github.com/psf/black - rev: 23.7.0 + rev: 23.11.0 hooks: - id: black From ca0a1e7bf9171ac3e98f92f5aec5458d27522052 Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Thu, 9 Nov 2023 00:14:59 +0000 Subject: [PATCH 2/7] Update the conda environments --- .ci/environment-ci.yml | 6 +++--- environment.yml | 18 +++++------------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/.ci/environment-ci.yml b/.ci/environment-ci.yml index db74a0316..0d2a6f5c7 100644 --- a/.ci/environment-ci.yml +++ b/.ci/environment-ci.yml @@ -15,7 +15,7 @@ dependencies: - nbformat>=5.1.2 - pyyaml - toml - - markdown-it-py~=1.0 + - markdown-it-py - mdit-py-plugins - pip - pytest @@ -25,8 +25,8 @@ dependencies: - flake8 - autopep8 - black - - isort>=5.3.0 - - pandoc==2.16.2 + - isort + - pandoc>=3.0 - sphinx-gallery<0.8 - pre-commit - gitpython diff --git a/environment.yml b/environment.yml index d1c389df8..771418eab 100644 --- a/environment.yml +++ b/environment.yml @@ -12,7 +12,6 @@ dependencies: - mdit-py-plugins - nbconvert - ipykernel - - jupyter_contrib_nbextensions - pytest - pytest-xdist - pytest-randomly @@ -20,17 +19,10 @@ dependencies: - pre-commit - gitpython - pylint - - flake8==3.9.1 - - black==21.4b2 - - isort==5.8.0 + - flake8 + - black==23.11.0 + - isort==5.12.0 - autopep8 - sphinx-gallery<0.8 - - pip - - setuptools - - twine - - pandoc==2.16.2 - # make html in docs folder - - sphinx - - tox-conda - - pip: - - sphinx_copybutton + - pandoc>=3.0 + - nodejs>=20 From 51a2625d8dcd8be341f067e77b0066c931b199bb Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Thu, 9 Nov 2023 00:31:15 +0000 Subject: [PATCH 3/7] Update the development instructions --- docs/developing.md | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/docs/developing.md b/docs/developing.md index 38f256f5f..66d76298d 100644 --- a/docs/developing.md +++ b/docs/developing.md @@ -22,11 +22,14 @@ Most of Jupytext's code is written in Python. To develop the Python part of Jupy ``` conda env create --file environment.yml # or conda env update --file ... conda activate jupytext-dev -python -m ipykernel install --name jupytext-dev --user -pip install -e . ``` -We use the [pre-commit](https://pre-commit.com) package to run pre-commit scripts like `black` and `flake8` on the code. +Install the `jupytext` package in development mode with +``` +pip install '.[dev]' +``` + +We use the [pre-commit](https://pre-commit.com) package to run pre-commit scripts like `black` and `ruff` on the code. Install it with ``` pre-commit install @@ -37,19 +40,19 @@ Tests are executed with `pytest`. You can run them in parallel with for instance pytest -n 5 ``` -Build the `jupytext` package and install it with +Some tests require a Jupyter kernel pointing to the current environment: ``` -pip install -U build wheel -python -m build -pip install dist/jupytext-x.x.x-py3-none-any.whl +python -m ipykernel install --name jupytext-dev --user ``` -or with +Finally, you can build the package and install it with ``` -pip install . +pip install -U build wheel +python -m build +pip install dist/jupytext-x.x.x-py3-none-any.whl ``` -Finally, note that you can use `HATCH_BUILD_HOOKS_ENABLE=false` if you don't need the lab extension - the build time will be slightly shorter. +Note that you can use `HATCH_BUILD_HOOKS_ENABLE=false` if you don't need the lab extension - the build time will be slightly shorter. ## Jupytext's extension for JupyterLab From af66065b464d6712bfdc92fc7a6821d24464b4f4 Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Thu, 9 Nov 2023 00:31:22 +0000 Subject: [PATCH 4/7] Remove unused files --- .lgtm.yml | 4 ---- Makefile | 19 ------------------- make.bat | 35 ----------------------------------- 3 files changed, 58 deletions(-) delete mode 100644 .lgtm.yml delete mode 100644 Makefile delete mode 100644 make.bat diff --git a/.lgtm.yml b/.lgtm.yml deleted file mode 100644 index e741b2ed7..000000000 --- a/.lgtm.yml +++ /dev/null @@ -1,4 +0,0 @@ -extraction: - python: - index: - exclude: demo diff --git a/Makefile b/Makefile deleted file mode 100644 index e837d6813..000000000 --- a/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -SOURCEDIR = . -BUILDDIR = .build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/make.bat b/make.bat deleted file mode 100644 index 08745c27c..000000000 --- a/make.bat +++ /dev/null @@ -1,35 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=. -set BUILDDIR=.build - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% - -:end -popd From f5d5fe51f887ffba28e74a32d1107b6776399461 Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Thu, 9 Nov 2023 20:47:56 +0000 Subject: [PATCH 5/7] Revert the change on the version of pandoc --- .ci/environment-ci.yml | 2 +- environment.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/environment-ci.yml b/.ci/environment-ci.yml index 0d2a6f5c7..5243e0b6b 100644 --- a/.ci/environment-ci.yml +++ b/.ci/environment-ci.yml @@ -26,7 +26,7 @@ dependencies: - autopep8 - black - isort - - pandoc>=3.0 + - pandoc==2.16.2 - sphinx-gallery<0.8 - pre-commit - gitpython diff --git a/environment.yml b/environment.yml index 771418eab..87959902c 100644 --- a/environment.yml +++ b/environment.yml @@ -24,5 +24,5 @@ dependencies: - isort==5.12.0 - autopep8 - sphinx-gallery<0.8 - - pandoc>=3.0 + - pandoc==2.16.2 - nodejs>=20 From 7cab8d185ad1b626042fcb513091911c38ebc4fc Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Thu, 9 Nov 2023 20:56:24 +0000 Subject: [PATCH 6/7] Remove autoflake8, run isort/black/ruff in that order --- .pre-commit-config.yaml | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a4bae334a..e66eccbfe 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,18 +31,6 @@ repos: - id: pyupgrade args: ["--py38-plus"] - - repo: https://github.com/myint/autoflake - rev: v2.2.1 - hooks: - - id: autoflake - args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable'] - - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.5 - hooks: - - id: ruff - args: ["--fix", "--show-fixes"] - - repo: https://github.com/PyCQA/isort rev: 5.12.0 hooks: @@ -55,3 +43,9 @@ repos: rev: 23.11.0 hooks: - id: black + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.5 + hooks: + - id: ruff + args: ["--fix", "--show-fixes"] From cd2f9aa8d2991b5ef21098a9d74046d361ab5af1 Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Thu, 9 Nov 2023 20:56:37 +0000 Subject: [PATCH 7/7] Update the development instructions --- docs/developing.md | 11 +---------- .../jupyterlab-jupytext-extension/README.md | 15 +++++++-------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/docs/developing.md b/docs/developing.md index 66d76298d..5c78aa2a6 100644 --- a/docs/developing.md +++ b/docs/developing.md @@ -26,7 +26,7 @@ conda activate jupytext-dev Install the `jupytext` package in development mode with ``` -pip install '.[dev]' +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. @@ -45,15 +45,6 @@ Some tests require a Jupyter kernel pointing to the current environment: python -m ipykernel install --name jupytext-dev --user ``` -Finally, you can build the package and install it with -``` -pip install -U build wheel -python -m build -pip install dist/jupytext-x.x.x-py3-none-any.whl -``` - -Note that you can use `HATCH_BUILD_HOOKS_ENABLE=false` if you don't need the lab extension - the build time will be slightly shorter. - ## Jupytext's extension for JupyterLab Our extension for JupyterLab adds a series of Jupytext commands to JupyterLab. The code is in `packages/labextension`. See the `README.md` there for instructions on how to develop that extension. diff --git a/jupyterlab/packages/jupyterlab-jupytext-extension/README.md b/jupyterlab/packages/jupyterlab-jupytext-extension/README.md index 7c29efcc2..d36e2d420 100644 --- a/jupyterlab/packages/jupyterlab-jupytext-extension/README.md +++ b/jupyterlab/packages/jupyterlab-jupytext-extension/README.md @@ -13,26 +13,25 @@ Most users do not need to install this extension, since it is already included i Please install [Jupytext](https://github.com/mwouts/jupytext/blob/main/README.md#Install) first. As mentioned above, both the `pip` and `conda` packages do include the latest version of the JupyterLab extension, so in most cases you don't need to specifically install this `npm` package. -In case you're not using JupyterLab 3.x, you will have to install an older version of the extension that is compatible with your version. Please first install `jupytext` using `pip` or `conda`, and then downgrade the extension to a version compatible with your version of Jupyter Lab with: +In case you're not using JupyterLab 4.x, you will have to install an older version of the extension that is compatible with your version. Please first install `jupytext` using `pip` or `conda`, and then downgrade the extension to a version compatible with your version of Jupyter Lab with: ```bash +jupyter labextension install jupyterlab-jupytext@1.3.11 # for JupyterLab 3.x jupyter labextension install jupyterlab-jupytext@1.2.2 # for JupyterLab 2.x jupyter labextension install jupyterlab-jupytext@1.1.1 # for JupyterLab 1.x ``` # How to develop this extension -We assume that you have activated the conda environment described in [CONTRIBUTING.md](https://github.com/mwouts/jupytext/blob/main/CONTRIBUTING.md). - -Then you can rebuild the Jupytext python package (with `python -m build`) and reinstall it (`pip install dist/jupytext-x.x.x-py3-none-any.whl`). - -Alternatively, if you prefer to develop iteratively, you could install a development version of the extension with +Please follow the instructions at [developing.md](../../../docs/developing.md), i.e. +create a Python environment with a recent version of `nodejs`, and install +a development version of Jupytext by running ```bash -jupyter labextension develop . --overwrite +pip install -e '.[dev]' ``` -Read more on this on the [JupyterLab documentation](https://jupyterlab.readthedocs.io/en/latest/extension/extension_dev.html#developing-a-prebuilt-extension). +at the root of the Jupytext repository. # How to publish a new version of the extension on npm