-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Labels
project: infrastructuretypeshed build, test, documentation, or distribution relatedtypeshed build, test, documentation, or distribution related
Description
See #15548 for an example of this problem.
Currently, we don't support optional dependencies in typeshed. Say a third-party package has some additional functionality if another third-party package is installed. For example, Authlib has a module authlib.integrations.requests_client that works only if requests is also installed. This leads to the awkward situation that our stubs for that module have many comments of the form "Inherits from requests.Session".
I suggest that we should add support for optional dependencies. Here's an idea:
- Add a field
optional-requirestoMETADATA.toml. stub_uploader checks that this has the same limitations asrequires. - In tests
optional-requiresis treated the same way thatrequiresis, i.e. the packages mentioned there are installed. - stub_uploader adds this new field to
project.optional-dependenciesinpyproject.toml.
(Sidenote: Maybe we should rename requires to dependencies to match pyproject.toml.)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
project: infrastructuretypeshed build, test, documentation, or distribution relatedtypeshed build, test, documentation, or distribution related