templateflow 24.2.1__tar.gz → 25.0.0__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.
Files changed (56) hide show
  1. templateflow-25.0.0/.circleci/config.yml +276 -0
  2. {templateflow-24.2.1 → templateflow-25.0.0}/.github/workflows/pythonpackage.yml +1 -1
  3. {templateflow-24.2.1 → templateflow-25.0.0}/.maint/update_requirements.py +3 -3
  4. {templateflow-24.2.1 → templateflow-25.0.0}/CHANGES.rst +13 -1
  5. {templateflow-24.2.1 → templateflow-25.0.0}/PKG-INFO +18 -12
  6. {templateflow-24.2.1 → templateflow-25.0.0}/docs/conf.py +1 -2
  7. {templateflow-24.2.1 → templateflow-25.0.0}/pyproject.toml +9 -7
  8. {templateflow-24.2.1 → templateflow-25.0.0}/templateflow/__init__.py +2 -0
  9. {templateflow-24.2.1 → templateflow-25.0.0}/templateflow/_loader.py +1 -0
  10. templateflow-25.0.0/templateflow/_version.py +34 -0
  11. {templateflow-24.2.1 → templateflow-25.0.0}/templateflow/api.py +13 -21
  12. {templateflow-24.2.1 → templateflow-25.0.0}/templateflow/cli.py +16 -21
  13. {templateflow-24.2.1 → templateflow-25.0.0}/templateflow/conf/__init__.py +20 -22
  14. {templateflow-24.2.1 → templateflow-25.0.0}/templateflow/conf/_s3.py +6 -5
  15. {templateflow-24.2.1 → templateflow-25.0.0}/templateflow/conf/bids.py +2 -3
  16. templateflow-25.0.0/templateflow/conf/templateflow-skel.md5 +1 -0
  17. templateflow-25.0.0/templateflow/conf/templateflow-skel.zip +0 -0
  18. {templateflow-24.2.1 → templateflow-25.0.0}/templateflow/tests/test_api.py +6 -10
  19. templateflow-25.0.0/templateflow/tests/test_cli.py +69 -0
  20. {templateflow-24.2.1/templateflow/conf → templateflow-25.0.0/templateflow}/tests/test_conf.py +23 -8
  21. templateflow-25.0.0/templateflow/tests/test_s3.py +89 -0
  22. {templateflow-24.2.1 → templateflow-25.0.0}/templateflow/tests/test_version.py +1 -0
  23. templateflow-24.2.1/.circleci/config.yml +0 -256
  24. templateflow-24.2.1/templateflow/_version.py +0 -16
  25. templateflow-24.2.1/templateflow/conf/templateflow-skel.md5 +0 -1
  26. templateflow-24.2.1/templateflow/conf/templateflow-skel.zip +0 -0
  27. templateflow-24.2.1/templateflow/conf/tests/test_s3.py +0 -74
  28. templateflow-24.2.1/templateflow/tests/__init__.py +0 -0
  29. templateflow-24.2.1/templateflow/tests/test_conf.py +0 -52
  30. {templateflow-24.2.1 → templateflow-25.0.0}/.gitattributes +0 -0
  31. {templateflow-24.2.1 → templateflow-25.0.0}/.github/workflows/codespell.yml +0 -0
  32. {templateflow-24.2.1 → templateflow-25.0.0}/.gitignore +0 -0
  33. {templateflow-24.2.1 → templateflow-25.0.0}/.gitmodules +0 -0
  34. {templateflow-24.2.1 → templateflow-25.0.0}/.maint/update_changes.sh +0 -0
  35. {templateflow-24.2.1 → templateflow-25.0.0}/.neurodebian/neurodebian.gpg +0 -0
  36. {templateflow-24.2.1 → templateflow-25.0.0}/.zenodo.json +0 -0
  37. {templateflow-24.2.1 → templateflow-25.0.0}/LICENSE +0 -0
  38. {templateflow-24.2.1 → templateflow-25.0.0}/README.rst +0 -0
  39. {templateflow-24.2.1 → templateflow-25.0.0}/codecov.yml +0 -0
  40. {templateflow-24.2.1 → templateflow-25.0.0}/docs/Makefile +0 -0
  41. {templateflow-24.2.1 → templateflow-25.0.0}/docs/_static/RTD-advanced-conf.png +0 -0
  42. {templateflow-24.2.1 → templateflow-25.0.0}/docs/_static/git.png +0 -0
  43. {templateflow-24.2.1 → templateflow-25.0.0}/docs/_templates/versions.html +0 -0
  44. {templateflow-24.2.1 → templateflow-25.0.0}/docs/api.rst +0 -0
  45. {templateflow-24.2.1 → templateflow-25.0.0}/docs/changes.rst +0 -0
  46. {templateflow-24.2.1 → templateflow-25.0.0}/docs/cli.rst +0 -0
  47. {templateflow-24.2.1 → templateflow-25.0.0}/docs/datalad.rst +0 -0
  48. {templateflow-24.2.1 → templateflow-25.0.0}/docs/environment.yml +0 -0
  49. {templateflow-24.2.1 → templateflow-25.0.0}/docs/examples.rst +0 -0
  50. {templateflow-24.2.1 → templateflow-25.0.0}/docs/index.rst +0 -0
  51. {templateflow-24.2.1 → templateflow-25.0.0}/docs/installation.rst +0 -0
  52. {templateflow-24.2.1 → templateflow-25.0.0}/docs/links.rst +0 -0
  53. {templateflow-24.2.1 → templateflow-25.0.0}/docs/reference/.gitignore +0 -0
  54. {templateflow-24.2.1 → templateflow-25.0.0}/templateflow/conf/config.json +0 -0
  55. {templateflow-24.2.1/templateflow/conf → templateflow-25.0.0/templateflow}/tests/__init__.py +0 -0
  56. {templateflow-24.2.1 → templateflow-25.0.0}/templateflow/tests/test_multiproc.py +0 -0
