Skip to content

Commit

Permalink
RF: Drop pkg_resources for Loader
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Oct 12, 2023
1 parent 6c945cf commit e8a5c10
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions templateflow/conf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
from pathlib import Path
from contextlib import suppress
from functools import wraps
from .._loader import Loader

load_data = Loader(__package__)

TF_DEFAULT_HOME = Path.home() / ".cache" / "templateflow"
TF_HOME = Path(getenv("TEMPLATEFLOW_HOME", str(TF_DEFAULT_HOME)))
Expand Down
9 changes: 4 additions & 5 deletions templateflow/conf/_s3.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
"""Tooling to handle S3 downloads."""
from pathlib import Path
from tempfile import mkstemp
from pkg_resources import resource_filename

from . import load_data

TF_SKEL_URL = (
"https://raw.githubusercontent.com/templateflow/python-client/"
"{release}/templateflow/conf/templateflow-skel.{ext}"
).format
TF_SKEL_PATH = Path(resource_filename("templateflow", "conf/templateflow-skel.zip"))
TF_SKEL_MD5 = Path(
resource_filename("templateflow", "conf/templateflow-skel.md5")
).read_text()
TF_SKEL_PATH = load_data("templateflow-skel.zip")
TF_SKEL_MD5 = load_data.readable("templateflow-skel.md5").read_text()


def update(dest, local=True, overwrite=True, silent=False):
Expand Down
5 changes: 3 additions & 2 deletions templateflow/conf/bids.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Extending pyBIDS for querying TemplateFlow."""
from pkg_resources import resource_filename
from bids.layout import BIDSLayout, add_config_paths

add_config_paths(templateflow=resource_filename("templateflow", "conf/config.json"))
from . import load_data

add_config_paths(templateflow=load_data("config.json"))


class Layout(BIDSLayout):
Expand Down

0 comments on commit e8a5c10

Please sign in to comment.