Skip to content

Commit

Permalink
Replace pkg_resources with importlib
Browse files Browse the repository at this point in the history
  • Loading branch information
T4rk1n committed Aug 29, 2023
1 parent 68bf290 commit 2bb4f12
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions dash/_utils.py
Expand Up @@ -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("."))
5 changes: 3 additions & 2 deletions dash/dash.py
Expand Up @@ -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
Expand Down Expand Up @@ -54,6 +54,7 @@
convert_to_AttributeDict,
gen_salt,
hooks_to_js_object,
parse_version,
)
from . import _callback
from . import _get_paths
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 2bb4f12

Please sign in to comment.