-
Notifications
You must be signed in to change notification settings - Fork 2
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
stub-package for python modules or extensions? #1
Comments
Hi, PEP 561 doesn't support single module packages, see https://peps.python.org/pep-0561/#packaging-type-information I would recommend putting a folder of the same name of the module that includes either an |
Indeed I missed this information.
Makes sense. The package folder with This works so far for an extension only distribution. One thing that still bothers me is the naming. According to pypa/distutils#108 (comment) the folder name shoud contain an underscore while the packages and package_data entries should contain dash. Is this correct? |
Henry is incorrect there, see for example mypy's test data for stub packages: https://github.com/python/mypy/tree/master/test-data/packages/typedpkg-stubs The point of the |
Thank you for the clarification! |
Hi, thank you very much for providing examples for PEP 561
Just for curiosity I have installed this library with
and found that my VSCode can see the typehints:
despite there is no
typedpkg
installed.I am not interested in type hinting packages. I usually make Python extensions or modules with type hints in .pyi stub files.
in this context:
__init__.py
.modulename.py
files.mymodule.___.pyd
ormymodule.___.so
files.This repository is a great example to add stub files for packages, but would it be correct to use it for modules or extensions?
I currently have:
This is obviously not correct as '.' is not a package, but it seemed to work and I used it here.
Moving
mymodule.pyi
tomymodule-stubs/__init__.pyi
and changing the setup code to:This might be also inappropiate as mymodule is an extension not a package.
The text was updated successfully, but these errors were encountered: