-
Notifications
You must be signed in to change notification settings - Fork 192
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
add isort workflow #1538
add isort workflow #1538
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
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.
Great stuff, thanks for this! What do you think as adding it as a job to the existing lint-code.yml
file? As it's conceptually similar (checking code quality).
Also I would expect there to be a bunch of code changes required after adding this? 😅
That's true, I will add it to lint-code.yml instead of creating a new file, thanks! |
Yes please, as otherwise tests on the repo will immediately start failing 😁 May as well do it all in one.. Note that the CI test should be failing on this PR but isn't: https://github.com/nf-core/tools/runs/6274840729?check_suite_focus=true Looks like it's changing loads of stuff but then still reporting a ✅ |
Also it looks like |
It would be great to have the isort configuration added to pyproject.toml. I would like to see three things specifically, one is the force single line imports another is to have nf_core set as known first party and the last is profile black for compatibility with black. [tool.isort]
profile = "black"
known_first_party = ["nf_core"]
force_single_line = true |
Co-authored-by: Phil Ewels <phil.ewels@scilifelab.se>
I don't know why the linting is failing after running isort. It's successful for me locally with I also added isort to fix-linting.yml, it works locally with act, but I don't fully trust it. I guess it can't be tested before based on this This should be ready for review once I solve the linting error here :) |
I'm getting more tempted to use precommit... 👀 |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Co-authored-by: Fabian Egli <fabianegli@users.noreply.github.com>
Co-authored-by: Fabian Egli <fabianegli@users.noreply.github.com>
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.
Looking good! Please can you add some docs about how contributors can run this locally before pushing etc?
+1 For documenting how to run isort locally. (I think at some point we might want to provide .pre-commit-hooks for convenience, but I see that as a separate issue from adding isort linting.) I think the docs can just mention running |
I am not sure on the best place to add the documentation. Would you be OK with adding a new section "Contributing" and "Code formatting" to the README? |
You mean like this? 😉 https://github.com/nf-core/tools/blob/master/.github/CONTRIBUTING.md It shows up as a hint when you open issues and PRs but yeah, we should probably move out into the root and mention it in the readme to make it more findable. |
I made a new issue for your proposals and think for this PR the docs can simply be added to .github/CONTRIBUTING.md |
for black, there's no effect description in the dev-docs, and I think its not necessary. I also think it is not necessary for the isort. It just does its thing. If it needs to be desribed, I would go with something like this: "isort separates imports into sections by origin (builtin > third party > first party) and within the sections by type (import > import from) and within type alphabetically." but that still doesn't capture the indentation for multiple imports... so I would just skip that. |
Co-authored-by: Fabian Egli <fabianegli@users.noreply.github.com>
Great stuff @mirpedrol 👏🏻 Thank you! |
Thank you @mirpedrol |
Attempt to implement isort in CI as mentioned in #1526 comment.
Adds isort to sort and organize python imports as a GH action workflow.
PR checklist
CHANGELOG.md
is updateddocs
is updated