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

Strange typing_extensions position #1254

Closed
sobolevn opened this issue Jul 4, 2020 · 2 comments
Closed

Strange typing_extensions position #1254

sobolevn opened this issue Jul 4, 2020 · 2 comments
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@sobolevn
Copy link
Member

sobolevn commented Jul 4, 2020

Before isort@5.0 my typing_extension imports were positioned in 3rd-party section. Which, I guess, is the correct place for them.

Example:

from typing import Generic

from typing_extensions import Final

from returns.hkt import Kind

After the update my code started to look like this:

from typing import Generic

from returns.hkt import Kind
from typing_extensions import Final

It does not seem right to me.
Repo to try: https://github.com/dry-python/returns
Config: https://github.com/dry-python/returns/blob/master/setup.cfg

@timothycrosley
Copy link
Member

@sobolevn isort 5.0.0 uses a new finding strategy that is guaranteed to be the same across environments, CI/CD etc. However, it is able to do this only by no longer taking env, requirements etc into the equation (see: #1147). I think you should get the behaviour you want on 5.0.0 simply by removing this line from your config: https://github.com/dry-python/returns/blob/master/setup.cfg#L74. otherwise, you can enable the old magical finding behaviour by enabling --magic-placement: https://timothycrosley.github.io/isort/docs/configuration/options/#old-finders

@timothycrosley timothycrosley added question Further information is requested documentation Improvements or additions to documentation labels Jul 4, 2020
@sobolevn
Copy link
Member Author

sobolevn commented Jul 4, 2020

Yes, removing default_section = FIRSTPARTY solves my issue.
Thanks a lot for isort and a quick help! 👍

@sobolevn sobolevn closed this as completed Jul 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants