Skip to content

Commit

Permalink
Update the development environment (#1156)
Browse files Browse the repository at this point in the history
* pre-commit autoupdate
* Update the conda environments
* Update the development instructions
* Remove unused files
  • Loading branch information
mwouts authored Nov 11, 2023
1 parent 069425a commit 865a242
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 109 deletions.
4 changes: 2 additions & 2 deletions .ci/environment-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies:
- nbformat>=5.1.2
- pyyaml
- toml
- markdown-it-py~=1.0
- markdown-it-py
- mdit-py-plugins
- pip
- pytest
Expand All @@ -25,7 +25,7 @@ dependencies:
- flake8
- autopep8
- black
- isort>=5.3.0
- isort
- pandoc==2.16.2
- sphinx-gallery<0.8
- pre-commit
Expand Down
4 changes: 0 additions & 4 deletions .lgtm.yml

This file was deleted.

24 changes: 9 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,19 @@ 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
- id: end-of-file-fixer
- 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
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
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
Expand All @@ -52,6 +40,12 @@ repos:
args: ["--profile", "black"]

- repo: https://github.com/psf/black
rev: 23.7.0
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"]
19 changes: 0 additions & 19 deletions Makefile

This file was deleted.

22 changes: 8 additions & 14 deletions docs/developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 -e '.[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
Expand All @@ -37,20 +40,11 @@ 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
```
pip install -U build wheel
python -m build
pip install dist/jupytext-x.x.x-py3-none-any.whl
Some tests require a Jupyter kernel pointing to the current environment:
```

or with
```
pip install .
python -m ipykernel install --name jupytext-dev --user
```

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.

## 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.
Expand Down
16 changes: 4 additions & 12 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,17 @@ dependencies:
- mdit-py-plugins
- nbconvert
- ipykernel
- jupyter_contrib_nbextensions
- pytest
- pytest-xdist
- pytest-randomly
- pytest-cov
- 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
- nodejs>=20
15 changes: 7 additions & 8 deletions jupyterlab/packages/jupyterlab-jupytext-extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected] # for JupyterLab 3.x
jupyter labextension install [email protected] # for JupyterLab 2.x
jupyter labextension install [email protected] # 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

Expand Down
35 changes: 0 additions & 35 deletions make.bat

This file was deleted.

0 comments on commit 865a242

Please sign in to comment.