ENH: Add stub file. - #104
Conversation
sabonerune
left a comment
There was a problem hiding this comment.
A simple type hint that's better than nothing.
| @@ -0,0 +1,399 @@ | |||
| from typing import Optional, Tuple | |||
There was a problem hiding this comment.
typing.Tuple is Deprecated.
However, removing this requires Python 3.9 (or maybe Python 3.7).
https://docs.python.org/3.13/library/typing.html#typing.Tuple
| cmdclass={'build_ext': build_ext}, | ||
| version=_VERSION, | ||
| packages=find_packages(), | ||
| package_data={"": ["py.typed", "*.pyi"]}, |
There was a problem hiding this comment.
If setuptools>=v69.0.0 this code is not needed.
https://setuptools.pypa.io/en/latest/history.html#id256
But this is only supported in Python >= 3.8.
There was a problem hiding this comment.
Typing of ndarrays is minimal.
It would be great if we could type hint it like this:
def synthesize(
f0: np.ndarray[tuple[int], np.dtype[np.double]],
spectrogram: np.ndarray[tuple[int, int], np.dtype[np.double]],
aperiodicity: np.ndarray[tuple[int, int], np.dtype[np.double]],
fs: int,
frame_period: float
) -> np.ndarray[tuple[int], np.dtype[np.double]]:...But this is probably supported in numpy>=1.22 and Python>=3.9.
Python 3.10 supports Numpy 1.21.6, so it wouldn't be easy to add it without dropping one of them.
- Add PEP 561 type stubs (pyworld/pyworld.pyi, pyworld/py.typed) and package_data in setup.py (#104, #105) - Migrate from pkg_resources to importlib.metadata with fallback (#99, #103) - Add Cython <3.1.0 constraint for Python <3.9 in pyproject.toml (#106) - Clean requirements.txt to core dependencies and update AppVeyor demo setup (#103) - Add sabonerune to README acknowledgements (#103)
* Update lib/World submodule to latest commit, bump version to 0.3.6, fix Cython syntax * Merge requests from open PRs (#96, #99, #103, #104, #105, #106) - Add PEP 561 type stubs (pyworld/pyworld.pyi, pyworld/py.typed) and package_data in setup.py (#104, #105) - Migrate from pkg_resources to importlib.metadata with fallback (#99, #103) - Add Cython <3.1.0 constraint for Python <3.9 in pyproject.toml (#106) - Clean requirements.txt to core dependencies and update AppVeyor demo setup (#103) - Add sabonerune to README acknowledgements (#103) * add 3.12 & 3.13 tests * Pin libsndfile version for Py 3.6/3.7 * Another attempt to fix 3.6/3.7
It's almost a copy of
pyworld.pyx.Features are minimal to support older Python and Numpy.