-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removal of semicolon in notebooks #7300
Comments
I think this might be similar to #6586 where it's only the last expression in a cell where this rule should be disabled. We could probably have a general interface internally to include rules which need not be checked for last expressions in all cells within a Jupyter Notebook. Until that is supported, you could disable this rule on Jupyter Notebooks like so: [tool.ruff]
per-file-ignores = { "*.ipynb" = ["E703"] } |
There are several rules that don't apply to notebooks, or apply in a modified form. Ideally |
Agreed. |
We already had to solve this cell-boundaries problem for isort, so should be doable in these cases too. |
Sadly this seems not to be respected by |
(Merging this with a general tracking issue: #8669) |
@s-weigand Hi, we recently updated the formatter to not remove any trailing semicolon in notebook context: #8590. It'll be available in the next release. |
One of the default rules in ruff is to remove a trailing semicolon. That is fine for python scripts, for for jupyter notebook this can change the output of the code cells. A screenshot to illustrate:
The removal of the semicolon results in the output of the
plt.plot
command being displayed. Typically this is not the intention, so a semicolor is used to hide the command output and only the the plotted graph.Can the ruff default settings be modified to remove semicolons for python files, but not for notebooks?
The text was updated successfully, but these errors were encountered: