-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow stubs package #742
base: main
Are you sure you want to change the base?
Conversation
if name.endswith('-stubs'): | ||
return name.removesuffix('-stubs').replace('-','_') + '-stubs' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The special casing should be explained here. For example, typeshed uses a types-
prefix, which this doesn't cover. Is that important?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's from pep-0561, a type stub package should add -stubs
to main package.
the types-
prefix is just the pypi name, which is not the director contains pyi files.
For example, if you unzip the types_six-1.17.0.20250403-py3-none-any.whl
, you will get this:
Archive: types_six-1.17.0.20250403-py3-none-any.whl
inflating: six-stubs/METADATA.toml
inflating: six-stubs/__init__.pyi
inflating: six-stubs/py.typed
inflating: six-stubs/moves/BaseHTTPServer.pyi
inflating: six-stubs/moves/CGIHTTPServer.pyi
inflating: six-stubs/moves/SimpleHTTPServer.pyi
inflating: six-stubs/moves/__init__.pyi
inflating: six-stubs/moves/_dummy_thread.pyi
...
AND, if you are not typeshed, you should not use types-
prefix.
so we only handle -stubs
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still possible that a package named as something like pkg-stubs2
and contins pkg-stubs/__init__.pyi
for package "pkg", but I don't think it's worth handling ...
only handle -stubs
suffix should cover most of the use case. If someone need a package pkg-stubs
, they can still workaround with solution at here: #332 (comment)
close #332
dynamic
, which is typical the case of stubs package-stubs
package without__init__.py
-stubs
parts in package name