Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Add an isort configuration #3463

Merged
merged 8 commits into from
Jul 9, 2018
Merged

Add an isort configuration #3463

merged 8 commits into from
Jul 9, 2018

Conversation

hawkowl
Copy link
Contributor

@hawkowl hawkowl commented Jun 28, 2018

No description provided.

@hawkowl hawkowl requested a review from a team June 28, 2018 14:03
@hawkowl
Copy link
Contributor Author

hawkowl commented Jun 28, 2018

matrixbot: retest this please

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

generally this looks like a sane thing to be doing to me. I've asked some "why" questions but really they are just to satisfy my own curiosity; we shouldn't bikeshed this.


[isort]
line_length = 89
not_skip = __init__.py
Copy link
Member

Choose a reason for hiding this comment

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

whyso?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By default, isort skips init files. We put a lot of implementation code in init files, so we have to run them on it too.

@@ -19,3 +19,14 @@ max-line-length = 90
# W503 requires that binary operators be at the end, not start, of lines. Erik doesn't like it.
# E203 is contrary to PEP8.
ignore = W503,E203

[isort]
line_length = 89
Copy link
Member

Choose a reason for hiding this comment

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

whyso?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To match our flake8 configuration, basically.

setup.cfg Outdated
not_skip = __init__.py
sections=FUTURE,STDLIB,COMPAT,THIRDPARTY,TWISTED,FIRSTPARTY,LOCALFOLDER
default_section=THIRDPARTY
known_first_party = synapse
Copy link
Member

Choose a reason for hiding this comment

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

do we need to include tests in this too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch.

setup.cfg Outdated
default_section=THIRDPARTY
known_first_party = synapse
known_compat = mock,six
known_twisted=twisted,OpenSSL
Copy link
Member

Choose a reason for hiding this comment

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

I'm not entirely convinced about putting mock, six, twisted and OpenSSL in separate groups. What's the thinking there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reasoning for six being separate is that when we go Py3 only, that compat section gets removed (as six isn't needed and mock is in the stdlib in py3).

Twisted being separate is basically aesthetics for me, I added it after a test run to see how it would look. Since we import so much from it, it just adds a bit of whitespace between all those imports and the other third party ones, otherwise the list can get pretty dense.

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

lgtm!

@hawkowl hawkowl merged commit 2ee9f1b into develop Jul 9, 2018
@hawkowl hawkowl deleted the hawkowl/isort branch July 9, 2018 06:08
@krombel krombel mentioned this pull request Jul 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants