Skip to content

Start adding isort#7370

Merged
jrbourbeau merged 7 commits intodask:mainfrom
jsignell:isort
Mar 31, 2021
Merged

Start adding isort#7370
jrbourbeau merged 7 commits intodask:mainfrom
jsignell:isort

Conversation

@jsignell
Copy link
Copy Markdown
Member

@jsignell jsignell commented Mar 11, 2021

Copy link
Copy Markdown
Member

@jrbourbeau jrbourbeau left a comment

Choose a reason for hiding this comment

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

Nice! Thanks for taking this on. I see this is marked as a draft PR -- just let me know when you'd like a review

@charlesbluca
Copy link
Copy Markdown
Member

I opened up a similar PR doing this for distributed #4600 - tried to keep my settings consistent with those used here, feel free to let me know if you think some things should be different for Distributed!

@jsignell
Copy link
Copy Markdown
Member Author

Thanks for the ping @charlesbluca! I ran into a bunch of issues after running isort on dask and haven't come back to it. Please let me know if you want to chat or come up with any best practices.

@charlesbluca
Copy link
Copy Markdown
Member

No problem! Out of interest, were the issues flake8 errors when running pre-commit or did tests start failing after the resort?

I don't have much experience with package sorting, so from my perspective things look good as is, but I'm happy to discuss any tweaks that might be needed either on here or Gitter (or elsewhere).

@jsignell
Copy link
Copy Markdown
Member Author

Tests started failing after the resort. I think it probably had to do with how dask handles optional dependencies. I'll give it another go next week.

@jsignell
Copy link
Copy Markdown
Member Author

jsignell commented Mar 29, 2021

Ok the last 3 commits actually do the isort. It'd be good to merge this quickly if people are happy with it, otherwise I will revert and rebase if main drifts.

@jsignell jsignell marked this pull request as ready for review March 29, 2021 15:57


from .utils import meta_from_array, compute_meta
from .blockwise import blockwise
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I moved this to the bottom of the file to avoid circular dependencies. This is the only change that I made to what isort did by default. @jrbourbeau

Copy link
Copy Markdown
Member

@jrbourbeau jrbourbeau left a comment

Choose a reason for hiding this comment

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

Thanks @jsignell! I've left a couple of small comments, otherwise this looks great -- thanks for taking this on

What do you think about treating distributed as a special third-party package that appear right above the dask imports instead of being grouped with things like numpy, cloudpickle, etc.?

diff --git a/setup.cfg b/setup.cfg
index c44894ae..5ccd68c4 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -18,11 +18,13 @@ ignore =
 max-line-length = 120

 [isort]
+sections=FUTURE,STDLIB,THIRDPARTY,DISTRIBUTED,FIRSTPARTY,LOCALFOLDER
 profile = black
 skip_gitignore = true
 force_to_top = true
 default_section = THIRDPARTY
 known_first_party = dask
+known_distributed=distributed

 [versioneer]
 VCS = git

@jsignell
Copy link
Copy Markdown
Member Author

@jrbourbeau are you happy for this to merge if it passes?

Copy link
Copy Markdown
Member

@jrbourbeau jrbourbeau left a comment

Choose a reason for hiding this comment

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

Yeah, thanks for working on this @jsignell

@jrbourbeau jrbourbeau merged commit a31c0fc into dask:main Mar 31, 2021
@jsignell jsignell deleted the isort branch March 31, 2021 18:41
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.

[MAINT] Clean up import order

3 participants