Skip to content

Commit 003b6f8

Browse files
author
kx79wq
committed
ENH: use importlib to collect hg resources
- importlib only available since python 3.9 - turn off tests for deprecated python 3.8
1 parent 055d1f4 commit 003b6f8

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
matrix:
1212
os: [ubuntu-latest]
13-
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
13+
python: ['3.9', '3.10', '3.11', '3.12']
1414
runs-on: ${{ matrix.os }}
1515

1616
steps:

histogrammar/notebooks/__init__.py

Whitespace-only changes.

histogrammar/resources.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,19 @@
1919

2020

2121
# Resources lookup file for histogrammar
22-
23-
import pathlib
24-
25-
ROOT_DIRECTORY = pathlib.Path(__file__).resolve().parent
22+
from importlib import resources
2623

2724

2825
# data files that are shipped with histogrammar.
2926
_DATA = {
3027
_.name: _
31-
for _ in pathlib.Path(ROOT_DIRECTORY / "test_data").glob("*")
28+
for _ in resources.files("histogrammar.test_data").iterdir()
3229
}
3330

3431
# Tutorial notebooks
3532
_NOTEBOOK = {
36-
_.name: _
37-
for _ in pathlib.Path(ROOT_DIRECTORY / "notebooks").glob("*.ipynb")
33+
p.name: p
34+
for p in resources.files("histogrammar.notebooks").iterdir() if p.suffix == ".ipynb"
3835
}
3936

4037
# Resource types

histogrammar/test_data/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)