Skip to content

Commit 6eaf2e1

Browse files
authored
Merge pull request #2634 from plotly/fix/#2631
Replace pkg_resources with importlib
2 parents 68bf290 + 003ebd5 commit 6eaf2e1

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
All notable changes to `dash` will be documented in this file.
33
This project adheres to [Semantic Versioning](https://semver.org/).
44

5+
## [UNRELEASED]
6+
7+
## Fixed
8+
9+
- [#2634](https://github.com/plotly/dash/pull/2634) Fix deprecation warning on pkg_resources, fix [#2631](https://github.com/plotly/dash/issues/2631)
10+
511
## [2.13.0] 2023-08-28
612
## Changed
713

dash/_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,3 +277,7 @@ def hooks_to_js_object(hooks: Union[RendererHooks, None]) -> str:
277277
hook_str = ",".join(f"{key}: {val}" for key, val in hooks.items())
278278

279279
return f"{{{hook_str}}}"
280+
281+
282+
def parse_version(version):
283+
return tuple(int(s) for s in version.split("."))

dash/dash.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
import flask
2222

23-
from pkg_resources import get_distribution, parse_version
23+
from importlib_metadata import version as _get_distribution_version
2424

2525
from dash import dcc
2626
from dash import html
@@ -54,6 +54,7 @@
5454
convert_to_AttributeDict,
5555
gen_salt,
5656
hooks_to_js_object,
57+
parse_version,
5758
)
5859
from . import _callback
5960
from . import _get_paths
@@ -567,7 +568,7 @@ def init_app(self, app=None, **kwargs):
567568
Compress(self.server)
568569

569570
_flask_compress_version = parse_version(
570-
get_distribution("flask-compress").version
571+
_get_distribution_version("flask_compress")
571572
)
572573

573574
if not hasattr(

0 commit comments

Comments
 (0)