Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace pkg_resources with importlib #2634

Merged
merged 2 commits into from Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
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
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