Skip to content
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

isort on the test code #3106

Closed
wants to merge 1 commit into from
Closed

isort on the test code #3106

wants to merge 1 commit into from

Conversation

yadudoc
Copy link
Member

@yadudoc yadudoc commented Feb 23, 2024

Description

isort should only resort import statements and add white spaces to separate different categories of imports.
This PR should not introduce any functional changes. I wanted to get some feedback before sticking isort on the rest of the codebase. If folks like the changes, I'd like to add this to the linter scripts.

Changed Behaviour

No functional changes.

Type of change

Choose which options apply, and delete the ones which do not apply.

  • Code maintenance/cleanup

isort *should* only resort import statement and add white
spaces to separate different categories of imports
@yadudoc yadudoc requested a review from benclifford February 23, 2024 20:55
@benclifford
Copy link
Collaborator

seems fine though i didn't examine the giant diff in great detail. it would be good to run with --check-only alongside flake8, mypy so that linting-edit-wars don't arise.

@yadudoc
Copy link
Member Author

yadudoc commented Feb 23, 2024

I checked with flake8 and there are no conflicts there. All tests are passing as well.

Copy link
Collaborator

@khk-globus khk-globus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm personally in favor of this. It may not be to everyone's precise liking, but it is canonical and removes the human factor of "but my way is better than your way."

In terms of making it not conflict with flake8 and other tools, there is a best-practice ordering for entry into pre-commit (or another linting tool). I'm happy to add that, or @yadudoc it's all you. Either way, I'm definitely, definitely in favor of adding at least flake8, pyupgrade, isort, and black into a pre-commit hook.

Copy link
Collaborator

@benclifford benclifford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please introduce CI enforcement of this if you're intending to change the house style: this is going to diverge from sortedness within a few commits otherwise

@yadudoc
Copy link
Member Author

yadudoc commented Feb 25, 2024

Fair enough. It sounds like we are agreed that this is a good idea, so here's what I'll do:

  1. Replace this PR which only has isort on test code
  2. Redo PR with isort on the complete code-base
  3. Add isort to pre-commit
  4. Add isort to linter checks

@benclifford
Copy link
Collaborator

Redo PR with isort on the complete code-base

slightly cynically I have some interest in what kind of import-race-conditions this uncovers...

@yadudoc yadudoc marked this pull request as draft February 26, 2024 19:38
@Andrew-S-Rosen
Copy link
Contributor

Andrew-S-Rosen commented Mar 1, 2024

If you're adding black and isort, is there any reason to not just use ruff format? They have their own pre-commit package.

@benclifford
Copy link
Collaborator

benclifford commented Mar 6, 2024

given the current burst of new user/across codebase activity from Outreachy, I think don't do such a code-disrupting change as this for a few more weeks... it will break many people with outstanding changes vs master

@benclifford benclifford mentioned this pull request May 8, 2024
@benclifford
Copy link
Collaborator

superseded by #3421

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants