From 0f066eb3df92f73714eedf36f287839e993fa922 Mon Sep 17 00:00:00 2001 From: Dingyuan Wang Date: Sun, 31 Oct 2021 13:56:30 +0800 Subject: [PATCH 1/2] update version --- setup.py | 2 +- zhconv/zhconv.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 65c4a44..567f811 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ setup( name='zhconv', - version='1.4.2', + version='1.4.3', description="A simple implementation of Simplified-Traditional Chinese conversion.", long_description=LONGDESC, author='Dingyuan Wang', diff --git a/zhconv/zhconv.py b/zhconv/zhconv.py index 0a8d8e3..227d05d 100644 --- a/zhconv/zhconv.py +++ b/zhconv/zhconv.py @@ -22,7 +22,7 @@ """ # Only Python3 can pass the doctest here due to unicode problems. -__version__ = '1.4.2' +__version__ = '1.4.3' import os import sys From de9263590b17a167675f66f697a05962c9135b83 Mon Sep 17 00:00:00 2001 From: Seamile Date: Mon, 13 Oct 2025 21:31:40 +0800 Subject: [PATCH 2/2] refactor: replace deprecated pkg_resources with importlib.resources --- setup.py | 2 +- zhconv/zhconv.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 567f811..8298108 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ setup( name='zhconv', - version='1.4.3', + version='1.4.4', description="A simple implementation of Simplified-Traditional Chinese conversion.", long_description=LONGDESC, author='Dingyuan Wang', diff --git a/zhconv/zhconv.py b/zhconv/zhconv.py index 227d05d..11fbaa9 100644 --- a/zhconv/zhconv.py +++ b/zhconv/zhconv.py @@ -22,7 +22,7 @@ """ # Only Python3 can pass the doctest here due to unicode problems. -__version__ = '1.4.3' +__version__ = '1.4.4' import os import sys @@ -30,8 +30,12 @@ import json try: - from pkg_resources import resource_stream - get_module_res = lambda *res: resource_stream(__name__, os.path.join(*res)) + if sys.version_info >= (3, 9): + from importlib.resources import files + else: + from importlib_resources import files + + get_module_res = lambda *res: files(__name__).joinpath(*res).open('rb') except ImportError: get_module_res = lambda *res: open(os.path.normpath( os.path.join(os.getcwd(), os.path.dirname(__file__), *res)), 'rb')