mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 12:55:05 +00:00
Experimental release for Jupyter notebook integration (#5363)
## Summary Experimental release for Jupyter Notebook integration. Currently, this requires a user to explicitly opt-in using the [include](https://beta.ruff.rs/docs/settings/#include) configuration: ```toml [tool.ruff] include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"] ``` Or, a user can pass in the file directly: ```sh ruff check path/to/notebook.ipynb ``` For known limitations, please refer #5188 ## Test Plan Following command should work without the `--all-features` flag: ```sh cargo dev round-trip /path/to/notebook.ipynb ``` Following command should work with the above config file along with `select = ["ALL"]`: ```sh cargo run --bin ruff -- check --no-cache --config=../test-repos/openai-cookbook/pyproject.toml --fix ../test-repos/openai-cookbook/ ``` Passing the Jupyter notebook directly: ```sh cargo run --bin ruff -- check --no-cache --isolated --select=ALL --fix ../test-repos/openai-cookbook/examples/Classification_using_embeddings.ipynb ```
This commit is contained in:
parent
fa1b85b3da
commit
2fc38d81e6
8 changed files with 21 additions and 29 deletions
|
@ -14,7 +14,7 @@ use rustc_hash::FxHashMap;
|
|||
use similar::TextDiff;
|
||||
|
||||
use ruff::fs;
|
||||
use ruff::jupyter::{is_jupyter_notebook, Notebook};
|
||||
use ruff::jupyter::Notebook;
|
||||
use ruff::linter::{lint_fix, lint_only, FixTable, FixerResult, LinterResult};
|
||||
use ruff::logging::DisplayParseError;
|
||||
use ruff::message::Message;
|
||||
|
@ -23,7 +23,7 @@ use ruff::settings::{flags, AllSettings, Settings};
|
|||
use ruff::source_kind::SourceKind;
|
||||
use ruff_python_ast::imports::ImportMap;
|
||||
use ruff_python_ast::source_code::{LineIndex, SourceCode, SourceFileBuilder};
|
||||
use ruff_python_stdlib::path::is_project_toml;
|
||||
use ruff_python_stdlib::path::{is_jupyter_notebook, is_project_toml};
|
||||
|
||||
use crate::cache::Cache;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue