Skip to content

Commit

Permalink
Merge branch 'main' into jlab_frontend_extension
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Nov 12, 2023
2 parents 3612e89 + 865a242 commit ef304e9
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 105 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.

2 changes: 1 addition & 1 deletion docs/advanced-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ You might want to make some cell active only when the notebook is run in Jupyter

## More options

There are a couple more options available - please have a look at the `JupytextConfiguration` class in [config.py](https://github.com/mwouts/jupytext/blob/main/jupytext/config.py).
There are a couple more options available - please have a look at the `JupytextConfiguration` class in [config.py](https://github.com/mwouts/jupytext/blob/main/src/jupytext/config.py).
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
4 changes: 2 additions & 2 deletions docs/formats-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## The `percent` format

The `percent` format is a representation of Jupyter notebooks as scripts, in which all cells are explicitly delimited with a commented double percent sign `# %%`. The `percent` format is currently available for these [languages](https://github.com/mwouts/jupytext/blob/main/jupytext/languages.py).
The `percent` format is a representation of Jupyter notebooks as scripts, in which all cells are explicitly delimited with a commented double percent sign `# %%`. The `percent` format is currently available for these [languages](https://github.com/mwouts/jupytext/blob/main/src/jupytext/languages.py).

The format was introduced by Spyder in 2013, and is now supported by many editors, including
- [Spyder IDE](https://docs.spyder-ide.org/editor.html#defining-code-cells),
Expand Down Expand Up @@ -70,7 +70,7 @@ By default, [Jupyter magics](advanced-options.md#magic-commands) are commented i

## The `light` format

The `light` format was introduced by Jupytext. That format can represent any script in one of these [languages](https://github.com/mwouts/jupytext/blob/main/jupytext/languages.py) as a Jupyter notebook.
The `light` format was introduced by Jupytext. That format can represent any script in one of these [languages](https://github.com/mwouts/jupytext/blob/main/src/jupytext/languages.py) as a Jupyter notebook.

When a script in the `light` format is converted to a notebook, Jupytext code paragraphs are turned into code cells, and comments that are not adjacent to code are converted to Markdown cells. Cell breaks occurs on blank lines outside of functions, classes or multiline comments.

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
5 changes: 4 additions & 1 deletion jupyterlab/packages/jupyterlab-jupytext-extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ 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
```
Expand All @@ -31,6 +32,8 @@ jlpm
jlpm install:extension # Symlink into `{sys.prefix}/share/jupyter/labextensions`
```

(see also the instructions at [developing.md](../../../docs/developing.md) on how to create a Python environment with a recent version of `nodejs`)

Watch the source directory and automatically rebuild the `lib` folder:

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

This file was deleted.

0 comments on commit ef304e9

Please sign in to comment.