Add type annotations

`wheel` does not read from MANIFEST.in - the stub
and marker files need to also be added as
`package_data` in setup.py.
This commit is contained in:
layday 2020-09-22 15:09:37 +03:00
parent 73369b0ace
commit e0e4e345f6
4 changed files with 15 additions and 5 deletions

View File

@ -1,2 +1,2 @@
include LICENSE *.rst *.py cjellyfish/*.c cjellyfish/*.h docs/* testdata/*
include LICENSE *.rst *.py *.pyi py.typed cjellyfish/*.c cjellyfish/*.h docs/* testdata/*
global-exclude .git

11
jellyfish/__init__.pyi Normal file
View File

@ -0,0 +1,11 @@
def levenshtein_distance(s1: str, s2: str) -> int: ...
def jaro_similarity(s1: str, s2: str) -> float: ...
def jaro_winkler_similarity(s1: str, s2: str, long_tolerance: bool = ...) -> float: ...
def damerau_levenshtein_distance(s1: str, s2: str) -> int: ...
def soundex(s: str) -> str: ...
def hamming_distance(s1: str, s2: str) -> int: ...
def nysiis(s: str) -> str: ...
def match_rating_codex(s: str) -> str: ...
def match_rating_comparison(s1: str, s2: str) -> bool: ...
def metaphone(s: str) -> str: ...
def porter_stem(s: str) -> str: ...

0
jellyfish/py.typed Normal file
View File

View File

@ -80,8 +80,6 @@ class TestCommand(Command):
def run_setup(build_c):
kw = {}
if build_c:
kw = dict(
ext_modules=[
@ -103,10 +101,9 @@ def run_setup(build_c):
)
],
cmdclass=dict(build_ext=ve_build_ext, test=TestCommand),
packages=["jellyfish"],
)
else:
kw = dict(cmdclass=dict(test=TestCommand), packages=["jellyfish"])
kw = dict(cmdclass=dict(test=TestCommand))
with open("README.rst") as readme:
long_description = readme.read()
@ -135,6 +132,8 @@ def run_setup(build_c):
"Programming Language :: Python :: 3.9",
"Topic :: Text Processing :: Linguistic",
],
packages=["jellyfish"],
package_data={"jellyfish": ["*.pyi", "py.typed"]},
**kw
)