-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
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
precommit: isort #5493
precommit: isort #5493
Conversation
for more information, see https://pre-commit.ci
@Borda awesome, I didn't know about isort! I looked at the results. Could we configure isort to create the default behavior shown on their README? Current PR is turning all multi-line imports into one-per-line, but README shows from file import (p1,p2,p3 etc.) utilizing full line width. Current behavior (this PR)Desired behavior (https://github.com/PyCQA/isort README) |
@@ -43,3 +43,11 @@ ignore = | |||
F403 | |||
E302 | |||
F541 | |||
|
|||
|
|||
[isort] |
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.
@glenn-jocher here is the configuration :]
feel free to edit it how you wish and let the bot update the PR
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.
@Borda awesome!! Thanks I'll experiment with it.
@Borda PR is merged. I reverted most of the isort settings back to default values except for line length 120. Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐ |
* precommit: isort * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update isort config * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update name Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Glenn Jocher <[email protected]>
use Isort as default import formatting
Partial alternative to #4983
This PR defines Isort as pre-commit hook and lets the bot fix it... rabbit
🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
This PR brings codebase improvements mainly by enlisting third-party tools for code clean-up and organizing imports.
📊 Key Changes
isort
tool in.pre-commit-config.yaml
to automatically sort the imports.detect.py
,export.py
,hubconf.py
, and others to be more organized and readable based on theisort
standard.isort
configuration insetup.cfg
, specifying a line length of 120 characters and a single-line output for multiple imports.🎯 Purpose & Impact
isort
🔄 ensures that the imports are consistently formatted, which makes the code easier to read and maintain.