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

Set up isort in pre-commit hook + add style check to ensure imports are sorted according to PEP8 #6532

Closed
3 tasks
rdimaio opened this issue Mar 6, 2024 · 1 comment

Comments

@rdimaio
Copy link
Contributor

rdimaio commented Mar 6, 2024

Description

Follow-up item from the Rucio Retreat 2024.

At the moment, we're loosely enforcing the PEP8 recommendation for import sorting - unsorted imports are noticed manually by PR reviewers, and manual reordering is requested to match the standard.

isort is a Python utility that automatically sorts imports, and also provides a GH action to perform a style check for import sorts.

  • add style check as GH action
  • add to contributing guide
  • add isort to pre-commit hook

isort GH action: https://pycqa.github.io/isort/docs/configuration/github_action.html (seems like it can also be done via pylint https://stackoverflow.com/questions/22722976/import-order-coding-standard)

Motivation

From PEP8:

Imports should be grouped in the following order:

    standard library imports
    related third party imports
    local application/library specific imports

You should put a blank line between each group of imports.

Change

No response

@rdimaio
Copy link
Contributor Author

rdimaio commented Mar 18, 2024

Closing in favour of #6538

@rdimaio rdimaio closed this as completed Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant