Skip to content

Commit 2bb4f12

Browse files
committed
Replace pkg_resources with importlib
1 parent 68bf290 commit 2bb4f12

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

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)