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

upgrade to isort5 #4399

Merged
merged 1 commit into from Aug 17, 2020
Merged

upgrade to isort5 #4399

merged 1 commit into from Aug 17, 2020

Conversation

skshetry
Copy link
Member

  • Imports are no longer moved to the top.

  • seed-isort-config is no longer needed.

  • Has a black-compatible profile/config.

  • Also isorts the imports anywhere in the code
    (not just at the top).

  • ❗ I have followed the Contributing to DVC checklist.

  • 📖 If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here.

Thank you for the contribution - we'll try to review it as soon as possible. 🙏

@skshetry skshetry added the refactoring Factoring and re-factoring label Aug 17, 2020
@skshetry skshetry self-assigned this Aug 17, 2020
@skshetry skshetry added this to In progress in DVC 11 - 25 August 2020 via automation Aug 17, 2020
@restyled-io restyled-io bot mentioned this pull request Aug 17, 2020
dvc/repo/plots/data.py Outdated Show resolved Hide resolved
@skshetry skshetry marked this pull request as draft August 17, 2020 04:31
@skshetry
Copy link
Member Author

restyled-isort does not have isort5 support. will try adding later.

known_first_party=dvc,tests
known_third_party=PyInstaller,RangeHTTPServer,boto3,colorama,configobj,distro,dpath,flaky,flufl,funcy,git,grandalf,mock,moto,nanotime,networkx,packaging,pathspec,pygtrie,pylint,pytest,requests,ruamel,setuptools,shortuuid,shtab,toml,tqdm,voluptuous,yaml,zc
line_length=79
Copy link
Member Author

Choose a reason for hiding this comment

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

@efiop @pared @pmrowla, what do you guys say of increasing line length limit to black's default (i.e. 88)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Personally, I think 79 is fine. I'm not opposed to using 88, but I would prefer we don't go much higher than that in the future.

IMO Python projects that use 100+ tend to get hard to read, but I get that this is more of a personal taste issue than anything else.

Copy link
Contributor

Choose a reason for hiding this comment

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

I have no strong opinion on that, only thing that bugs me is that this decision will require some refactor, as black tends to not remove " when its not needed anymore, so we will probably have a lot of lines like
"This is " "the comment"

Copy link
Member Author

@skshetry skshetry Aug 17, 2020

Choose a reason for hiding this comment

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

@pared, string handling has been significantly improved in black (psf/black#1132) and should solve that issue. However, that'd be useful only if there were a new release. :(

Copy link
Member Author

@skshetry skshetry Aug 17, 2020

Choose a reason for hiding this comment

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

Okay then, if no one has strong opinion, I'll be increasing the limit to 88.

CC @efiop

Copy link
Member

@efiop efiop Aug 27, 2020

Choose a reason for hiding this comment

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

Oops, missed this one. I would not increase it to 88. 80 is a good standard width that is used in many projects and is on the border of being viewable in splitscreens on github and/or editors (e.g. vim). Plus, if we change it now, we'll introduce inconsistency with the rest of the code base. So I'm not really seeing good reasons to go to 88, it won't make it easier to navigate.

@pmrowla
Copy link
Contributor

pmrowla commented Aug 17, 2020

failing CI test is specific to experiments and shouldn't block this PR (see #4401)

@skshetry
Copy link
Member Author

skshetry commented Aug 17, 2020

failing CI test is specific to experiments and shouldn't block this PR (see #4401)

I'll rerun later. Thanks. Currently it's blocked by lack of support from restyled.

Keeping this as draft, till then, see restyled-io/restylers#86.

Copy link
Contributor

@pared pared left a comment

Choose a reason for hiding this comment

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

Nice!

@skshetry
Copy link
Member Author

PR has been merged and the new restyled-isort image is available. 🎉

@skshetry skshetry marked this pull request as ready for review August 17, 2020 13:38
tests/remotes/__init__.py Outdated Show resolved Hide resolved
* Imports are no longer moved to top.
* `seed-isort-config` is no longer needed.
* Has a `black`-compatible profile/config.
* Also `isorts` the imports anywhere in the code
  (not just at the top).

Also bumps `restyled-isort` to newest version
@skshetry skshetry merged commit c4bc4c8 into iterative:master Aug 17, 2020
DVC 11 - 25 August 2020 automation moved this from In progress to Done Aug 17, 2020
@skshetry skshetry deleted the isort5 branch August 17, 2020 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Factoring and re-factoring
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants