Skip to content

Should we allow stub.py or only stub.pyi? #64

Closed

Description

@gvanrossum

The feedback on python-ideas suggests that people would like to have stubs always use the .pyi extension.

I am beginning to believe this is a good idea -- I know I've been confused between the stub and real version of a file at least twice so far (though both times it was the copy of types.py in the mypy repo, perhaps a special case :-).

Activity

  1. JukkaL commented on Mar 24, 2015

    @JukkaL
    Contributor

    Yeah, using the same extension for both can result in odd situations. I guess the assumption would be that editors and IDEs would eventually learn to recognize the .pyi extension (for syntax highlighting etc.), if it's specified in the PEP.

  2. The-Compiler commented on Mar 24, 2015

    @The-Compiler

    The only benefit I see in reusing .py is that editors and other tools don't have to adopt. I think that's a small benefit - editors should easily/quickly be able to do the minimum of just treating .pyi the same as .py in terms of syntax highlighting, etc.

    Other than that, having a different file extension for stub files only makes sense to reduce confusion. Compare to C, and .c/.h files - even if I have them in a separate folder it'd be weird and confusing to have header files/stubs named .c as well.

  3. vlasovskikh commented on Mar 24, 2015

    @vlasovskikh
    Member

    +1 on .pyi only. It would be more clear for people that they are viewing / editing Python stubs, not the real Python files themselves.

  4. gvanrossum commented on Mar 26, 2015

    @gvanrossum
    MemberAuthor

    Let's do it.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions