-
Notifications
You must be signed in to change notification settings - Fork 956
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 Module is Observed in /spotipy/* #589
Conversation
Thanks for that. Please update the changelog :-) Also, how does one use "isort"? is there a command we can use to sort imports in the future? could we add this as a CI check? |
Thanks for your responsing. I'm working on the logging side of the Spotipy now. (using the default script-based configurations) I do guess it brings some troubles in using isort module in the CI services. I've worked on a lot of projects and used isort in order to sort the import lists but in some cases, it just failed in tests!! (e.g. you can take a look at this closed PR on IBM/lale) Finally, I enthusiastically appreciate you for adding the label to the PR. Thanks. |
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.
We could merge your PR as it is, but it would be better if others can profit from it:
-
what command did you run? add it to https://github.com/plamere/spotipy/blob/master/CONTRIBUTING.md#lint
-
in the case of our CI, we could probably run a command that checks if imports are sorted or not, see https://github.com/PyCQA/isort#the---check-only-option. So maybe, after the line that checks if the code is formatted https://github.com/plamere/spotipy/blob/88ad7e05d515740844c7f654f81f4fddf3e517fa/.github/workflows/pythonapp.yml#L27 add the command you ran in (1) by adding
-c
to it -
As shown in https://github.com/PyCQA/isort#setuptools-integration, I'm thinking we should add
isort
to the spotipyextra_reqs
, so that everyone working on spotipy will automatically install it: https://github.com/plamere/spotipy/blob/88ad7e05d515740844c7f654f81f4fddf3e517fa/setup.py#L14
@@ -5,12 +5,19 @@ All notable changes to this project will be documented in this file. | |||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | |||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | |||
|
|||
|
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.
extra line to remove
CHANGELOG.md
Outdated
## Unreleased | ||
|
||
### Fixed | ||
|
||
- SpotifyException now thrown when a request fails & has no response ( fixes #571, #581 ) | ||
|
||
## [2.16.0] - 2020-09-18 |
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.
You can remove this line as 2.16.0 was already released and your changes are still unreleased
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.
Everything is ok with these changes. Flake has restored some changes in the scripts which are completely compatible in isort. Hope it's ready to be merged.
I suggest you add the flake8 plugin instead of using isort. It helps you to verify if all import lists are sorted. Check flake8-isort module. (I've never worked with this tool and that why I have no idea about editing the lint section so I leave it on your own) Thank you so much. :) |
You have to start sometime @lnxpy 😺 Your PR in its current state does not break anything so that's great, but it also doesn't add long-term value. Codebase changes should come with tests and changing the style of a codebase without adding an automatic rule is useful only temporarily because others won't follow it and soon, your initial sorting will be erased. You probably wouldn't like to open that same PR in a month, would you? For your PR to get the value it deserves and be merged, it would need:
I also agree that using the flake8-isort plugin is better than using isort itself, because we already use flake8. Please note that there is also https://pypi.org/project/flake8-import-order/, feel free to pick your favorite |
Thanks @stephanebruckert, |
@lnxpy that's fine, what command did you run to sort the imports? please add that command to the following doc, so that next contributors know how to do it: https://github.com/plamere/spotipy/blob/master/CONTRIBUTING.md#lint and we can merge your PR |
I've already worked on the logging system. I suppose to make another PR for those changes. |
Yeah I just wanted to express how important it is to share your knowledge, which you did, so thank you. Looking forward to your next PR! |
I installed the
isort
module right beside the other dependencies. Now, isort is observed in /spotipy/*.py files. There is no big change in the main algorithm.Thanks.