templateflow 24.2.0__tar.gz → 24.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of templateflow might be problematic. Click here for more details.
- {templateflow-24.2.0 → templateflow-24.2.1}/CHANGES.rst +6 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/PKG-INFO +28 -4
- {templateflow-24.2.0 → templateflow-24.2.1}/templateflow/__init__.py +2 -14
- {templateflow-24.2.0 → templateflow-24.2.1}/templateflow/_version.py +2 -2
- {templateflow-24.2.0 → templateflow-24.2.1}/templateflow/cli.py +2 -1
- {templateflow-24.2.0 → templateflow-24.2.1}/templateflow/conf/__init__.py +27 -8
- {templateflow-24.2.0 → templateflow-24.2.1}/templateflow/conf/_s3.py +18 -9
- templateflow-24.2.1/templateflow/conf/templateflow-skel.md5 +1 -0
- templateflow-24.2.1/templateflow/conf/templateflow-skel.zip +0 -0
- templateflow-24.2.1/templateflow/tests/test_multiproc.py +27 -0
- templateflow-24.2.0/templateflow/conf/templateflow-skel.md5 +0 -1
- templateflow-24.2.0/templateflow/conf/templateflow-skel.zip +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/.circleci/config.yml +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/.gitattributes +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/.github/workflows/codespell.yml +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/.github/workflows/pythonpackage.yml +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/.gitignore +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/.gitmodules +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/.maint/update_changes.sh +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/.maint/update_requirements.py +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/.neurodebian/neurodebian.gpg +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/.zenodo.json +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/LICENSE +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/README.rst +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/codecov.yml +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/docs/Makefile +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/docs/_static/RTD-advanced-conf.png +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/docs/_static/git.png +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/docs/_templates/versions.html +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/docs/api.rst +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/docs/changes.rst +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/docs/cli.rst +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/docs/conf.py +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/docs/datalad.rst +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/docs/environment.yml +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/docs/examples.rst +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/docs/index.rst +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/docs/installation.rst +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/docs/links.rst +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/docs/reference/.gitignore +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/pyproject.toml +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/templateflow/_loader.py +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/templateflow/api.py +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/templateflow/conf/bids.py +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/templateflow/conf/config.json +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/templateflow/conf/tests/__init__.py +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/templateflow/conf/tests/test_conf.py +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/templateflow/conf/tests/test_s3.py +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/templateflow/tests/__init__.py +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/templateflow/tests/test_api.py +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/templateflow/tests/test_conf.py +0 -0
- {templateflow-24.2.0 → templateflow-24.2.1}/templateflow/tests/test_version.py +0 -0
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
24.2.1 (September 13, 2024)
|
|
2
|
+
===========================
|
|
3
|
+
Patch release containing one bugfix and updating the default skeleton.
|
|
4
|
+
|
|
5
|
+
* FIX: Avoid directory clobber during zip extraction (#131)
|
|
6
|
+
|
|
1
7
|
24.2.0 (March 18, 2024)
|
|
2
8
|
=======================
|
|
3
9
|
Minor release including a new command line interface for the Client.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: templateflow
|
|
3
|
-
Version: 24.2.
|
|
3
|
+
Version: 24.2.1
|
|
4
4
|
Summary: TemplateFlow Python Client - TemplateFlow is the Zone of neuroimaging templates.
|
|
5
5
|
Project-URL: Archive, https://github.com/templateflow/templateflow
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/templateflow/python-client/issues
|
|
@@ -225,7 +225,20 @@ Requires-Dist: pybids>=0.15.2
|
|
|
225
225
|
Requires-Dist: requests
|
|
226
226
|
Requires-Dist: tqdm
|
|
227
227
|
Provides-Extra: all
|
|
228
|
-
Requires-Dist:
|
|
228
|
+
Requires-Dist: coverage; extra == 'all'
|
|
229
|
+
Requires-Dist: datalad~=0.19.0; extra == 'all'
|
|
230
|
+
Requires-Dist: nbsphinx; extra == 'all'
|
|
231
|
+
Requires-Dist: packaging; extra == 'all'
|
|
232
|
+
Requires-Dist: pydot>=1.2.3; extra == 'all'
|
|
233
|
+
Requires-Dist: pydotplus; extra == 'all'
|
|
234
|
+
Requires-Dist: pytest; extra == 'all'
|
|
235
|
+
Requires-Dist: pytest-cov==2.5.1; extra == 'all'
|
|
236
|
+
Requires-Dist: pytest-xdist; extra == 'all'
|
|
237
|
+
Requires-Dist: sphinx-click; extra == 'all'
|
|
238
|
+
Requires-Dist: sphinx-multiversion; extra == 'all'
|
|
239
|
+
Requires-Dist: sphinx-rtd-theme>=0.4.3; extra == 'all'
|
|
240
|
+
Requires-Dist: sphinxcontrib-apidoc; extra == 'all'
|
|
241
|
+
Requires-Dist: sphinx~=4.0; extra == 'all'
|
|
229
242
|
Provides-Extra: datalad
|
|
230
243
|
Requires-Dist: datalad~=0.19.0; extra == 'datalad'
|
|
231
244
|
Provides-Extra: doc
|
|
@@ -239,14 +252,25 @@ Requires-Dist: sphinx-rtd-theme>=0.4.3; extra == 'doc'
|
|
|
239
252
|
Requires-Dist: sphinxcontrib-apidoc; extra == 'doc'
|
|
240
253
|
Requires-Dist: sphinx~=4.0; extra == 'doc'
|
|
241
254
|
Provides-Extra: docs
|
|
242
|
-
Requires-Dist:
|
|
255
|
+
Requires-Dist: nbsphinx; extra == 'docs'
|
|
256
|
+
Requires-Dist: packaging; extra == 'docs'
|
|
257
|
+
Requires-Dist: pydot>=1.2.3; extra == 'docs'
|
|
258
|
+
Requires-Dist: pydotplus; extra == 'docs'
|
|
259
|
+
Requires-Dist: sphinx-click; extra == 'docs'
|
|
260
|
+
Requires-Dist: sphinx-multiversion; extra == 'docs'
|
|
261
|
+
Requires-Dist: sphinx-rtd-theme>=0.4.3; extra == 'docs'
|
|
262
|
+
Requires-Dist: sphinxcontrib-apidoc; extra == 'docs'
|
|
263
|
+
Requires-Dist: sphinx~=4.0; extra == 'docs'
|
|
243
264
|
Provides-Extra: test
|
|
244
265
|
Requires-Dist: coverage; extra == 'test'
|
|
245
266
|
Requires-Dist: pytest; extra == 'test'
|
|
246
267
|
Requires-Dist: pytest-cov==2.5.1; extra == 'test'
|
|
247
268
|
Requires-Dist: pytest-xdist; extra == 'test'
|
|
248
269
|
Provides-Extra: tests
|
|
249
|
-
Requires-Dist:
|
|
270
|
+
Requires-Dist: coverage; extra == 'tests'
|
|
271
|
+
Requires-Dist: pytest; extra == 'tests'
|
|
272
|
+
Requires-Dist: pytest-cov==2.5.1; extra == 'tests'
|
|
273
|
+
Requires-Dist: pytest-xdist; extra == 'tests'
|
|
250
274
|
Description-Content-Type: text/x-rst
|
|
251
275
|
|
|
252
276
|
A Python client to query TemplateFlow
|
|
@@ -37,20 +37,8 @@ except ModuleNotFoundError:
|
|
|
37
37
|
del version
|
|
38
38
|
del PackageNotFoundError
|
|
39
39
|
|
|
40
|
-
import
|
|
41
|
-
|
|
42
|
-
from . import api
|
|
43
|
-
from .conf import TF_USE_DATALAD, update
|
|
44
|
-
|
|
45
|
-
if not TF_USE_DATALAD and os.getenv('TEMPLATEFLOW_AUTOUPDATE', '1') not in (
|
|
46
|
-
'false',
|
|
47
|
-
'off',
|
|
48
|
-
'0',
|
|
49
|
-
'no',
|
|
50
|
-
'n',
|
|
51
|
-
):
|
|
52
|
-
# trigger skeleton autoupdate
|
|
53
|
-
update(local=True, overwrite=False, silent=True)
|
|
40
|
+
from templateflow import api
|
|
41
|
+
from templateflow.conf import update
|
|
54
42
|
|
|
55
43
|
__all__ = [
|
|
56
44
|
'__copyright__',
|
|
@@ -31,7 +31,7 @@ from click.decorators import FC, Option, _param_memo
|
|
|
31
31
|
|
|
32
32
|
from templateflow import __package__, api
|
|
33
33
|
from templateflow._loader import Loader as _Loader
|
|
34
|
-
from templateflow.conf import TF_HOME, TF_USE_DATALAD
|
|
34
|
+
from templateflow.conf import TF_HOME, TF_USE_DATALAD, TF_AUTOUPDATE
|
|
35
35
|
|
|
36
36
|
load_data = _Loader(__package__)
|
|
37
37
|
|
|
@@ -91,6 +91,7 @@ def config():
|
|
|
91
91
|
|
|
92
92
|
TEMPLATEFLOW_HOME={TF_HOME}
|
|
93
93
|
TEMPLATEFLOW_USE_DATALAD={'on' if TF_USE_DATALAD else 'off'}
|
|
94
|
+
TEMPLATEFLOW_AUTOUPDATE={'on' if TF_AUTOUPDATE else 'off'}
|
|
94
95
|
""")
|
|
95
96
|
|
|
96
97
|
|
|
@@ -10,17 +10,36 @@ from .._loader import Loader
|
|
|
10
10
|
|
|
11
11
|
load_data = Loader(__package__)
|
|
12
12
|
|
|
13
|
+
|
|
14
|
+
def _env_to_bool(envvar: str, default: bool) -> bool:
|
|
15
|
+
"""Check for environment variable switches and convert to booleans."""
|
|
16
|
+
switches = {
|
|
17
|
+
'on': {'true', 'on', '1', 'yes', 'y'},
|
|
18
|
+
'off': {'false', 'off', '0', 'no', 'n'},
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
val = getenv(envvar, default)
|
|
22
|
+
if isinstance(val, str):
|
|
23
|
+
if val.lower() in switches['on']:
|
|
24
|
+
return True
|
|
25
|
+
elif val.lower() in switches['off']:
|
|
26
|
+
return False
|
|
27
|
+
else:
|
|
28
|
+
# TODO: Create templateflow logger
|
|
29
|
+
print(
|
|
30
|
+
f'{envvar} is set to unknown value <{val}>. '
|
|
31
|
+
f'Falling back to default value <{default}>'
|
|
32
|
+
)
|
|
33
|
+
return default
|
|
34
|
+
return bool(val)
|
|
35
|
+
|
|
36
|
+
|
|
13
37
|
TF_DEFAULT_HOME = Path.home() / '.cache' / 'templateflow'
|
|
14
38
|
TF_HOME = Path(getenv('TEMPLATEFLOW_HOME', str(TF_DEFAULT_HOME)))
|
|
15
39
|
TF_GITHUB_SOURCE = 'https://github.com/templateflow/templateflow.git'
|
|
16
40
|
TF_S3_ROOT = 'https://templateflow.s3.amazonaws.com'
|
|
17
|
-
TF_USE_DATALAD =
|
|
18
|
-
|
|
19
|
-
'on',
|
|
20
|
-
'1',
|
|
21
|
-
'yes',
|
|
22
|
-
'y',
|
|
23
|
-
)
|
|
41
|
+
TF_USE_DATALAD = _env_to_bool('TEMPLATEFLOW_USE_DATALAD', False)
|
|
42
|
+
TF_AUTOUPDATE = _env_to_bool('TEMPLATEFLOW_AUTOUPDATE', True)
|
|
24
43
|
TF_CACHED = True
|
|
25
44
|
TF_GET_TIMEOUT = 10
|
|
26
45
|
|
|
@@ -50,7 +69,7 @@ please set the TEMPLATEFLOW_HOME environment variable.""",
|
|
|
50
69
|
if not TF_USE_DATALAD:
|
|
51
70
|
from ._s3 import update as _update_s3
|
|
52
71
|
|
|
53
|
-
_update_s3(TF_HOME, local=True, overwrite=True)
|
|
72
|
+
_update_s3(TF_HOME, local=True, overwrite=TF_AUTOUPDATE, silent=True)
|
|
54
73
|
|
|
55
74
|
|
|
56
75
|
_init_cache()
|
|
@@ -80,23 +80,32 @@ def _update_skeleton(skel_file, dest, overwrite=True, silent=False):
|
|
|
80
80
|
dest = Path(dest)
|
|
81
81
|
dest.mkdir(exist_ok=True, parents=True)
|
|
82
82
|
with ZipFile(skel_file, 'r') as zipref:
|
|
83
|
+
allfiles = sorted(zipref.namelist())
|
|
84
|
+
|
|
83
85
|
if overwrite:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
newfiles = allfiles
|
|
87
|
+
else:
|
|
88
|
+
current_files = [s.relative_to(dest) for s in dest.glob('**/*')]
|
|
89
|
+
existing = sorted({'%s/' % s.parent for s in current_files}) + [
|
|
90
|
+
str(s) for s in current_files
|
|
91
|
+
]
|
|
92
|
+
newfiles = sorted(set(allfiles) - set(existing))
|
|
86
93
|
|
|
87
|
-
allfiles = zipref.namelist()
|
|
88
|
-
current_files = [s.relative_to(dest) for s in dest.glob('**/*')]
|
|
89
|
-
existing = sorted({'%s/' % s.parent for s in current_files}) + [
|
|
90
|
-
str(s) for s in current_files
|
|
91
|
-
]
|
|
92
|
-
newfiles = sorted(set(allfiles) - set(existing))
|
|
93
94
|
if newfiles:
|
|
94
95
|
if not silent:
|
|
95
96
|
print(
|
|
96
97
|
'Updating TEMPLATEFLOW_HOME using S3. Adding:\n%s'
|
|
97
98
|
% '\n'.join(newfiles)
|
|
98
99
|
)
|
|
99
|
-
|
|
100
|
+
for fl in newfiles:
|
|
101
|
+
localpath = dest / fl
|
|
102
|
+
if localpath.exists():
|
|
103
|
+
continue
|
|
104
|
+
try:
|
|
105
|
+
zipref.extract(fl, path=dest)
|
|
106
|
+
except FileExistsError:
|
|
107
|
+
# If there is a conflict, do not clobber
|
|
108
|
+
pass
|
|
100
109
|
return True
|
|
101
110
|
if not silent:
|
|
102
111
|
print('TEMPLATEFLOW_HOME directory (S3 type) was up-to-date.')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2c49f134299f66f514faa5dd8cf4b64f -
|
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from concurrent.futures import ProcessPoolExecutor
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
6
|
+
CPUs = os.cpu_count() or 1
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _update():
|
|
10
|
+
from templateflow.conf import update
|
|
11
|
+
|
|
12
|
+
update(local=False, overwrite=True, silent=True)
|
|
13
|
+
return True
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@pytest.mark.skipif(CPUs < 2, reason='At least 2 CPUs are required')
|
|
17
|
+
def test_multi_proc_update(tmp_path, monkeypatch):
|
|
18
|
+
tf_home = tmp_path / 'tf_home'
|
|
19
|
+
monkeypatch.setenv('TEMPLATEFLOW_HOME', str(tf_home))
|
|
20
|
+
|
|
21
|
+
futs = []
|
|
22
|
+
with ProcessPoolExecutor(max_workers=2) as executor:
|
|
23
|
+
for _ in range(2):
|
|
24
|
+
futs.append(executor.submit(_update))
|
|
25
|
+
|
|
26
|
+
for fut in futs:
|
|
27
|
+
assert fut.result()
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
c74b25eaf2c4fa57af51a2f7a3154725 -
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|