Development Status
- 5 - Production/Stable
Programming Language
- Python
- Python :: 3
- Python :: 3 :: Only
Topic
- Scientific/Engineering :: GIS
- Software Development :: Libraries
- Software Development :: Libraries :: Python Modules
PyShp-stubs
Overview
- This library is simply to indicate to type checkers that type hints should be included from PyShp's
single file module ("shapefile.py"), even e.g. when being run with
mypy --ignore-missing-imports. - This is a minimal library. As a wheel it solely consists of an empty
py.typedmarker file in a dir "shapefile-stubs". It contains no actual stubs (as they're not needed, the type hints are in the main library) - It is intended to be installed (into "Lib\site-packages") alongside the main PyShp repo (
pip install Pyshp[stubs]). - The main PyShp repo (from version 3 onwards) contains inline type hints, but is currently a single file module ("shapefile.py").
- PEP 561 states ""The single-file module should be refactored into a package". We respectfully disagree.
- If
py.typedis installed alongside "shapefile.py" in"Lib\site-packages", all packages installed in that (virtual) Python env will be typechecked by mypy, whether they contain type info or not Nominal type stubs for PyShp.
Description
PyShp 3 is statically typed. PyShp has historically been a single file library (shapefile.py).
According to PEP 561, and the spec in order to add a py.typed marker file (without indicating to type checkers that every package the user has installed adajacent to PyShp should also be type checked, regardless of whether all such packages support that or not), "The single-file module should be refactored into a package".
Myself and several other project contributers are reluctant to give up the single-file module (shapefile.py). We quite like it.
The purpose of this package is purely to indicate to type-checkers that PyShp is typed. It just so happens to be primarily typed in-line in the main library, from which the stubs in shapefile.pyi are largely automatically generated by MyPy's stubgen.