@@ -0,0 +1,276 @@
1
+ version: 2.1
2
+ orbs:
3
+ docker: circleci/docker@2.7.0
4
+ codecov: codecov/codecov@4.1.0
5
+ python: circleci/python@2.1.1
6
+
7
+ jobs:
8
+ build:
9
+ executor:
10
+ name: python/default
11
+ tag: '3.13'
12
+
13
+ # docker:
14
+ # - auth:
15
+ # username: $DOCKER_USERNAME
16
+ # password: $DOCKER_PASSWORD
17
+
18
+ steps:
19
+ - checkout
20
+ - run:
21
+ command: |
22
+ echo 'build' > requirements.txt
23
+ echo 'wheel' >> requirements.txt
24
+ echo 'twine' >> requirements.txt
25
+ - python/install-packages:
26
+ pkg-manager: pip
27
+ cache-version: build-v1
28
+ - run:
29
+ command: |
30
+ python -m build
31
+ python -m twine check dist/*
32
+ name: Test packaging
33
+ - persist_to_workspace:
34
+ root: ~/project
35
+ paths:
36
+ - .
37
+
38
+ deploy_pypi:
39
+ executor:
40
+ name: python/default
41
+ tag: '3.13'
42
+
43
+ # docker:
44
+ # - auth:
45
+ # username: $DOCKER_USERNAME
46
+ # password: $DOCKER_PASSWORD
47
+
48
+ steps:
49
+ - attach_workspace:
50
+ at: ~/project
51
+
52
+ - python/install-packages:
53
+ args: twine
54
+ pkg-manager: pip
55
+
56
+ - run:
57
+ command: python -m twine upload dist/*
58
+ name: Upload to Pypi
59
+
60
+ tests:
61
+ executor:
62
+ name: python/default
63
+ tag: '3.13'
64
+
65
+ # docker:
66
+ # - auth:
67
+ # username: $DOCKER_USERNAME
68
+ # password: $DOCKER_PASSWORD
69
+
70
+ environment:
71
+ - OSF_MIRROR_PATH: /tmp/data/templateflow
72
+ steps:
73
+ - run:
74
+ name: Configure git
75
+ command: |
76
+ git config --global user.name "First Last"
77
+ git config --global user.email "email@domain.com"
78
+
79
+ - attach_workspace:
80
+ at: ~/project
81
+
82
+ - run:
83
+ command: |
84
+ python .maint/update_requirements.py
85
+ echo git-annex >> dev-requirements.txt
86
+ name: Generate requirements.txt
87
+
88
+ - python/install-packages:
89
+ pip-dependency-file: dev-requirements.txt
90
+ pkg-manager: pip
91
+ cache-version: v1
92
+
93
+ - run:
94
+ name: Run tests (config and others)
95
+ command: |
96
+ python -m pytest \
97
+ --junit-xml=~/tests/conftests.xml --cov templateflow --cov-report xml:~/coverage/cov_config.xml \
98
+ templateflow/tests/
99
+
100
+ - codecov/upload:
101
+ file: ~/coverage/cov_config.xml
102
+ flags: config
103
+ upload_name: General
104
+
105
+ - run:
106
+ name: Run tests (w/ DataLad)
107
+ command: |
108
+ mkdir -p ~/tests/ ~/coverage/
109
+ export TEMPLATEFLOW_USE_DATALAD=on
110
+ python -m pytest \
111
+ --junit-xml=~/tests/datalad.xml --cov templateflow --doctest-modules \
112
+ templateflow/api.py
113
+
114
+ coverage run --append -m templateflow.cli config
115
+ coverage run --append -m templateflow.cli ls MNI152NLin2009cAsym --suffix T1w
116
+ coverage run --append -m templateflow.cli get MNI152NLin2009cAsym --suffix mask
117
+ coverage run --append -m templateflow.cli update
118
+ coverage xml -o ~/coverage/cov_api_dl.xml
119
+
120
+ - codecov/upload:
121
+ file: ~/coverage/cov_api_dl.xml
122
+ flags: api,datalad
123
+ upload_name: Datalad tests
124
+
125
+ - run:
126
+ name: Run tests (pulling from S3)
127
+ command: |
128
+ export TEMPLATEFLOW_USE_DATALAD=off
129
+ export TEMPLATEFLOW_HOME=$HOME/templateflow-s3
130
+ python -m pytest \
131
+ --junit-xml=~/tests/s3.xml --cov templateflow --doctest-modules templateflow/api.py
132
+
133
+ coverage run --append -m templateflow.cli config
134
+ coverage run --append -m templateflow.cli ls MNI152NLin2009cAsym --suffix T1w
135
+ coverage run --append -m templateflow.cli get MNI152NLin2009cAsym --suffix mask
136
+ coverage run --append -m templateflow.cli update
137
+ coverage xml -o ~/coverage/cov_api_s3.xml
138
+
139
+ - codecov/upload:
140
+ file: ~/coverage/cov_api_s3.xml
141
+ flags: api,s3
142
+ upload_name: S3 tests
143
+
144
+ - run:
145
+ name: Run tests (w/ DataLad, bypassed via S3)
146
+ command: |
147
+ export TEMPLATEFLOW_USE_DATALAD=off
148
+ export TEMPLATEFLOW_HOME=$HOME/templateflow-clean
149
+ datalad install -r -s https://github.com/templateflow/templateflow $TEMPLATEFLOW_HOME
150
+ python -m pytest \
151
+ --junit-xml=~/tests/dl+s3.xml --cov templateflow --cov-report xml:~/coverage/cov_api_dl_s3.xml \
152
+ --doctest-modules templateflow/api.py
153
+
154
+ - codecov/upload:
155
+ file: ~/coverage/cov_api_dl_s3.xml
156
+ flags: api,dls3
157
+ upload_name: Datalad-S3-bypass
158
+
159
+ - store_test_results:
160
+ path: ~/tests
161
+
162
+ build_docs:
163
+ machine:
164
+ # https://discuss.circleci.com/t/linux-machine-executor-images-2021-april-q2-update/39928
165
+ # upgrade Docker version
166
+ image: default
167
+ environment:
168
+ - FSLOUTPUTTYPE: NIFTI
169
+ - SUBJECTS_DIR: /tmp/subjects
170
+ steps:
171
+ - checkout
172
+ - restore_cache:
173
+ keys:
174
+ - env-v7-{{ .Branch }}
175
+ - env-v7-master
176
+ - env-v7-
177
+ - run:
178
+ name: Install base packages
179
+ command: |
180
+ export PATH="$HOME/.conda/bin:$PATH"
181
+ if ! [ -x "$(command -v curl)" ]; then
182
+ sudo apt-get update
183
+ sudo apt-get install -y --no-install-recommends curl
184
+ fi
185
+
186
+ if ! [ -x "$(command -v conda)" ]; then
187
+ curl -sSLO https://repo.anaconda.com/miniconda/Miniconda3-py39_4.11.0-Linux-x86_64.sh
188
+ bash Miniconda3-py39_4.11.0-Linux-x86_64.sh -b -p $HOME/.conda
189
+ fi
190
+ $HOME/.conda/bin/conda env update -f docs/environment.yml --prune
191
+
192
+ - save_cache:
193
+ key: env-v7-{{ .Branch }}
194
+ paths:
195
+ - ~/.conda
196
+
197
+ - run:
198
+ name: Check out git submodules
199
+ command: git submodule update --init
200
+ - run:
201
+ name: Create subjects folder
202
+ command: mkdir -p $SUBJECTS_DIR
203
+ - run:
204
+ name: Build only this commit
205
+ command: |
206
+ export PATH="$HOME/.conda/bin:$PATH"
207
+ python -m pip install -U build hatch hatchling
208
+ python -m hatch version
209
+ make -C docs SPHINXOPTS="-W" BUILDDIR="$HOME/html" CURBRANCH="${CIRCLE_TAG}" html
210
+ - store_artifacts:
211
+ path: ~/html
212
+
213
+ workflows:
214
+ version: 2
215
+ build_test_deploy:
216
+ jobs:
217
+ - build:
218
+ context:
219
+ - nipreps-common
220
+ filters:
221
+ branches:
222
+ ignore:
223
+ - /docs?\/.*/
224
+ tags:
225
+ only: /.*/
226
+
227
+ - tests:
228
+ context:
229
+ - nipreps-common
230
+ requires:
231
+ - build
232
+ filters:
233
+ branches:
234
+ ignore:
235
+ - /docs?\/.*/
236
+ tags:
237
+ only: /.*/
238
+
239
+ - deploy_pypi:
240
+ context:
241
+ - nipreps-common
242
+ requires:
243
+ - build
244
+ - tests
245
+ - build_docs
246
+ filters:
247
+ branches:
248
+ ignore: /.*/
249
+ tags:
250
+ only: /.*/
251
+
252
+ - build_docs:
253
+ filters:
254
+ branches:
255
+ ignore:
256
+ - /tests?\/.*/
257
+ tags:
258
+ only: /.*/
259
+
260
+ nightly:
261
+ triggers:
262
+ - schedule:
263
+ cron: "0 10 * * *"
264
+ filters:
265
+ branches:
266
+ only:
267
+ - master
268
+ jobs:
269
+ - build:
270
+ context:
271
+ - nipreps-common
272
+ - tests:
273
+ context:
274
+ - nipreps-common
275
+ requires:
276
+ - build
@@ -63,7 +63,7 @@ jobs:
63
63
  needs: build
64
64
  strategy:
65
65
  matrix:
66
- python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
66
+ python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
67
67
  mode: ['wheel']
68
68
  include:
69
69
  - {python-version: '3.11', mode: 'repo'}
@@ -16,13 +16,13 @@ min_reqs = repo_root / 'min-requirements.txt'
16
16
  reqs_dev = repo_root / 'dev-requirements.txt'
17
17
 
18
18
  requirements = [
19
- Requirement(req)
20
- for req in loads(pyproject.read_text())['project']['dependencies']
19
+ Requirement(req) for req in loads(pyproject.read_text())['project']['dependencies']
21
20
  ]
22
21
 
23
22
  requirements_dev = [
24
23
  Requirement(req)
25
- for req in loads(pyproject.read_text())['project']['optional-dependencies']['test']
24
+ for group in ('test', 'datalad')
25
+ for req in loads(pyproject.read_text())['project']['optional-dependencies'][group]
26
26
  ]
27
27
 
28
28
  script_name = Path(__file__).relative_to(repo_root)
@@ -1,8 +1,20 @@
1
- 24.2.1 (September 13, 2024)
1
+ 25.0.0 (August 12, 2025)
2
+ ========================
3
+ Minor release including updated templates.
4
+
5
+ * FIX: Fix crash in templateflow get when matching one file (#140)
6
+ * MAINT: Update Python support, datalad and git-annex deps (#143)
7
+
8
+ 24.2.2 (September 14, 2024)
2
9
  ===========================
3
10
  Patch release containing one bugfix and updating the default skeleton.
4
11
 
5
12
  * FIX: Avoid directory clobber during zip extraction (#131)
13
+ * MAINT: Overdue updates and revision of CircleCI (#136)
14
+
15
+ 24.2.1 (September 13, 2024; RECALLED)
16
+ =====================================
17
+ Release recalled because it was uploaded in a stale status of the client.
6
18
 
7
19
  24.2.0 (March 18, 2024)
8
20
  =======================
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: templateflow
3
- Version: 24.2.1
3
+ Version: 25.0.0
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
@@ -213,34 +213,36 @@ License-File: LICENSE
213
213
  Classifier: Development Status :: 3 - Alpha
214
214
  Classifier: Intended Audience :: Science/Research
215
215
  Classifier: License :: OSI Approved :: Apache Software License
216
- Classifier: Programming Language :: Python :: 3.8
217
216
  Classifier: Programming Language :: Python :: 3.9
218
217
  Classifier: Programming Language :: Python :: 3.10
219
218
  Classifier: Programming Language :: Python :: 3.11
220
219
  Classifier: Programming Language :: Python :: 3.12
220
+ Classifier: Programming Language :: Python :: 3.13
221
221
  Classifier: Topic :: Scientific/Engineering :: Image Recognition
222
- Requires-Python: >=3.8
222
+ Requires-Python: >=3.9
223
223
  Requires-Dist: importlib-resources>=5.7; python_version < '3.11'
224
224
  Requires-Dist: pybids>=0.15.2
225
225
  Requires-Dist: requests
226
226
  Requires-Dist: tqdm
227
227
  Provides-Extra: all
228
- Requires-Dist: coverage; extra == 'all'
229
- Requires-Dist: datalad~=0.19.0; extra == 'all'
228
+ Requires-Dist: coverage~=5.0.0; extra == 'all'
229
+ Requires-Dist: datalad>=1.0.0; extra == 'all'
230
230
  Requires-Dist: nbsphinx; extra == 'all'
231
231
  Requires-Dist: packaging; extra == 'all'
232
232
  Requires-Dist: pydot>=1.2.3; extra == 'all'
233
233
  Requires-Dist: pydotplus; extra == 'all'
234
234
  Requires-Dist: pytest; extra == 'all'
235
- Requires-Dist: pytest-cov==2.5.1; extra == 'all'
235
+ Requires-Dist: pytest-cov; extra == 'all'
236
+ Requires-Dist: pytest-env; extra == 'all'
236
237
  Requires-Dist: pytest-xdist; extra == 'all'
237
238
  Requires-Dist: sphinx-click; extra == 'all'
238
239
  Requires-Dist: sphinx-multiversion; extra == 'all'
239
240
  Requires-Dist: sphinx-rtd-theme>=0.4.3; extra == 'all'
240
241
  Requires-Dist: sphinxcontrib-apidoc; extra == 'all'
241
242
  Requires-Dist: sphinx~=4.0; extra == 'all'
243
+ Requires-Dist: toml; extra == 'all'
242
244
  Provides-Extra: datalad
243
- Requires-Dist: datalad~=0.19.0; extra == 'datalad'
245
+ Requires-Dist: datalad>=1.0.0; extra == 'datalad'
244
246
  Provides-Extra: doc
245
247
  Requires-Dist: nbsphinx; extra == 'doc'
246
248
  Requires-Dist: packaging; extra == 'doc'
@@ -262,15 +264,19 @@ Requires-Dist: sphinx-rtd-theme>=0.4.3; extra == 'docs'
262
264
  Requires-Dist: sphinxcontrib-apidoc; extra == 'docs'
263
265
  Requires-Dist: sphinx~=4.0; extra == 'docs'
264
266
  Provides-Extra: test
265
- Requires-Dist: coverage; extra == 'test'
267
+ Requires-Dist: coverage~=5.0.0; extra == 'test'
266
268
  Requires-Dist: pytest; extra == 'test'
267
- Requires-Dist: pytest-cov==2.5.1; extra == 'test'
269
+ Requires-Dist: pytest-cov; extra == 'test'
270
+ Requires-Dist: pytest-env; extra == 'test'
268
271
  Requires-Dist: pytest-xdist; extra == 'test'
272
+ Requires-Dist: toml; extra == 'test'
269
273
  Provides-Extra: tests
270
- Requires-Dist: coverage; extra == 'tests'
274
+ Requires-Dist: coverage~=5.0.0; extra == 'tests'
271
275
  Requires-Dist: pytest; extra == 'tests'
272
- Requires-Dist: pytest-cov==2.5.1; extra == 'tests'
276
+ Requires-Dist: pytest-cov; extra == 'tests'
277
+ Requires-Dist: pytest-env; extra == 'tests'
273
278
  Requires-Dist: pytest-xdist; extra == 'tests'
279
+ Requires-Dist: toml; extra == 'tests'
274
280
  Description-Content-Type: text/x-rst
275
281
 
276
282
  A Python client to query TemplateFlow
@@ -24,8 +24,7 @@ release = __version__
24
24
 
25
25
  # The short X.Y version
26
26
  version = (
27
- __version__ if Version(release).public == release
28
- else f"dev ({release.partition('+')[0]})"
27
+ __version__ if Version(release).public == release else f'dev ({release.partition("+")[0]})'
29
28
  )
30
29
 
31
30
  # -- General configuration ---------------------------------------------------
@@ -12,14 +12,14 @@ classifiers = [
12
12
  "Intended Audience :: Science/Research",
13
13
  "Topic :: Scientific/Engineering :: Image Recognition",
14
14
  "License :: OSI Approved :: Apache Software License",
15
- "Programming Language :: Python :: 3.8",
16
15
  "Programming Language :: Python :: 3.9",
17
16
  "Programming Language :: Python :: 3.10",
18
17
  "Programming Language :: Python :: 3.11",
19
18
  "Programming Language :: Python :: 3.12",
19
+ "Programming Language :: Python :: 3.13",
20
20
  ]
21
21
  license = {file = "LICENSE"}
22
- requires-python = ">=3.8"
22
+ requires-python = ">=3.9"
23
23
  dependencies = [
24
24
  "pybids >= 0.15.2",
25
25
  "importlib_resources >= 5.7; python_version < '3.11'",
@@ -37,13 +37,15 @@ Documentation = "https://www.templateflow.org/python-client/"
37
37
 
38
38
  [project.optional-dependencies]
39
39
  test = [
40
+ "coverage ~= 5.0.0",
40
41
  "pytest",
42
+ "pytest-cov",
43
+ "pytest-env",
41
44
  "pytest-xdist",
42
- "pytest-cov == 2.5.1",
43
- "coverage",
45
+ "toml",
44
46
  ]
45
47
  datalad = [
46
- "datalad ~= 0.19.0"
48
+ "datalad >= 1.0.0"
47
49
  ]
48
50
  doc = [
49
51
  "nbsphinx",
@@ -113,7 +115,7 @@ per-file-ignores = [
113
115
 
114
116
  [tool.pytest.ini_options]
115
117
  norecursedirs = [".git"]
116
- addopts = "-svx --doctest-modules"
118
+ addopts = "-svx"
117
119
  doctest_optionflags = "ALLOW_UNICODE NORMALIZE_WHITESPACE ELLIPSIS"
118
120
  env = "PYTHONHASHSEED=0"
119
121
  filterwarnings = ["ignore::DeprecationWarning"]
@@ -121,7 +123,7 @@ junit_family = "xunit2"
121
123
 
122
124
  [tool.coverage.run]
123
125
  branch = true
124
- concurrency = 'multiprocessing'
126
+ concurrency = ['multiprocessing']
125
127
  omit = [
126
128
  '*/tests/*',
127
129
  '*/conftest.py',
@@ -21,6 +21,7 @@
21
21
  # https://www.nipreps.org/community/licensing/
22
22
  #
23
23
  """TemplateFlow is the Zone of Templates."""
24
+
24
25
  from datetime import datetime as _dt
25
26
  from datetime import timezone as _tz
26
27
 
@@ -30,6 +31,7 @@ try:
30
31
  from ._version import __version__
31
32
  except ModuleNotFoundError:
32
33
  from importlib.metadata import PackageNotFoundError, version
34
+
33
35
  try:
34
36
  __version__ = version(__packagename__)
35
37
  except PackageNotFoundError:
@@ -24,6 +24,7 @@
24
24
 
25
25
  .. autoclass:: Loader
26
26
  """
27
+
27
28
  from __future__ import annotations
28
29
 
29
30
  import atexit
@@ -0,0 +1,34 @@
1
+ # file generated by setuptools-scm
2
+ # don't change, don't track in version control
3
+
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
12
+
13
+ TYPE_CHECKING = False
14
+ if TYPE_CHECKING:
15
+ from typing import Tuple
16
+ from typing import Union
17
+
18
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
20
+ else:
21
+ VERSION_TUPLE = object
22
+ COMMIT_ID = object
23
+
24
+ version: str
25
+ __version__: str
26
+ __version_tuple__: VERSION_TUPLE
27
+ version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
30
+
31
+ __version__ = version = '25.0.0'
32
+ __version_tuple__ = version_tuple = (25, 0, 0)
33
+
34
+ __commit_id__ = commit_id = None
@@ -21,6 +21,7 @@
21
21
  # https://www.nipreps.org/community/licensing/
22
22
  #
23
23
  """TemplateFlow's Python Client."""
24
+
24
25
  import sys
25
26
  from json import loads
26
27
  from pathlib import Path
@@ -35,9 +36,7 @@ from templateflow.conf import (
35
36
  requires_layout,
36
37
  )
37
38
 
38
- _layout_dir = tuple(
39
- item for item in dir(TF_LAYOUT) if item.startswith('get_')
40
- )
39
+ _layout_dir = tuple(item for item in dir(TF_LAYOUT) if item.startswith('get_'))
41
40
 
42
41
 
43
42
  @requires_layout
@@ -92,10 +91,9 @@ def ls(template, **kwargs):
92
91
  kwargs['extension'] = _normalize_ext(kwargs['extension'])
93
92
 
94
93
  return [
95
- Path(p) for p in TF_LAYOUT.get(
96
- template=Query.ANY if template is None else template,
97
- return_type='file',
98
- **kwargs
94
+ Path(p)
95
+ for p in TF_LAYOUT.get(
96
+ template=Query.ANY if template is None else template, return_type='file', **kwargs
99
97
  )
100
98
  ]
101
99
 
@@ -176,26 +174,20 @@ def get(template, raise_empty=False, **kwargs):
176
174
  not_fetched = [str(p) for p in out_file if not p.is_file() or p.stat().st_size == 0]
177
175
 
178
176
  if not_fetched:
179
- msg = 'Could not fetch template files: %s.' % ', '.join(not_fetched)
177
+ msg = 'Could not fetch template files: {}.'.format(', '.join(not_fetched))
180
178
  if dl_missing and not TF_USE_DATALAD:
181
- msg += (
182
- """\
183
- The $TEMPLATEFLOW_HOME folder %s seems to contain an initiated DataLad \
179
+ msg += f"""\
180
+ The $TEMPLATEFLOW_HOME folder {TF_LAYOUT.root} seems to contain an initiated DataLad \
184
181
  dataset, but the environment variable $TEMPLATEFLOW_USE_DATALAD is not \
185
182
  set or set to one of (false, off, 0). Please set $TEMPLATEFLOW_USE_DATALAD \
186
183
  on (possible values: true, on, 1)."""
187
- % TF_LAYOUT.root
188
- )
189
184
 
190
185
  if s3_missing and TF_USE_DATALAD:
191
- msg += (
192
- """\
193
- The $TEMPLATEFLOW_HOME folder %s seems to contain an plain \
186
+ msg += f"""\
187
+ The $TEMPLATEFLOW_HOME folder {TF_LAYOUT.root} seems to contain an plain \
194
188
  dataset, but the environment variable $TEMPLATEFLOW_USE_DATALAD is \
195
189
  set to one of (true, on, 1). Please set $TEMPLATEFLOW_USE_DATALAD \
196
190
  off (possible values: false, off, 0)."""
197
- % TF_LAYOUT.root
198
- )
199
191
 
200
192
  raise RuntimeError(msg)
201
193
 
@@ -251,7 +243,7 @@ def get_metadata(template):
251
243
 
252
244
  """
253
245
  tf_home = Path(TF_LAYOUT.root)
254
- filepath = tf_home / ('tpl-%s' % template) / 'template_description.json'
246
+ filepath = tf_home / (f'tpl-{template}') / 'template_description.json'
255
247
 
256
248
  # Ensure that template is installed and file is available
257
249
  if not filepath.is_file():
@@ -324,7 +316,7 @@ def _s3_get(filepath):
324
316
  path = filepath.relative_to(TF_LAYOUT.root).as_posix()
325
317
  url = f'{TF_S3_ROOT}/{path}'
326
318
 
327
- print('Downloading %s' % url, file=stderr)
319
+ print(f'Downloading {url}', file=stderr)
328
320
  # Streaming, so we can iterate over the response.
329
321
  r = requests.get(url, stream=True, timeout=TF_GET_TIMEOUT)
330
322
 
@@ -398,5 +390,5 @@ def _normalize_ext(value):
398
390
  return value
399
391
 
400
392
  if isinstance(value, str):
401
- return f"{'' if value.startswith('.') else '.'}{value}"
393
+ return f'{"" if value.startswith(".") else "."}{value}'
402
394
  return [_normalize_ext(v) for v in value]