Skip to content

Relax __all__ location requirement in PEP 8 #71374

Closed

Description

@warsaw
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 = []

    Activity

    1. warsaw commented on Jun 2, 2016

      @warsaw
      MemberAuthor

      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

    2. added
      docsDocumentation in the Doc dir
      on Jun 2, 2016
    3. IanLee1521 commented on Jun 3, 2016

      IanLee1521mannequin
      Mannequin

      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.

    4. IanLee1521 commented on Jun 3, 2016

      IanLee1521mannequin
      Mannequin

      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.

    5. IanLee1521 commented on Jun 3, 2016

      IanLee1521mannequin
      Mannequin

      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)

    6. python-dev commented on Jun 7, 2016

      python-devmannequin
      Mannequin

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

    7. warsaw commented on Jun 7, 2016

      @warsaw
      MemberAuthor

      Thanks for the patch!

    8. jayvdb commented on Jun 8, 2016

      jayvdbmannequin
      Mannequin

      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?

    9. IanLee1521 commented on Jun 8, 2016

      IanLee1521mannequin
      Mannequin

      Good catch.

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

    10. warsaw commented on Jun 8, 2016

      @warsaw
      MemberAuthor

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

    11. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      docsDocumentation in the Doc dir

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions