From a445f61d4bf2ab30d9d3d6832cf6019744dba56f Mon Sep 17 00:00:00 2001
From: Martin Rys <martin@rys.rs>
Date: Mon, 3 Mar 2025 23:23:38 +0100
Subject: [PATCH] Add typing

---
 python/opencc/__init__.py | 4 ++--
 python/opencc/py.typed    | 0
 setup.py                  | 5 +++--
 3 files changed, 5 insertions(+), 4 deletions(-)
 create mode 100644 python/opencc/py.typed

diff --git a/python/opencc/__init__.py b/python/opencc/__init__.py
index 3884bdc7f..b1284bf42 100644
--- a/python/opencc/__init__.py
+++ b/python/opencc/__init__.py
@@ -29,7 +29,7 @@
     CONFIGS = []
 
 
-def _append_path_to_env(name, path):
+def _append_path_to_env(name: str, path: str) -> None:
     value = os.environ.get(name, '')
     if path in value:  # Path already exists
         return
@@ -42,7 +42,7 @@ def _append_path_to_env(name, path):
 
 class OpenCC(opencc_clib._OpenCC):
 
-    def __init__(self, config='t2s'):
+    def __init__(self, config: str = 't2s') -> None:
         if not config.endswith('.json'):
             config += '.json'
         if not os.path.isfile(config):
diff --git a/python/opencc/py.typed b/python/opencc/py.typed
new file mode 100644
index 000000000..e69de29bb
diff --git a/setup.py b/setup.py
index 9c67d8fde..d6b5b9055 100644
--- a/setup.py
+++ b/setup.py
@@ -181,7 +181,7 @@ def initialize_options(self):
     ext_modules=[OpenCCExtension('opencc.clib.opencc_clib', 'python')],
     cmdclass={
         'build_ext': BuildExtCommand,
-        'bdist_wheel': BDistWheelCommand
+        'bdist_wheel': BDistWheelCommand,
     },
     setup_requires=setup_requires,
 
@@ -200,7 +200,8 @@ def initialize_options(self):
         'Topic :: Software Development :: Libraries :: Python Modules',
         'Topic :: Software Development :: Localization',
         'Topic :: Text Processing :: Linguistic',
+        'Typing :: Typed',
     ],
     license='Apache License 2.0',
-    keywords=['opencc', 'convert', 'chinese']
+    keywords=['opencc', 'convert', 'chinese'],
 )