From b31cce76f72addaf53dbb3cd27fba099265df0e3 Mon Sep 17 00:00:00 2001 From: Bryan Forbes Date: Sun, 1 Dec 2019 20:50:00 -0600 Subject: [PATCH] Add typings --- .gitignore | 1 + mypy.ini | 16 ++++++++++++++++ pysblgnt/__init__.pyi | 15 +++++++++++++++ pysblgnt/py.typed | 0 setup.py | 3 ++- 5 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 mypy.ini create mode 100644 pysblgnt/__init__.pyi create mode 100644 pysblgnt/py.typed diff --git a/.gitignore b/.gitignore index ff06842..151303b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.egg-info/ __pycache__/ dist/ +.mypy_cache/ diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 0000000..d757794 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,16 @@ +[mypy] +incremental = True +warn_unused_configs = True +disallow_any_generics = True +disallow_subclassing_any = True +disallow_untyped_calls = True +disallow_untyped_defs = True +disallow_incomplete_defs = True +check_untyped_defs = True +disallow_untyped_decorators = True +no_implicit_optional = True +warn_redundant_casts = True +warn_unused_ignores = True +warn_return_any = True +no_implicit_reexport = True +disallow_any_unimported = True diff --git a/pysblgnt/__init__.pyi b/pysblgnt/__init__.pyi new file mode 100644 index 0000000..0578c8f --- /dev/null +++ b/pysblgnt/__init__.pyi @@ -0,0 +1,15 @@ +from typing import Any, Iterator +from typing_extensions import TypedDict + +_BaseRow = TypedDict('_BaseRow', { "ccat-pos": str, "ccat-parse": str }) + +class _MorphRow(_BaseRow): + bcv: str + robinson: str + text: str + word: str + norm: str + lemma: str + +def morphgnt_filename(book_num: int) -> str: ... +def morphgnt_rows(book_num: int) -> Iterator[_MorphRow]: ... diff --git a/pysblgnt/py.typed b/pysblgnt/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/setup.py b/setup.py index f7eecfc..a750b3d 100644 --- a/setup.py +++ b/setup.py @@ -8,6 +8,7 @@ url="https://github.com/morphgnt/py-sblgnt", author="James Tauber", author_email="jtauber@jtauber.com", + extras_require={"typings": ["typing_extensions>=3.7.4"]}, packages=["pysblgnt"], - package_data={"": ["sblgnt/*.txt"]}, + package_data={"": ["sblgnt/*.txt", "py.typed", "*.pyi"]}, )