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

maint(precommit): Apply isort #3195

Merged
merged 7 commits into from
Aug 13, 2021
Merged

Conversation

Skylion007
Copy link
Collaborator

Description

  • Applies the isort formatter to the repo and enables the pre-commit hook for it. It is a simple formatter which is compatible with black and ensure that all imports in the repo occur in a standard (alphabetical) order unless otherwise indicated. It also otherwise can format the imports and ensure standard, third party, and first party libraries all go in their standard order. The ordering is automatically applied and enforced with a pre-commit hook.

Suggested changelog entry:

* Format pybind11 with isort consistent ordering of imports
* Enable isort pre-commit hook

@Skylion007 Skylion007 changed the title Apply isort maint(precommit): Apply isort Aug 12, 2021
Copy link
Collaborator

@rwgk rwgk left a comment

Choose a reason for hiding this comment

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

Cool!

@henryiii
Copy link
Collaborator

I'm obviously a fan. :)

@@ -15,6 +15,10 @@ ignore = [
"noxfile.py",
]

[tool.isort]
known_first_party = "env,pybind11_cross_module_tests,pybind11_tests,"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Normally, these are autodetected, but it's a bit trickier in this project since the compiled modules don't live in the root, so we have to include any top level modules it might have missed (in tests)

pyproject.toml Outdated Show resolved Hide resolved
Copy link
Collaborator

@henryiii henryiii left a comment

Choose a reason for hiding this comment

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

Sorry about the confusion, multi_line_output is part of "black".

@Skylion007 Skylion007 merged commit 9df2f1f into pybind:master Aug 13, 2021
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Aug 13, 2021
@henryiii henryiii removed the needs changelog Possibly needs a changelog entry label Sep 16, 2021
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.

3 participants