-
-
Notifications
You must be signed in to change notification settings - Fork 574
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
Migrate to ruff format #3656
Migrate to ruff format #3656
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Should we close #3492? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #3656 +/- ##
========================================
Coverage 99.59% 99.59%
========================================
Files 258 258
Lines 20797 20797
========================================
Hits 20712 20712
Misses 85 85 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @Saransh-cpp! Looks good and it is nice to get this tool working for notebooks. Is there a way to reduce the line length in the configuration just for the notebooks? See this notebook in the PR build for example – it would be great if we can set the line length to, say, 60 for notebooks, while keeping it at 88 or so for Python files. It reduces the amount of side scrolling required when browsing through the code cells for accessibility reasons.
In hindsight, we should have kept #3492 open since the contributor was active for a while and it had been just three weeks since they had not replied. Let's be more patient next time we encounter a delay and wait for at least two months, given that this was not a high priority issue to fix.
|
||
- repo: https://github.com/adamchainz/blacken-docs | ||
rev: "1.16.0" | ||
hooks: | ||
- id: blacken-docs | ||
additional_dependencies: [black==22.12.0] | ||
additional_dependencies: [black==23.*] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recently got to know that ruff
is now capable of formatting code blocks in documentation files (Markdown, reST, etc.) as well, should we consider removing blacken-docs
? Feel free to convert this comment to an issue if yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think ruff can do that yet, see - astral-sh/ruff#8237 and astral-sh/ruff#3792
I went through ruff's config and I don't think they support such flexibility at the moment. |
How about temporarily setting it to 60 and linting the notebooks while ignoring the rest, then setting it back to the default and linting the rest ignoring the notebooks? |
ruff will automatically expand the lines with length = 60 to length = 88 whenever we run it again (that is, in the CI), it goes both ways - shrink as well as expand line lengths |
Ah I didn't know that, I will open up a feature request about this upstream and hope they find it reasonable |
Description
Sorry for creating this huge PR just before the holidays 😬
Fixes #3477
Also addresses #3489
Type of change
Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.
Key checklist:
$ pre-commit run
(or$ nox -s pre-commit
) (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)$ python run-tests.py --all
(or$ nox -s tests
)$ python run-tests.py --doctest
(or$ nox -s doctests
)You can run integration tests, unit tests, and doctests together at once, using
$ python run-tests.py --quick
(or$ nox -s quick
).Further checks: