Skip to content

Commit 3c27bb5

Browse files
committed
remove last pkg_resources reference
1 parent ec9ce85 commit 3c27bb5

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

dash/development/component_generator.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
import argparse
99
import shutil
1010
import functools
11-
import pkg_resources
11+
import importlib.resources as importlib_resources
12+
1213
import yaml
1314

1415
from ._r_components_generation import write_class_file
@@ -57,7 +58,16 @@ def generate_components(
5758

5859
is_windows = sys.platform == "win32"
5960

60-
extract_path = pkg_resources.resource_filename("dash", "extract-meta.js")
61+
# Get path to extract-meta.js using importlib.resources
62+
try:
63+
# Python 3.9+
64+
extract_path = str(
65+
importlib_resources.files("dash").joinpath("extract-meta.js")
66+
)
67+
except AttributeError:
68+
# Python 3.8 fallback
69+
with importlib_resources.path("dash", "extract-meta.js") as p:
70+
extract_path = str(p)
6171

6272
reserved_patterns = "|".join(f"^{p}$" for p in reserved_words)
6373

0 commit comments

Comments
 (0)