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

[proposal] use isort to organize python imports #91

Merged
merged 7 commits into from
Aug 29, 2017

Conversation

jairhenrique
Copy link
Contributor

To fix:

isort -rc .

To check:

isort --check

Copy link
Contributor

@osantana osantana left a comment

Choose a reason for hiding this comment

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

I'll approve but I would like to configure isort to ignore alphabetic order when importing modules with import command.

import math
import os
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like alphabetical ordering. I prefer to import in the same sequence as we use modules/packages on code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@osantana isort has this settings. How do you want it?

from datetime import datetime
from decimal import Decimal
from itertools import chain
from typing import Container, Iterable, Sized, Union

import re

Copy link
Contributor

Choose a reason for hiding this comment

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

Ugh! This import went unnoticed :|

@@ -1,5 +1,6 @@
-r requirements.txt
factory-boy==2.8.1
isort
Copy link
Contributor

Choose a reason for hiding this comment

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

isort could be used for test purposes?

.travis.yml Outdated
@@ -18,6 +18,7 @@ install:
- pip install flake8

before_script:
- isort --check
Copy link
Contributor

Choose a reason for hiding this comment

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

isort --check only outputs if the file is correct/incorrect. I believe isort --check --diff would be a better choice. This way we'll get more details on why the test failed

Copy link
Contributor

Choose a reason for hiding this comment

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

We need to define a standard and stick to it. The mypy-lang doesn't belongs to test suite but it's in requirements-test.txt.

I'd like to suggest rename requirements-test.txt to requirements-ci.txt and put: flake8, mypy-lang, isort, etc inside it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I consider these lint command as test environment on my projects. On ci I run make lint...
It's a part on development and the developer should run this command locally... my opinion.

@@ -18,6 +18,7 @@ install:
- pip install flake8
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO isort shouldn't be added on requirements-test.txt file because it's not used in the project's test suite. Instead it should be installed here with other checkers such as flake8.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@codecov-io
Copy link

codecov-io commented Aug 29, 2017

Codecov Report

Merging #91 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #91      +/-   ##
==========================================
- Coverage   98.98%   98.98%   -0.01%     
==========================================
  Files          11       11              
  Lines        1572     1570       -2     
==========================================
- Hits         1556     1554       -2     
  Misses         16       16
Impacted Files Coverage Δ
correios/models/data.py 100% <ø> (ø) ⬆️
correios/soap.py 100% <ø> (ø) ⬆️
correios/__init__.py 100% <ø> (ø) ⬆️
correios/utils.py 100% <100%> (ø) ⬆️
correios/client.py 97.12% <100%> (ø) ⬆️
correios/renderers/pdf.py 96.81% <100%> (ø) ⬆️
correios/models/posting.py 100% <100%> (ø) ⬆️
correios/models/user.py 100% <100%> (ø) ⬆️
correios/models/address.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 244f42c...07290ef. Read the comment docs.

@jairhenrique
Copy link
Contributor Author

@osantana can I organize these commits? 🤔

@osantana
Copy link
Contributor

@osantana can I organize these commits? 🤔

May I create a Squash Merge?

@jairhenrique
Copy link
Contributor Author

May I create a Squash Merge?

Sounds good.
rebase > merge

@osantana osantana merged commit 350841e into olist:master Aug 29, 2017
@jairhenrique jairhenrique deleted the imports branch August 29, 2017 22:35
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.

None yet

5 participants