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

Relax __all__ location requirement in PEP 8 #71374

Closed
warsaw opened this issue Jun 2, 2016 · 9 comments
Closed

Relax __all__ location requirement in PEP 8 #71374

warsaw opened this issue Jun 2, 2016 · 9 comments
Labels
docs Documentation in the Doc dir

Comments

@warsaw
Copy link
Member

warsaw commented Jun 2, 2016

BPO 27187
Nosy @warsaw, @IanLee1521, @jayvdb
Files
  • issue-27187-patch1.txt
  • issue-27187-patch2.txt: Updated patch that removes version bookkeeping section
  • issue-27187-patch3.txt: New patch explicitly mentioning __future__ imports
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2016-06-07.20:25:26.839>
    created_at = <Date 2016-06-02.21:06:42.006>
    labels = ['docs']
    title = 'Relax __all__ location requirement in PEP 8'
    updated_at = <Date 2016-06-08.14:34:38.652>
    user = 'https://github.com/warsaw'

    bugs.python.org fields:

    activity = <Date 2016-06-08.14:34:38.652>
    actor = 'barry'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2016-06-07.20:25:26.839>
    closer = 'python-dev'
    components = ['Documentation']
    creation = <Date 2016-06-02.21:06:42.006>
    creator = 'barry'
    dependencies = []
    files = ['43132', '43134', '43296']
    hgrepos = []
    issue_num = 27187
    keywords = []
    message_count = 9.0
    messages = ['266949', '267002', '267008', '267014', '267743', '267744', '267757', '267771', '267859']
    nosy_count = 5.0
    nosy_names = ['barry', 'docs@python', 'python-dev', 'IanLee1521', 'jayvdb']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue27187'
    versions = []

    @warsaw
    Copy link
    Member Author

    warsaw commented Jun 2, 2016

    PEP-8 says:

    Put any relevant __all__ specification after the imports.

    I don't remember why we wanted __all__ to go after imports. I think we should relax that since other dunders can go before imports.

    See related PYCQA issue: PyCQA/pycodestyle#394

    @warsaw warsaw added the docs Documentation in the Doc dir label Jun 2, 2016
    @IanLee1521
    Copy link
    Mannequin

    IanLee1521 mannequin commented Jun 3, 2016

    I think that it should be updated to specify that all dunders ('__all__', '__version__', '__author__', etc) should be placed after the module docstring and before any imports. See issue-27187-patch1.txt for a possible update.

    @IanLee1521
    Copy link
    Mannequin

    IanLee1521 mannequin commented Jun 3, 2016

    I might also suggest that the entire "Version bookkeeping" section could be removed in this case, as it would be covered by my newly added dunder section.

    @IanLee1521
    Copy link
    Mannequin

    IanLee1521 mannequin commented Jun 3, 2016

    I added a comment on a pull request related to this that shows some of the cases that we probably don't want to allow: PyCQA/pycodestyle#523 (comment)

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 7, 2016

    New changeset cf8e888b9555 by Barry Warsaw in branch 'default':
    Relax __all__ location.
    https://hg.python.org/peps/rev/cf8e888b9555

    @python-dev python-dev mannequin closed this as completed Jun 7, 2016
    @warsaw
    Copy link
    Member Author

    warsaw commented Jun 7, 2016

    Thanks for the patch!

    @jayvdb
    Copy link
    Mannequin

    jayvdb mannequin commented Jun 8, 2016

    The revised text says __dunder__ should appear before any imports, however __future__ imports must appear first for obvious reasons. Does this need to be mentioned in the pep?

    @IanLee1521
    Copy link
    Mannequin

    IanLee1521 mannequin commented Jun 8, 2016

    Good catch.

    I'm uploading a new patch that addresses from __future__ imports issue explicitly.

    @warsaw
    Copy link
    Member Author

    warsaw commented Jun 8, 2016

    Thanks Ian. I'm going to apply that, but rephrase it a bit.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    docs Documentation in the Doc dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant