mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 10:22:24 +00:00
Add Jupyter integration to the docs (#5403)
## Summary Add Jupyter integration to the docs, specifically the Configuration and FAQ sections. ## Test Plan `mkdocs serve` and check that the new sections are visible and functional. fixes: #5396
This commit is contained in:
parent
2c99b268c6
commit
d19324df69
2 changed files with 35 additions and 1 deletions
|
@ -328,6 +328,24 @@ By default, Ruff will also skip any files that are omitted via `.ignore`, `.giti
|
|||
Files that are passed to `ruff` directly are always linted, regardless of the above criteria.
|
||||
For example, `ruff check /path/to/excluded/file.py` will always lint `file.py`.
|
||||
|
||||
## Jupyter Notebook discovery
|
||||
|
||||
Ruff has built-in experimental support for linting [Jupyter Notebooks](https://jupyter.org/).
|
||||
|
||||
To opt in to linting Jupyter Notebook (`.ipynb`) files, add the `*.ipynb` pattern to your
|
||||
[`include`](settings.md#include) setting, like so:
|
||||
|
||||
```toml
|
||||
[tool.ruff]
|
||||
include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
|
||||
```
|
||||
|
||||
This will prompt Ruff to discover Jupyter Notebook (`.ipynb`) files in any specified
|
||||
directories, and lint them accordingly.
|
||||
|
||||
Alternatively, pass the notebook file(s) to `ruff` on the command-line directly. For example,
|
||||
`ruff check /path/to/notebook.ipynb` will always lint `notebook.ipynb`.
|
||||
|
||||
## Rule selection
|
||||
|
||||
The set of enabled rules is controlled via the [`select`](settings.md#select) and
|
||||
|
|
18
docs/faq.md
18
docs/faq.md
|
@ -309,7 +309,23 @@ src = ["../src", "../test"]
|
|||
|
||||
## Does Ruff support Jupyter Notebooks?
|
||||
|
||||
Ruff is integrated into [nbQA](https://github.com/nbQA-dev/nbQA), a tool for running linters and
|
||||
Ruff has built-in experimental support for linting [Jupyter Notebooks](https://jupyter.org/).
|
||||
|
||||
To opt in to linting Jupyter Notebook (`.ipynb`) files, add the `*.ipynb` pattern to your
|
||||
[`include`](settings.md#include) setting, like so:
|
||||
|
||||
```toml
|
||||
[tool.ruff]
|
||||
include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
|
||||
```
|
||||
|
||||
This will prompt Ruff to discover Jupyter Notebook (`.ipynb`) files in any specified
|
||||
directories, and lint them accordingly.
|
||||
|
||||
Alternatively, pass the notebook file(s) to `ruff` on the command-line directly. For example,
|
||||
`ruff check /path/to/notebook.ipynb` will always lint `notebook.ipynb`.
|
||||
|
||||
Ruff also integrates with [nbQA](https://github.com/nbQA-dev/nbQA), a tool for running linters and
|
||||
code formatters over Jupyter Notebooks.
|
||||
|
||||
After installing `ruff` and `nbqa`, you can run Ruff over a notebook like so:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue