Skip to content

Commit

Permalink
Merge pull request #2634 from plotly/fix/#2631
Browse files Browse the repository at this point in the history
Replace pkg_resources with importlib
  • Loading branch information
T4rk1n authored Aug 29, 2023
2 parents 68bf290 + 003ebd5 commit 6eaf2e1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions dash/_utils.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 6eaf2e1

Please sign in to comment.