Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pythia_datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env python3
# flake8: noqa
"""Top-level module for pythia-datasets ."""
from pkg_resources import DistributionNotFound, get_distribution
from importlib.metadata import version as _version

from .datasets import DATASETS, locate

try:
__version__ = get_distribution(__name__).version
except DistributionNotFound: # pragma: no cover
__version__ = _version(__name__)
except Exception: # pragma: no cover
# package is not installed
__version__ = 'unknown' # pragma: no cover
6 changes: 4 additions & 2 deletions pythia_datasets/datasets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pkg_resources
from importlib.resources import files

import pooch

DATASETS = pooch.create(
Expand All @@ -7,7 +8,8 @@
env='PYTHIA_DATASETS_DIR',
)

with pkg_resources.resource_stream('pythia_datasets', 'registry.txt') as registry_file:
ref = files('pythia_datasets').joinpath('registry.txt')
with ref.open('rb') as registry_file:
DATASETS.load_registry(registry_file)


Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ extend-ignore = E203,E501,E402,W605

[isort]
known_first_party=pythia_datasets
known_third_party=pkg_resources,pooch,setuptools
known_third_party=pooch,setuptools
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
Expand Down
Loading