Repository: jaraco/inflect (language: python)

Issue:
provide py.typed marker file
Mypy doesn't recognize that this library provides type annotations because it doesn't have a `py.typed` file. https://mypy.readthedocs.io/en/stable/installed_packages.html#making-pep-561-compatible-packages

> packages that supply type information via type comments or annotations in the code should put a `py.typed` file in their package directory.


Discussion / hints:

Fix patch:
diff --git a/CHANGES.rst b/CHANGES.rst
index 2e8587c..5ff696e 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,3 +1,8 @@
+v5.4.0
+======
+
+* #133: Add a ``py.typed`` file so mypy recognizes type annotations.
+
 v5.3.0
 ======
 
diff --git a/inflect.py b/inflect/__init__.py
similarity index 99%
rename from inflect.py
rename to inflect/__init__.py
index 4d21a34..c1b3101 100644
--- a/inflect.py
+++ b/inflect/__init__.py
@@ -50,7 +50,17 @@
 
 import ast
 import re
-from typing import Dict, Union, Optional, Iterable, List, Match, Tuple, Callable, Sequence
+from typing import (
+    Dict,
+    Union,
+    Optional,
+    Iterable,
+    List,
+    Match,
+    Tuple,
+    Callable,
+    Sequence,
+)
 
 
 class UnknownClassicalModeError(Exception):
@@ -846,12 +856,7 @@ def make_pl_si_lists(
 ) = make_pl_si_lists(pl_sb_U_man_mans_caps_list, "s", None, dojoinstem=False)
 
 # UNCONDITIONAL "..louse" -> "..lice"
-pl_sb_U_louse_lice_list = (
-    "booklouse",
-    "grapelouse",
-    "louse",
-    "woodlouse"
-)
+pl_sb_U_louse_lice_list = ("booklouse", "grapelouse", "louse", "woodlouse")
 
 (
     si_sb_U_louse_lice_list,
diff --git a/inflect/py.typed b/inflect/py.typed
new file mode 100644
index 0000000..e69de29
diff --git a/setup.cfg b/setup.cfg
index c6c752a..ec38b10 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -23,7 +23,6 @@ classifiers =
 [options]
 packages = find_namespace:
 include_package_data = true
-py_modules = inflect
 python_requires = >=3.6
 install_requires =
 setup_requires = setuptools_scm[toml] >= 3.4.1


Test patch:
diff --git a/tests/test_unicode.py b/tests/test_unicode.py
index 922d8ca..d864515 100644
--- a/tests/test_unicode.py
+++ b/tests/test_unicode.py
@@ -3,10 +3,10 @@
 
 
 class TestUnicode(unittest.TestCase):
-    """ Unicode compatibility test cases """
+    """Unicode compatibility test cases"""
 
     def test_unicode_plural(self):
-        """ Unicode compatibility test cases for plural """
+        """Unicode compatibility test cases for plural"""
         engine = inflect.engine()
         unicode_test_cases = {"cliché": "clichés", "ångström": "ångströms"}
         for singular, plural in unicode_test_cases.items():