Skip to content

Commit

Permalink
ENH: use importlib to collect hg resources
Browse files Browse the repository at this point in the history
- importlib only available since python 3.9
- turn off tests for deprecated python 3.8
  • Loading branch information
kx79wq committed Dec 8, 2024
1 parent 055d1f4 commit 003b6f8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
python: ['3.9', '3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}

steps:
Expand Down
Empty file.
11 changes: 4 additions & 7 deletions histogrammar/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,19 @@


# Resources lookup file for histogrammar

import pathlib

ROOT_DIRECTORY = pathlib.Path(__file__).resolve().parent
from importlib import resources


# data files that are shipped with histogrammar.
_DATA = {
_.name: _
for _ in pathlib.Path(ROOT_DIRECTORY / "test_data").glob("*")
for _ in resources.files("histogrammar.test_data").iterdir()
}

# Tutorial notebooks
_NOTEBOOK = {
_.name: _
for _ in pathlib.Path(ROOT_DIRECTORY / "notebooks").glob("*.ipynb")
p.name: p
for p in resources.files("histogrammar.notebooks").iterdir() if p.suffix == ".ipynb"
}

# Resource types
Expand Down
Empty file.

0 comments on commit 003b6f8

Please sign in to comment.