diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a64b1ad55..30bc58eed4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to `dash` will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/). +## [UNRELEASED] + +## Fixed + +- [#2634](https://github.com/plotly/dash/pull/2634) Fix deprecation warning on pkg_resources, fix [#2631](https://github.com/plotly/dash/issues/2631) + ## [2.13.0] 2023-08-28 ## Changed diff --git a/dash/_utils.py b/dash/_utils.py index d577c87997..2e9bc33a2d 100644 --- a/dash/_utils.py +++ b/dash/_utils.py @@ -277,3 +277,7 @@ def hooks_to_js_object(hooks: Union[RendererHooks, None]) -> str: hook_str = ",".join(f"{key}: {val}" for key, val in hooks.items()) return f"{{{hook_str}}}" + + +def parse_version(version): + return tuple(int(s) for s in version.split(".")) diff --git a/dash/dash.py b/dash/dash.py index 53fa00ec2e..608dac7511 100644 --- a/dash/dash.py +++ b/dash/dash.py @@ -20,7 +20,7 @@ import flask -from pkg_resources import get_distribution, parse_version +from importlib_metadata import version as _get_distribution_version from dash import dcc from dash import html @@ -54,6 +54,7 @@ convert_to_AttributeDict, gen_salt, hooks_to_js_object, + parse_version, ) from . import _callback from . import _get_paths @@ -567,7 +568,7 @@ def init_app(self, app=None, **kwargs): Compress(self.server) _flask_compress_version = parse_version( - get_distribution("flask-compress").version + _get_distribution_version("flask_compress") ) if not hasattr(