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

Update styleguide regarding sorting imports #509

Merged
merged 4 commits into from Jan 31, 2016

Conversation

Projects
None yet
4 participants
@gforcada
Contributor

gforcada commented Jan 29, 2016

Follow up of #500 (nice number one @do3cc ) and plone/plone.api#187.

At Alpine City Sprint @jensens @do3cc and me discussed about the issue and end up deciding that tooling is more important than editors and thus, we follow suit what isort provides us, i.e. alphabetically case-insensitive sorting and one line between from X import Y and import Z.

My personal opinion to whoever wants to change it: update isort so that it sorts how you like and only after that we can open, yet again, the discussion.

As a matter of fact, currently our stack compromises +8500 python files, who is gonna update them manually without a tool to do so and keep them checked?

gforcada added some commits Jan 29, 2016

jensens added a commit that referenced this pull request Jan 31, 2016

Merge pull request #509 from plone/gforcada-patch-1
Update styleguide regarding sorting imports

@jensens jensens merged commit 7692da0 into 5.0 Jan 31, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@jensens jensens deleted the gforcada-patch-1 branch Jan 31, 2016

@thet

This comment has been minimized.

Show comment
Hide comment
@thet

thet Feb 1, 2016

Member

+1. isort works great in vim.
your provided isort configuration also expands multiline imports to one line per import. I'll create a pull requests with an update mentioning the multiline import thing.

Member

thet commented Feb 1, 2016

+1. isort works great in vim.
your provided isort configuration also expands multiline imports to one line per import. I'll create a pull requests with an update mentioning the multiline import thing.

@do3cc

This comment has been minimized.

Show comment
Hide comment
@do3cc

do3cc Feb 1, 2016

Member

I have mixed results with the Isort plugin.
This one: https://github.com/fisadev/vim-isort#installation does not work sometimes.
I never figured out why, but I suspect that vim caches the python interpreter to use and if you change your virtualenv, you might end up in a virtualenv where isort is installed, but your vim uses a cached python without isort installed.
For a month now I use the second suggestion from the isort wiki:
command! -range=% Isort :,! isort - - just add this to your ~/.vimrc
and this works.

Member

do3cc commented Feb 1, 2016

I have mixed results with the Isort plugin.
This one: https://github.com/fisadev/vim-isort#installation does not work sometimes.
I never figured out why, but I suspect that vim caches the python interpreter to use and if you change your virtualenv, you might end up in a virtualenv where isort is installed, but your vim uses a cached python without isort installed.
For a month now I use the second suggestion from the isort wiki:
command! -range=% Isort :,! isort - - just add this to your ~/.vimrc
and this works.

@thet

This comment has been minimized.

Show comment
Hide comment
@thet

thet Feb 1, 2016

Member

I also use the second suggestion and mapped it to a keymap. Since this is all I expect from a vim integration of isort, I prefer this approach.

Member

thet commented Feb 1, 2016

I also use the second suggestion and mapped it to a keymap. Since this is all I expect from a vim integration of isort, I prefer this approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment