Hi, thank you very much for providing examples for PEP 561
Just for curiosity I have installed this library with
pip install https://github.com/ethanhs/stub-package/archive/refs/heads/master.zip
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:
- packages are folders of python code with or without an
__init__.py
.
- modules are
modulename.py
files.
- extensions are
mymodule.___.pyd
or mymodule.___.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:
setup(
name='mymodule',
ext_modules=[Extension(name='mymodule', ...)],
data_files=[('.', ['mymodule.pyi'])],
)
This is obviously not correct as '.' is not a package, but it seemed to work and I used it here.
Moving mymodule.pyi
to mymodule-stubs/__init__.pyi
and changing the setup code to:
setup(
name='mymodule',
ext_modules=[Extension(name='mymodule', ...)],
package_data={'mymodule-stubs': ['__init__.pyi']},
packages=['mymodule-stubs'],
)
This might be also inappropiate as mymodule is an extension not a package.