Skip to content

Commit 84cd7d1

Browse files
committed
Add Registry
1 parent 958985a commit 84cd7d1

11 files changed

+32
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,4 @@ dmypy.json
128128
# Pyre type checker
129129
.pyre/
130130
.vscode/
131+
temp_registry.txt

ci/environment.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,3 @@ dependencies:
77
- pooch
88
- pre-commit
99
- pytest-cov
10-
- rich
11-
- typer

make_registry.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import os
2+
import pathlib
3+
4+
import pooch
5+
6+
here = pathlib.Path(os.path.dirname(__file__))
7+
data_dir = here / 'data'
8+
9+
pooch.make_registry(data_dir, 'temp_registry.txt')

pythia_datasets/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"""Top-level module for pythia-datasets ."""
44
from pkg_resources import DistributionNotFound, get_distribution
55

6+
from .datasets import DATASETS
7+
68
try:
79
__version__ = get_distribution(__name__).version
810
except DistributionNotFound: # pragma: no cover

pythia_datasets/datasets.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import pkg_resources
2+
import pooch
3+
4+
DATASETS = pooch.create(
5+
path=pooch.os_cache('pythia-datasets'),
6+
base_url='https://github.com/ProjectPythia/pythia-datasets/raw/main/data/',
7+
env='PYTHIA_DATASETS_DIR',
8+
)
9+
10+
with pkg_resources.resource_stream('pythia_datasets', 'registry.txt') as registry_file:
11+
DATASETS.load_registry(registry_file)

pythia_datasets/registry.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
jan-17-co-asos.txt.xz c3b55b9ed67b3a3fa92636b139778e36240a09f8b6fc4d72526381b7673cc710

requirements.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
typer>=0.3
2-
rich>=9.10.0
31
pooch

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extend-ignore = E203,E501,E402,W605
88

99
[isort]
1010
known_first_party=pythia_datasets
11-
known_third_party=pkg_resources,setuptools
11+
known_third_party=pkg_resources,pooch,setuptools
1212
multi_line_output=3
1313
include_trailing_comma=True
1414
force_grid_wrap=0

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
long_description_content_type='text/markdown',
3232
long_description=long_description,
3333
include_package_data=True,
34+
package_data={'pythia_datasets': ['registry.txt']},
3435
keywords='Pythia, Pooch',
3536
name='pythia-datasets',
3637
packages=find_packages(include=['pythia_datasets', 'pythia_datasets.*']),

tests/test_dataset.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from pythia_datasets import DATASETS
2+
3+
4+
def test_registry():
5+
files = DATASETS.registry_files
6+
assert len(files) > 0

tests/test_sample.py

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)