Skip to content
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

Add py.typed Marker to Package #2903

Closed
1 task done
adam-grant-hendry opened this issue Jun 29, 2022 · 0 comments
Closed
1 task done

Add py.typed Marker to Package #2903

adam-grant-hendry opened this issue Jun 29, 2022 · 0 comments
Labels
feature-request Please add this cool feature!

Comments

@adam-grant-hendry
Copy link
Contributor

Describe the feature you would like to be added.

pyvista has some partial typings, but no py.typed marker or stubs, so mypy is not able to recognize the type hints in the subpackages that have them since pyvista is not PEP-561 compliant.

It would be great to add a py.typed marker to the package: Creating PEP 561 compatible packages

NB:

For PyQt5, stubs are available as a pip package:

$ pip install pyqt5-stubs

For PyQt6, they can be downloaded from this GitHub repo:

$ pip install git+https://github.com/python-qt-tools/PyQt6-stubs.git

For PySide2, they can be downloaded from pip:

$ pip install PySide2-stubs

and for PySide6, the package ships with a script pyside6-genpyi that generates the stubs:

$ pyside6-genpyi all

As for PyQt4, and PySide, I do not know as those are pretty old.

Links to VTK Documentation, Examples, or Class Definitions.

No response

Pseudocode or Screenshots

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@adam-grant-hendry adam-grant-hendry added the feature-request Please add this cool feature! label Jun 29, 2022
adam-grant-hendry pushed a commit to adam-grant-hendry/pyvista that referenced this issue Jun 29, 2022
This will allow static type checkers to recognized the package's type hints per PEP-561

Fixes issue pyvista#2903
akaszynski pushed a commit that referenced this issue Jul 2, 2022
* feat(typehinting): add `py.typed` marker to package

This will allow static type checkers to recognized the package's type hints per PEP-561

Fixes issue #2903

* fix(package-data): add `py.typed` to `package_data`

* Add newline to end of py.typed

* feat(setuptools): add type hint files to `MANIFEST.in` and set `zip_safe=False`

`mypy` requires packages built with `setuptools` use the `zip_safe=False` option so it can find the package and `*.pyi` and `*.typed` files be added to the `MANIFEST.in` so they are included in the `sdist`.

See https://mypy.readthedocs.io/en/latest/installed_packages.html#creating-pep-561-compatible-packages

* Add newline to end of MANIFEST.in

Co-authored-by: Hendry, Adam <adam.hendry@medtronic.com>
Co-authored-by: Andras Deak <deak.andris@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Please add this cool feature!
Projects
None yet
Development

No branches or pull requests

2 participants