Skip to content

Commit 690c542

Browse files
leewujungpre-commit-ci[bot]
authored andcommitted
Replace pkg_resources.resource_string with importlib.resources.files [all tests ci] (OSOceanAcoustics#1468)
* replace pkg_resources with importlib.resources * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * remove unused pkg_resources import * update __name__ to __package__ and use read_text * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * remove unused pkg_resources again * update whats new --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent e98e213 commit 690c542

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

docs/source/whats-new.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ This release includes the critical migration to use the new `xr.DataTree` functi
1919
## Bug and warning fixes
2020
* Assemble AD2CP timestamp with nanosecond precision by @leewujung in https://github.com/OSOceanAcoustics/echopype/pull/1436
2121
* Use `import_resources.files` instead of the legacy `open_text` by @leewujung in https://github.com/OSOceanAcoustics/echopype/pull/1434
22+
* Replace `pkg_resources.resource_string` with `importlib.resources.files` by @leewujung in https://github.com/OSOceanAcoustics/echopype/pull/1468
2223
* Fix invalid `\d` warning by using raw string by @leewujung in https://github.com/OSOceanAcoustics/echopype/pull/1448
2324
* Check if there exist any swap files before cleaning them up by @ctuguinay in https://github.com/OSOceanAcoustics/echopype/pull/1451
2425
* Remove `__setattr__` from EchoData by @leewujung in https://github.com/OSOceanAcoustics/echopype/pull/1457

echopype/echodata/widgets/widgets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import datetime
22
import html
33
from functools import lru_cache
4+
from importlib.resources import files
45
from pathlib import Path
56

6-
import pkg_resources
77
from jinja2 import Environment, FileSystemLoader, Template
88
from jinja2.exceptions import TemplateNotFound
99

@@ -36,7 +36,7 @@ def _load_static_files():
3636
"""Lazily load the resource files into memory the first time they are needed.
3737
Clone from xarray.core.formatted_html_template.
3838
"""
39-
return [pkg_resources.resource_string(__name__, fname).decode("utf8") for fname in STATIC_FILES]
39+
return [files(__package__).joinpath(fname).read_text(encoding="utf8") for fname in STATIC_FILES]
4040

4141

4242
def get_environment() -> Environment:

0 commit comments

Comments
 (0)