Skip to content

Commit 98dec8e

Browse files
committed
Use importlib.resources to load files
1 parent fdabf3b commit 98dec8e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

xarray/core/formatting_html.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
from collections import OrderedDict
33
from functools import lru_cache, partial
44
from html import escape
5-
6-
import pkg_resources
5+
from importlib import resources
76

87
from .formatting import inline_variable_array_repr, short_data_repr
98
from .options import _get_boolean_with_default
@@ -15,7 +14,7 @@
1514
def _load_static_files():
1615
"""Lazily load the resource files into memory the first time they are needed"""
1716
return [
18-
pkg_resources.resource_string("xarray", fname).decode("utf8")
17+
resources.files("xarray").joinpath(fname).read_bytes().decode("utf8")
1918
for fname in STATIC_FILES
2019
]
2120

0 commit comments

Comments
 (0)