Commit 81cc81a
authored
Make Rtree PEP 561-compliant, so that Mypy finds type hints (#243)
* Make Rtree PEP 561-compliant, so that Mypy finds type hints
After #215, I was excited to take advantage of type hints in my projects that
use Rtree. However, after upgrading to v1.0.0, mypy was giving [import
errors]. According to those docs, mypy will only infer/lookup types from
installed packages if they are [PEP 561] compliant.
Fortunately, all that seems to [involve] is the inclusion of a `py.typed` marker
file in the installed package. This PR is my attempt at doing just that. In my
local testing, this seems to resolve the above Mypy import warnings.
I'm new to setuptools and distributing sdist wheels though, so I'm not sure how
to confirm this file will be included in the built wheels? From reading the
[setuptools docs], I think this is right, but probably worth review from someone
who knows these things better.
[import errors]: https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
[PEP 561]: https://peps.python.org/pep-0561/
[involve]: https://mypy.readthedocs.io/en/stable/installed_packages.html#creating-pep-561-compatible-packages
[setuptools docs]: https://setuptools.pypa.io/en/latest/userguide/datafiles.html
* Remove explicit inclusion of py.typed in setup.cfg
It will already be included because we added it to MANIFEST.in, so listing it
here is redundant.
* prefer including py.typed via setuptools instead of MANIFEST.in afterall1 parent 35e9201 commit 81cc81a
2 files changed
+1
-1
lines changedWhitespace-only changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
0 commit comments