{"action":"created","issue":{"url":"https://api.github.com/repos/ambv/typehinting/issues/84","labels_url":"https://api.github.com/repos/ambv/typehinting/issues/84/labels{/name}","comments_url":"https://api.github.com/repos/ambv/typehinting/issues/84/comments","events_url":"https://api.github.com/repos/ambv/typehinting/issues/84/events","html_url":"https://github.com/ambv/typehinting/issues/84","id":68481507,"number":84,"title":"Third-party stubs: recommending a default path for installing stub files, overriding stubs","user":{"login":"ambv","id":55281,"avatar_url":"https://avatars.githubusercontent.com/u/55281?v=3","gravatar_id":"","url":"https://api.github.com/users/ambv","html_url":"https://github.com/ambv","followers_url":"https://api.github.com/users/ambv/followers","following_url":"https://api.github.com/users/ambv/following{/other_user}","gists_url":"https://api.github.com/users/ambv/gists{/gist_id}","starred_url":"https://api.github.com/users/ambv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambv/subscriptions","organizations_url":"https://api.github.com/users/ambv/orgs","repos_url":"https://api.github.com/users/ambv/repos","events_url":"https://api.github.com/users/ambv/events{/privacy}","received_events_url":"https://api.github.com/users/ambv/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ambv/typehinting/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-04-14T19:55:28Z","updated_at":"2015-05-18T17:04:09Z","closed_at":"2015-05-18T17:04:09Z","body":"The ideal situation is where a file is annotated. The other obvious choice if there is a module.pyi stub file alongside module.py. However, since package maintainers are free not to add type hinting to their packages, there has to be support for third-party stubs installable by `pip` from PyPI. This opens the following questions:\r\n* should there be a recommended naming scheme for those stubs? \"**No**, a package maintainer can always trump third-party implementations by including types in his own module.\".\r\n* should there be a default install place for those stubs? \"**Yes**, this makes the type checker's stub discovery much easier. We are proposing using `data_files=('share/typehinting/', pathlib.Path(SRC_PATH).glob('**/*.pyi'))` in setup.py. We are proposing to add a setup.cfg hook to do the right thing automatically.\"\r\n* should third-party stubs be versioned? \"**Yes**, they should be versioned as the lowest version of the source package that they are describing. Example: FooPackage has versions 1.1, 1.2, 1.3, 2.0, 2.1, 2.2, 2.3, 2.4. There are API changes in versions 1.1, 2.0 and 2.4. We need only those three versions of stubs, in which case the user should install the closest **lower** version of stubs available. If the user lives dangerously and does not pin versions, running both the source package and the stubs as **latest** will generally work (as long as the stubs are regularly updated).\"\r\n* as mentioned previously, the package itself might provide *.pyi files. There will be a directory (`shared/typehinting/`) where third-party packages can put their implementation of stubs for external packages. Also, tools like type checkers or IDEs might provide their own custom paths for stubs they themselves populate, etc. The type checker itself is expected to only load one *.pyi file per corresponding *.py module."},"comment":{"url":"https://api.github.com/repos/ambv/typehinting/issues/comments/103131681","html_url":"https://github.com/ambv/typehinting/issues/84#issuecomment-103131681","issue_url":"https://api.github.com/repos/ambv/typehinting/issues/84","id":103131681,"user":{"login":"gvanrossum","id":2894642,"avatar_url":"https://avatars.githubusercontent.com/u/2894642?v=3","gravatar_id":"","url":"https://api.github.com/users/gvanrossum","html_url":"https://github.com/gvanrossum","followers_url":"https://api.github.com/users/gvanrossum/followers","following_url":"https://api.github.com/users/gvanrossum/following{/other_user}","gists_url":"https://api.github.com/users/gvanrossum/gists{/gist_id}","starred_url":"https://api.github.com/users/gvanrossum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gvanrossum/subscriptions","organizations_url":"https://api.github.com/users/gvanrossum/orgs","repos_url":"https://api.github.com/users/gvanrossum/repos","events_url":"https://api.github.com/users/gvanrossum/events{/privacy}","received_events_url":"https://api.github.com/users/gvanrossum/received_events","type":"User","site_admin":false},"created_at":"2015-05-18T17:04:09Z","updated_at":"2015-05-18T17:04:09Z","body":"I can't tell from this discussion if this requires PEP changes or not. I am labeling this as enhancement which I will interpret as \"in the future, maybe\", i.e. \"no need to change the PEP or typing.py now\"."}}