diff --git a/CHANGELOG.md b/CHANGELOG.md index c8e5b18..b518edd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.12.3 + ++ Replace `resource_filename()` (from deprecated pkg_resources) with API from `importlib.resources` + ## 0.12.2 + Fix imports in module `sqlalchemy.quart` diff --git a/src/suou/__init__.py b/src/suou/__init__.py index b50bb02..eb8c0e3 100644 --- a/src/suou/__init__.py +++ b/src/suou/__init__.py @@ -38,7 +38,7 @@ from .http import WantsContentType from .color import OKLabColor, chalk, WebColor, RGBColor, LinearRGBColor, XYZColor, OKLCHColor from .mat import Matrix -__version__ = "0.12.2" +__version__ = "0.12.3" __all__ = ( 'ConfigOptions', 'ConfigParserConfigSource', 'ConfigSource', 'ConfigValue', diff --git a/src/suou/pkg_resources.py b/src/suou/pkg_resources.py new file mode 100644 index 0000000..1ad73c9 --- /dev/null +++ b/src/suou/pkg_resources.py @@ -0,0 +1,31 @@ +""" +Drop-in replacement for pkg_resources (kind of), using importlib.resources. + +*New in 0.12.3* + +--- + +Copyright (c) 2025 Sakuragasaki46. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +See LICENSE for the specific language governing permissions and +limitations under the License. + +This software is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +""" + + +from importlib.resources import files + +def resource_filename(package_name, resource_name: str) -> str: + """ + Backport of resource_filename() from pkg_resources, using importlib.resources + """ + return str(files(package_name) / resource_name) + + +__all__ = ( + 'resource_filename', +) \ No newline at end of file diff --git a/src/suou/sass.py b/src/suou/sass.py index 092179b..0a84a4b 100644 --- a/src/suou/sass.py +++ b/src/suou/sass.py @@ -1,5 +1,17 @@ """ + +--- + +Copyright (c) 2025 Sakuragasaki46. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +See LICENSE for the specific language governing permissions and +limitations under the License. + +This software is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. """ @@ -16,7 +28,7 @@ from .validators import must_be from .asgi import _MiddlewareFactory, ASGIApp, ASGIReceive, ASGIScope, ASGISend from . import __version__ as _suou_version -from pkg_resources import resource_filename +from .pkg_resources import resource_filename logger = logging.getLogger(__name__)