Skip to content

Third-party stubs & Python 2 #5630

@srittau

Description

@srittau

I have a few suggestions to improve our Python 2 handling for third-party packages:

  1. Move Python2-only stubs consistently to the @python2 subdir. This makes things more consistent and makes it obvious when a stub doesn't support Python 3. (This has bit me before.) It also enables further changes as outlined below. A stub uploader PR enabling this is ready for review: Allow stub directories with only a @python2 directory typeshed-internal/stub_uploader#15.
  2. Have a separate METADATA.toml file in @python2 (and no METADATA.toml in the base dir, if the stubs don't support Python 3). This allows us to support older versions of a package on Python 2. This is especially important if a package drops Python 2 support. It also means that the base and the @python2 version don't need to be kept in sync.
  3. Split all third-party stubs into Python 2 and 3 versions for the same reasons as outlined in Split stdlib into Python 2 and 3 versions #5442 for the stdlib. This would be especially useful when a third-party library drops Python 2 support. It also means that Python 2 users can consistently install the types-*-py2 package and Python 3 users don't need to worry that types-* contains Python 2 only stubs. Edit: We could continue to support old packages for Python 2 only, while updating to a newer package version for Python 3.

One thing to note is that the stub uploader currently doesn't support the python2 and python3 metadata fields anyway. This needs some investigating.

Metadata

Metadata

Assignees

No one assigned

    Labels

    project: policyOrganization of the typeshed project

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions