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

Use absolute imports #50

Merged
merged 1 commit into from Nov 8, 2015
Merged

Use absolute imports #50

merged 1 commit into from Nov 8, 2015

Conversation

adrian17
Copy link
Contributor

@adrian17 adrian17 commented Nov 5, 2015

Uses more explicit absolute imports and imports absolute_import for extra safety.

AFAIK should perfectly build on both Py2 and 3. I checked them on my OS, but let's see what CI has to say too.

@adrian17
Copy link
Contributor Author

adrian17 commented Nov 5, 2015

...oops.

Looks like the CI build failed only because a reduces score by pylint, am I getting that right? May that be caused by new version of pylint or something?

@EntilZha
Copy link
Owner

EntilZha commented Nov 5, 2015

Looks like it is a pylint error on the print statement. I am unsure why that is coming up (probably in pylint docs), but the print statement shouldn't be there at all anyway.

I am not sure why coveralls is complaining since it should be aggregating coverage counts over python 2 and 3.

@@ -44,6 +44,7 @@ def __init__(self, sequence, transform=None):
self._base_sequence = sequence._unwrap_sequence()
self._lineage = Lineage(prior_lineage=sequence._lineage)
elif isinstance(sequence, list) or isinstance(sequence, tuple) or is_iterable(sequence):
print(type(sequence))
Copy link
Owner

Choose a reason for hiding this comment

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

Print statement shouldn't be here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, my bad, somehow I completely missed that when checking the diff. Will correct in ~10 hours.

Copy link
Owner

Choose a reason for hiding this comment

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

Thanks, looks good otherwise if Travis and Coveralls agree

@EntilZha
Copy link
Owner

EntilZha commented Nov 5, 2015

I have seen python packages go both ways, what is the biggest reason to go for absolute imports over relative?

I think I saw relative imports in some of the python scientific libraries, although their the use case is to be able to move code around easily since its a very large project (not the case with this)

@EntilZha
Copy link
Owner

EntilZha commented Nov 5, 2015

On coveralls I bet its that the test did not pass so it didn't include coverage results from failed tests (the python 2 ones due to pylint on print)

@adrian17
Copy link
Contributor Author

adrian17 commented Nov 5, 2015

It's the recommended style in PEP8:

Absolute imports are recommended, as they are usually more readable and tend to be better behaved (or at least give better error messages)

@EntilZha
Copy link
Owner

EntilZha commented Nov 8, 2015

Didn't notice the commit until now. Looks good to me.

EntilZha added a commit that referenced this pull request Nov 8, 2015
@EntilZha EntilZha merged commit 51a4948 into EntilZha:master Nov 8, 2015
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

2 participants