Skip to content

Commit

Permalink
Add py.typed Marker (#2904)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people committed Jul 2, 2022
1 parent 7092937 commit 43d388b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
include LICENSE
recursive-exclude doc *.rst
recursive-exclude doc *.py
# Include type hinting files
global-include *.pyi
global-include *.typed
1 change: 1 addition & 0 deletions pyvista/py.typed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
partial\n
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
url='https://github.com/pyvista/pyvista',
keywords='vtk numpy plotting mesh',
package_data={
'pyvista': [
'py.typed',
],
'pyvista.examples': [
'airplane.ply',
'ant.ply',
Expand All @@ -84,4 +87,5 @@
'io': ['meshio>=5.2'],
'jupyter': ['ipyvtklink', 'pythreejs'],
},
zip_safe=False,
)

0 comments on commit 43d388b

Please sign in to comment.