From 2bb4f124147a0a0269bf5064e72c347812c4443d Mon Sep 17 00:00:00 2001 From: philippe Date: Tue, 29 Aug 2023 10:12:18 -0400 Subject: [PATCH 1/2] Replace pkg_resources with importlib --- dash/_utils.py | 4 ++++ dash/dash.py | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) 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( From 003ebd5cf4b47b7f0a9da7a6b27fc9cc2636fac9 Mon Sep 17 00:00:00 2001 From: philippe Date: Tue, 29 Aug 2023 11:17:59 -0400 Subject: [PATCH 2/2] Update changelog. --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) 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