Skip to content

STY: Using __all__; removed "noqa" comment #33143

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

Merged

Conversation

ShaharNaveh
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

lgtm

@WillAyd WillAyd added the Code Style Code style, linting, code_checks label Mar 30, 2020
@WillAyd WillAyd added this to the 1.1 milestone Mar 30, 2020
Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

I am personally -1 on this, I find the relative imports much clearer to signal it are all imports internally from the module.

@ShaharNaveh
Copy link
Member Author

I personally don't have a strong opinion on relative vs absolute imports, just wanted to remove the # flake8: noqa comment.


If we do want relative imports in some places, https://dev.pandas.io/docs/development/code_style.html#imports-aim-for-absolute should be updated.

@jbrockmendel
Copy link
Member

I find the relative imports much clearer to signal it are all imports internally from the module.

I'm with Joris on this one.

@WillAyd
Copy link
Member

WillAyd commented Mar 30, 2020

absolute imports are recommended by PEP8 and are used 99% of the time in our code base, so I think we should go with this

@jorisvandenbossche
Copy link
Member

PEP8 also says:

However, explicit relative imports are an acceptable alternative to absolute imports, especially when dealing with complex package layouts where using absolute imports would be unnecessarily verbose

(which I would say applies here)

So I don't think PEP8 is a good reason to do this.
Consistency within pandas of course is. And it is correct than almost all code uses absolute imports. But that is also because there are regularly PRs like this one that converts to absolute imports that we merge ;) (just meaning, this is a "rule" we set ourselves that can be discussed)

@jreback
Copy link
Contributor

jreback commented Mar 30, 2020

I am personally -1 on this, I find the relative imports much clearer to signal it are all imports internally from the module.

I disagree, we barely use them. having a mix is SO confusing. Since we use absolute almost everywhere we should just continue to do this.

@jreback
Copy link
Contributor

jreback commented Mar 30, 2020

all that said, we could have a policy to use relative in some parts of the codebase. I just don't want to mix it within a file. This file looks fine as is. But we need to define how we communicate this policy (and how its enforced).

@WillAyd
Copy link
Member

WillAyd commented Apr 7, 2020

Is there a path forward here? I'm still OK with this

@jbrockmendel
Copy link
Member

I personally don't have a strong opinion on relative vs absolute imports, just wanted to remove the # flake8: noqa comment.

Let's just do the __all__ for now

@jorisvandenbossche jorisvandenbossche changed the title STY: Using absolute imports; removed "noqa" comment STY: Using __all__; removed "noqa" comment Apr 10, 2020
@WillAyd WillAyd merged commit 991f784 into pandas-dev:master Apr 10, 2020
@WillAyd
Copy link
Member

WillAyd commented Apr 10, 2020

Thanks @MomIsBestFriend

@ShaharNaveh ShaharNaveh deleted the STY-AbsImport-_libs-tslibs-init branch April 10, 2020 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants