templateflow 24.2.0__tar.gz → 24.2.2__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 (53) hide show
  1. {templateflow-24.2.0 → templateflow-24.2.2}/.circleci/config.yml +131 -109
  2. {templateflow-24.2.0 → templateflow-24.2.2}/.maint/update_requirements.py +3 -3
  3. {templateflow-24.2.0 → templateflow-24.2.2}/CHANGES.rst +11 -0
  4. {templateflow-24.2.0 → templateflow-24.2.2}/PKG-INFO +37 -7
  5. {templateflow-24.2.0 → templateflow-24.2.2}/pyproject.toml +7 -5
  6. {templateflow-24.2.0 → templateflow-24.2.2}/templateflow/__init__.py +4 -14
  7. {templateflow-24.2.0 → templateflow-24.2.2}/templateflow/_loader.py +1 -0
  8. {templateflow-24.2.0 → templateflow-24.2.2}/templateflow/_version.py +2 -2
  9. {templateflow-24.2.0 → templateflow-24.2.2}/templateflow/api.py +12 -16
  10. {templateflow-24.2.0 → templateflow-24.2.2}/templateflow/cli.py +15 -21
  11. {templateflow-24.2.0 → templateflow-24.2.2}/templateflow/conf/__init__.py +47 -30
  12. {templateflow-24.2.0 → templateflow-24.2.2}/templateflow/conf/_s3.py +23 -13
  13. {templateflow-24.2.0 → templateflow-24.2.2}/templateflow/conf/bids.py +2 -3
  14. templateflow-24.2.2/templateflow/conf/templateflow-skel.md5 +1 -0
  15. templateflow-24.2.2/templateflow/conf/templateflow-skel.zip +0 -0
  16. {templateflow-24.2.0 → templateflow-24.2.2}/templateflow/tests/test_api.py +3 -7
  17. {templateflow-24.2.0/templateflow/conf → templateflow-24.2.2/templateflow}/tests/test_conf.py +23 -8
  18. templateflow-24.2.2/templateflow/tests/test_multiproc.py +27 -0
  19. templateflow-24.2.2/templateflow/tests/test_s3.py +89 -0
  20. {templateflow-24.2.0 → templateflow-24.2.2}/templateflow/tests/test_version.py +1 -0
  21. templateflow-24.2.0/templateflow/conf/templateflow-skel.md5 +0 -1
  22. templateflow-24.2.0/templateflow/conf/templateflow-skel.zip +0 -0
  23. templateflow-24.2.0/templateflow/conf/tests/test_s3.py +0 -74
  24. templateflow-24.2.0/templateflow/tests/__init__.py +0 -0
  25. templateflow-24.2.0/templateflow/tests/test_conf.py +0 -52
  26. {templateflow-24.2.0 → templateflow-24.2.2}/.gitattributes +0 -0
  27. {templateflow-24.2.0 → templateflow-24.2.2}/.github/workflows/codespell.yml +0 -0
  28. {templateflow-24.2.0 → templateflow-24.2.2}/.github/workflows/pythonpackage.yml +0 -0
  29. {templateflow-24.2.0 → templateflow-24.2.2}/.gitignore +0 -0
  30. {templateflow-24.2.0 → templateflow-24.2.2}/.gitmodules +0 -0
  31. {templateflow-24.2.0 → templateflow-24.2.2}/.maint/update_changes.sh +0 -0
  32. {templateflow-24.2.0 → templateflow-24.2.2}/.neurodebian/neurodebian.gpg +0 -0
  33. {templateflow-24.2.0 → templateflow-24.2.2}/.zenodo.json +0 -0
  34. {templateflow-24.2.0 → templateflow-24.2.2}/LICENSE +0 -0
  35. {templateflow-24.2.0 → templateflow-24.2.2}/README.rst +0 -0
  36. {templateflow-24.2.0 → templateflow-24.2.2}/codecov.yml +0 -0
  37. {templateflow-24.2.0 → templateflow-24.2.2}/docs/Makefile +0 -0
  38. {templateflow-24.2.0 → templateflow-24.2.2}/docs/_static/RTD-advanced-conf.png +0 -0
  39. {templateflow-24.2.0 → templateflow-24.2.2}/docs/_static/git.png +0 -0
  40. {templateflow-24.2.0 → templateflow-24.2.2}/docs/_templates/versions.html +0 -0
  41. {templateflow-24.2.0 → templateflow-24.2.2}/docs/api.rst +0 -0
  42. {templateflow-24.2.0 → templateflow-24.2.2}/docs/changes.rst +0 -0
  43. {templateflow-24.2.0 → templateflow-24.2.2}/docs/cli.rst +0 -0
  44. {templateflow-24.2.0 → templateflow-24.2.2}/docs/conf.py +0 -0
  45. {templateflow-24.2.0 → templateflow-24.2.2}/docs/datalad.rst +0 -0
  46. {templateflow-24.2.0 → templateflow-24.2.2}/docs/environment.yml +0 -0
  47. {templateflow-24.2.0 → templateflow-24.2.2}/docs/examples.rst +0 -0
  48. {templateflow-24.2.0 → templateflow-24.2.2}/docs/index.rst +0 -0
  49. {templateflow-24.2.0 → templateflow-24.2.2}/docs/installation.rst +0 -0
  50. {templateflow-24.2.0 → templateflow-24.2.2}/docs/links.rst +0 -0
  51. {templateflow-24.2.0 → templateflow-24.2.2}/docs/reference/.gitignore +0 -0
  52. {templateflow-24.2.0 → templateflow-24.2.2}/templateflow/conf/config.json +0 -0
  53. {templateflow-24.2.0/templateflow/conf → templateflow-24.2.2/templateflow}/tests/__init__.py +0 -0
@@ -1,44 +1,85 @@
1
- version: 2
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
+
2
7
  jobs:
3
- tests:
4
- docker:
5
- - image: cimg/python:3.11
6
- auth:
7
- username: $DOCKER_USER
8
- password: $DOCKER_PAT
9
- working_directory: /tmp/tests
10
- environment:
11
- - OSF_MIRROR_PATH: /tmp/data/templateflow
12
- steps:
13
- - checkout:
14
- path: /tmp/src/templateflow
8
+ build:
9
+ executor:
10
+ name: python/default
11
+ tag: '3.12'
12
+
13
+ # docker:
14
+ # - auth:
15
+ # username: $DOCKER_USERNAME
16
+ # password: $DOCKER_PASSWORD
15
17
 
18
+ steps:
19
+ - checkout
16
20
  - run:
17
- name: Generate requirements.txt
18
21
  command: |
19
- python /tmp/src/templateflow/.maint/update_requirements.py
20
-
21
- - restore_cache:
22
- keys:
23
- - deps-v11-{{ checksum "/tmp/src/templateflow/dev-requirements.txt"}}-{{ epoch }}
24
- - deps-v11-{{ checksum "/tmp/src/templateflow/dev-requirements.txt"}}-
25
- - deps-v11-
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
26
28
  - run:
27
- name: Prepare environment
28
29
  command: |
29
- python -m venv /tmp/venv
30
- source /tmp/venv/bin/activate
31
- python -m pip install -U pip
32
- python -m pip install -r /tmp/src/templateflow/dev-requirements.txt
33
- python -m pip install -U "datalad ~= 0.19.0"
34
- python -m pip install -U build hatch twine pkginfo codecov
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.12'
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
35
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.12'
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
+ - restore_cache:
74
+ keys:
75
+ - annex-v1-{{ epoch }}
76
+ - annex-v1-
36
77
  - run:
37
78
  name: Install git and git-annex
38
79
  command: |
39
80
  if [[ ! -e "/tmp/cache/git-annex-standalone.tar.gz" ]]; then
40
81
  wget -O- http://neuro.debian.net/lists/focal.us-ca.full | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
41
- sudo apt-key add /tmp/src/templateflow/.neurodebian/neurodebian.gpg
82
+ sudo apt-key add .neurodebian/neurodebian.gpg
42
83
  sudo apt-key adv --recv-keys --keyserver hkps://keys.openpgp.org 0xA5D32F012649A5A9 || true
43
84
  sudo apt update && sudo apt-get install -y --no-install-recommends git-annex-standalone
44
85
  mkdir -p /tmp/cache
@@ -50,83 +91,80 @@ jobs:
50
91
  git config --global user.email "email@domain.com"
51
92
 
52
93
  - save_cache:
53
- key: deps-v11-{{ checksum "/tmp/src/templateflow/dev-requirements.txt"}}-{{ epoch }}
94
+ key: annex-v1-{{ epoch }}
54
95
  paths:
55
96
  - "/tmp/cache"
56
- - "/tmp/venv"
97
+
98
+ - attach_workspace:
99
+ at: ~/project
57
100
 
58
101
  - run:
59
- name: Test packaging
60
102
  command: |
61
- source /tmp/venv/bin/activate
62
- cd /tmp/src/templateflow
63
- python -m build
64
- python -m twine check dist/*
103
+ python .maint/update_requirements.py
104
+ name: Generate requirements.txt
105
+
106
+ - python/install-packages:
107
+ pip-dependency-file: dev-requirements.txt
108
+ pkg-manager: pip
109
+ cache-version: v1
65
110
 
66
111
  - run:
67
- name: Run tests (w/ DataLad)
112
+ name: Run tests (config and others)
68
113
  command: |
69
- source /tmp/venv/bin/activate
70
- export TEMPLATEFLOW_USE_DATALAD=on
71
- pytest --junit-xml=/tmp/tests/datalad.xml --cov templateflow --cov-report xml:/tmp/cov_api_dl.xml \
72
- --doctest-modules /tmp/src/templateflow/templateflow
114
+ python -m pytest \
115
+ --junit-xml=~/tests/conftests.xml --cov templateflow --cov-report xml:~/coverage/cov_config.xml \
116
+ templateflow/tests/
117
+
118
+ - codecov/upload:
119
+ file: ~/coverage/cov_config.xml
120
+ flags: config
121
+ upload_name: General
73
122
 
74
123
  - run:
75
- name: Submit api test coverage
124
+ name: Run tests (w/ DataLad)
76
125
  command: |
77
- source /tmp/venv/bin/activate
78
- codecov --file /tmp/cov_api_dl.xml --root /tmp/src/templateflow \
79
- --flags api,datalad -e CIRCLE_JOB
126
+ mkdir -p ~/tests/ ~/coverage/
127
+ export TEMPLATEFLOW_USE_DATALAD=on
128
+ python -m pytest \
129
+ --junit-xml=~/tests/datalad.xml --cov templateflow --cov-report xml:~/coverage/cov_api_dl.xml \
130
+ --doctest-modules templateflow/api.py
131
+
132
+ - codecov/upload:
133
+ file: ~/coverage/cov_api_dl.xml
134
+ flags: api,datalad
135
+ upload_name: Datalad tests
80
136
 
81
137
  - run:
82
138
  name: Run tests (pulling from S3)
83
139
  command: |
84
- source /tmp/venv/bin/activate
85
140
  export TEMPLATEFLOW_USE_DATALAD=off
86
141
  export TEMPLATEFLOW_HOME=$HOME/templateflow-s3
87
- pytest --junit-xml=/tmp/tests/s3.xml --cov templateflow --cov-report xml:/tmp/cov_api_s3.xml \
88
- --doctest-modules /tmp/src/templateflow/templateflow/api.py
142
+ python -m pytest \
143
+ --junit-xml=~/tests/s3.xml --cov templateflow --cov-report xml:~/coverage/cov_api_s3.xml \
144
+ --doctest-modules templateflow/api.py
89
145
 
90
- - run:
91
- name: Submit api test coverage
92
- command: |
93
- source /tmp/venv/bin/activate
94
- codecov --file /tmp/cov_api_s3.xml --root /tmp/src/templateflow \
95
- --flags api,s3 -e CIRCLE_JOB
146
+ - codecov/upload:
147
+ file: ~/coverage/cov_api_s3.xml
148
+ flags: api,s3
149
+ upload_name: S3 tests
96
150
 
97
151
  - run:
98
152
  name: Run tests (w/ DataLad, bypassed via S3)
99
153
  command: |
100
- source /tmp/venv/bin/activate
101
154
  export TEMPLATEFLOW_USE_DATALAD=off
102
155
  export TEMPLATEFLOW_HOME=$HOME/templateflow-clean
103
156
  datalad install -r -s https://github.com/templateflow/templateflow $TEMPLATEFLOW_HOME
104
- pytest --junit-xml=/tmp/tests/dl+s3.xml --cov templateflow --cov-report xml:/tmp/cov_api_dl_s3.xml \
105
- --doctest-modules /tmp/src/templateflow/templateflow/api.py
157
+ python -m pytest \
158
+ --junit-xml=~/tests/dl+s3.xml --cov templateflow --cov-report xml:~/coverage/cov_api_dl_s3.xml \
159
+ --doctest-modules templateflow/api.py
106
160
 
107
- - run:
108
- name: Submit api test coverage
109
- command: |
110
- source /tmp/venv/bin/activate
111
- codecov --file /tmp/cov_api_dl_s3.xml --root /tmp/src/templateflow \
112
- --flags api,dls3 -e CIRCLE_JOB
113
-
114
- - run:
115
- name: Run tests (config, parameterized TEMPLATEFLOW_USE_DATALAD)
116
- command: |
117
- source /tmp/venv/bin/activate
118
- pytest --junit-xml=/tmp/tests/conftests.xml --cov templateflow --cov-report xml:/tmp/cov_config.xml \
119
- /tmp/src/templateflow/templateflow/conf/tests/test_conf.py
120
-
121
- - run:
122
- name: Submit config test coverage
123
- command: |
124
- source /tmp/venv/bin/activate
125
- codecov --file /tmp/cov_config.xml --root /tmp/src/templateflow \
126
- --flags config -e CIRCLE_JOB
161
+ - codecov/upload:
162
+ file: ~/coverage/cov_api_dl_s3.xml
163
+ flags: api,dls3
164
+ upload_name: Datalad-S3-bypass
127
165
 
128
166
  - store_test_results:
129
- path: /tmp/tests
167
+ path: ~/tests
130
168
 
131
169
  build_docs:
132
170
  machine:
@@ -179,54 +217,38 @@ jobs:
179
217
  - store_artifacts:
180
218
  path: ~/html
181
219
 
182
- deploy_pypi:
183
- docker:
184
- - image: cimg/python:3.9
185
- working_directory: /tmp/src/templateflow
186
- steps:
187
- - attach_workspace:
188
- at: /tmp
189
-
190
- - checkout:
191
- path: /tmp/src/templateflow
192
-
193
- - run:
194
- name: Generate requirements.txt
195
- command: |
196
- python /tmp/src/templateflow/.maint/update_requirements.py
197
-
198
- - restore_cache:
199
- keys:
200
- - deps-v11-{{ checksum "/tmp/src/templateflow/dev-requirements.txt"}}-{{ epoch }}
201
- - deps-v11-{{ checksum "/tmp/src/templateflow/dev-requirements.txt"}}-
202
- - deps-v11-
203
-
204
- - run:
205
- name: Deploy to PyPi
206
- command: |
207
- source /tmp/venv/bin/activate
208
- python -m pip install build -U twine pkginfo
209
- python -m build
210
- python -m twine check dist/*
211
- python -m twine upload dist/*
212
-
213
220
  workflows:
214
221
  version: 2
215
222
  build_test_deploy:
216
223
  jobs:
224
+ - build:
225
+ context:
226
+ - nipreps-common
227
+ filters:
228
+ branches:
229
+ ignore:
230
+ - /docs?\/.*/
231
+ tags:
232
+ only: /.*/
233
+
217
234
  - tests:
218
235
  context:
219
236
  - nipreps-common
237
+ requires:
238
+ - build
220
239
  filters:
221
240
  branches:
222
241
  ignore:
223
242
  - /docs?\/.*/
224
243
  tags:
225
244
  only: /.*/
245
+
226
246
  - deploy_pypi:
227
247
  context:
228
248
  - nipreps-common
229
249
  requires:
250
+ - build
251
+ - tests
230
252
  - build_docs
231
253
  filters:
232
254
  branches:
@@ -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,3 +1,14 @@
1
+ 24.2.2 (September 14, 2024)
2
+ ===========================
3
+ Patch release containing one bugfix and updating the default skeleton.
4
+
5
+ * FIX: Avoid directory clobber during zip extraction (#131)
6
+ * MAINT: Overdue updates and revision of CircleCI (#136)
7
+
8
+ 24.2.1 (September 13, 2024; RECALLED)
9
+ =====================================
10
+ Release recalled because it was uploaded in a stale status of the client.
11
+
1
12
  24.2.0 (March 18, 2024)
2
13
  =======================
3
14
  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.0
3
+ Version: 24.2.2
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,9 +225,24 @@ Requires-Dist: pybids>=0.15.2
225
225
  Requires-Dist: requests
226
226
  Requires-Dist: tqdm
227
227
  Provides-Extra: all
228
- Requires-Dist: templateflow[datalad,doc,test]; extra == 'all'
228
+ Requires-Dist: coverage~=5.0.0; extra == 'all'
229
+ Requires-Dist: datalad~=1.0.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; extra == 'all'
236
+ Requires-Dist: pytest-env; extra == 'all'
237
+ Requires-Dist: pytest-xdist; extra == 'all'
238
+ Requires-Dist: sphinx-click; extra == 'all'
239
+ Requires-Dist: sphinx-multiversion; extra == 'all'
240
+ Requires-Dist: sphinx-rtd-theme>=0.4.3; extra == 'all'
241
+ Requires-Dist: sphinxcontrib-apidoc; extra == 'all'
242
+ Requires-Dist: sphinx~=4.0; extra == 'all'
243
+ Requires-Dist: toml; extra == 'all'
229
244
  Provides-Extra: datalad
230
- Requires-Dist: datalad~=0.19.0; extra == 'datalad'
245
+ Requires-Dist: datalad~=1.0.0; extra == 'datalad'
231
246
  Provides-Extra: doc
232
247
  Requires-Dist: nbsphinx; extra == 'doc'
233
248
  Requires-Dist: packaging; extra == 'doc'
@@ -239,14 +254,29 @@ Requires-Dist: sphinx-rtd-theme>=0.4.3; extra == 'doc'
239
254
  Requires-Dist: sphinxcontrib-apidoc; extra == 'doc'
240
255
  Requires-Dist: sphinx~=4.0; extra == 'doc'
241
256
  Provides-Extra: docs
242
- Requires-Dist: templateflow[doc]; extra == 'docs'
257
+ Requires-Dist: nbsphinx; extra == 'docs'
258
+ Requires-Dist: packaging; extra == 'docs'
259
+ Requires-Dist: pydot>=1.2.3; extra == 'docs'
260
+ Requires-Dist: pydotplus; extra == 'docs'
261
+ Requires-Dist: sphinx-click; extra == 'docs'
262
+ Requires-Dist: sphinx-multiversion; extra == 'docs'
263
+ Requires-Dist: sphinx-rtd-theme>=0.4.3; extra == 'docs'
264
+ Requires-Dist: sphinxcontrib-apidoc; extra == 'docs'
265
+ Requires-Dist: sphinx~=4.0; extra == 'docs'
243
266
  Provides-Extra: test
244
- Requires-Dist: coverage; extra == 'test'
267
+ Requires-Dist: coverage~=5.0.0; extra == 'test'
245
268
  Requires-Dist: pytest; extra == 'test'
246
- Requires-Dist: pytest-cov==2.5.1; extra == 'test'
269
+ Requires-Dist: pytest-cov; extra == 'test'
270
+ Requires-Dist: pytest-env; extra == 'test'
247
271
  Requires-Dist: pytest-xdist; extra == 'test'
272
+ Requires-Dist: toml; extra == 'test'
248
273
  Provides-Extra: tests
249
- Requires-Dist: templateflow[test]; extra == 'tests'
274
+ Requires-Dist: coverage~=5.0.0; extra == 'tests'
275
+ Requires-Dist: pytest; extra == 'tests'
276
+ Requires-Dist: pytest-cov; extra == 'tests'
277
+ Requires-Dist: pytest-env; extra == 'tests'
278
+ Requires-Dist: pytest-xdist; extra == 'tests'
279
+ Requires-Dist: toml; extra == 'tests'
250
280
  Description-Content-Type: text/x-rst
251
281
 
252
282
  A Python client to query TemplateFlow
@@ -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:
@@ -37,20 +39,8 @@ except ModuleNotFoundError:
37
39
  del version
38
40
  del PackageNotFoundError
39
41
 
40
- import os
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)
42
+ from templateflow import api
43
+ from templateflow.conf import update
54
44
 
55
45
  __all__ = [
56
46
  '__copyright__',
@@ -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
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '24.2.0'
16
- __version_tuple__ = version_tuple = (24, 2, 0)
15
+ __version__ = version = '24.2.2'
16
+ __version_tuple__ = version_tuple = (24, 2, 2)
@@ -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,25 +174,23 @@ 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
179
  msg += (
182
- """\
183
- The $TEMPLATEFLOW_HOME folder %s seems to contain an initiated DataLad \
180
+ f"""\
181
+ The $TEMPLATEFLOW_HOME folder {TF_LAYOUT.root} seems to contain an initiated DataLad \
184
182
  dataset, but the environment variable $TEMPLATEFLOW_USE_DATALAD is not \
185
183
  set or set to one of (false, off, 0). Please set $TEMPLATEFLOW_USE_DATALAD \
186
184
  on (possible values: true, on, 1)."""
187
- % TF_LAYOUT.root
188
185
  )
189
186
 
190
187
  if s3_missing and TF_USE_DATALAD:
191
188
  msg += (
192
- """\
193
- The $TEMPLATEFLOW_HOME folder %s seems to contain an plain \
189
+ f"""\
190
+ The $TEMPLATEFLOW_HOME folder {TF_LAYOUT.root} seems to contain an plain \
194
191
  dataset, but the environment variable $TEMPLATEFLOW_USE_DATALAD is \
195
192
  set to one of (true, on, 1). Please set $TEMPLATEFLOW_USE_DATALAD \
196
193
  off (possible values: false, off, 0)."""
197
- % TF_LAYOUT.root
198
194
  )
199
195
 
200
196
  raise RuntimeError(msg)
@@ -251,7 +247,7 @@ def get_metadata(template):
251
247
 
252
248
  """
253
249
  tf_home = Path(TF_LAYOUT.root)
254
- filepath = tf_home / ('tpl-%s' % template) / 'template_description.json'
250
+ filepath = tf_home / (f'tpl-{template}') / 'template_description.json'
255
251
 
256
252
  # Ensure that template is installed and file is available
257
253
  if not filepath.is_file():
@@ -324,7 +320,7 @@ def _s3_get(filepath):
324
320
  path = filepath.relative_to(TF_LAYOUT.root).as_posix()
325
321
  url = f'{TF_S3_ROOT}/{path}'
326
322
 
327
- print('Downloading %s' % url, file=stderr)
323
+ print(f'Downloading {url}', file=stderr)
328
324
  # Streaming, so we can iterate over the response.
329
325
  r = requests.get(url, stream=True, timeout=TF_GET_TIMEOUT)
330
326
 
@@ -21,6 +21,7 @@
21
21
  # https://www.nipreps.org/community/licensing/
22
22
  #
23
23
  """The TemplateFlow Python Client command-line interface (CLI)."""
24
+
24
25
  from __future__ import annotations
25
26
 
26
27
  import json
@@ -31,20 +32,20 @@ from click.decorators import FC, Option, _param_memo
31
32
 
32
33
  from templateflow import __package__, api
33
34
  from templateflow._loader import Loader as _Loader
34
- from templateflow.conf import TF_HOME, TF_USE_DATALAD
35
+ from templateflow.conf import TF_AUTOUPDATE, TF_HOME, TF_USE_DATALAD
35
36
 
36
37
  load_data = _Loader(__package__)
37
38
 
38
39
  ENTITY_SHORTHANDS = {
39
40
  # 'template': ('--tpl', '-t'),
40
- 'resolution': ('--res', ),
41
- 'density': ('--den', ),
42
- 'atlas': ('-a', ),
43
- 'suffix': ('-s', ),
41
+ 'resolution': ('--res',),
42
+ 'density': ('--den',),
43
+ 'atlas': ('-a',),
44
+ 'suffix': ('-s',),
44
45
  'desc': ('-d', '--description'),
45
46
  'extension': ('--ext', '-x'),
46
- 'label': ('-l', ),
47
- 'segmentation': ('--seg', ),
47
+ 'label': ('-l',),
48
+ 'segmentation': ('--seg',),
48
49
  }
49
50
  ENTITY_EXCLUDE = {'template', 'description'}
50
51
  TEMPLATE_LIST = api.get_templates()
@@ -57,16 +58,12 @@ def _nulls(s):
57
58
  def entity_opts():
58
59
  """Attaches all entities as options to the command."""
59
60
 
60
- entities = json.loads(
61
- Path(load_data('conf/config.json')).read_text()
62
- )['entities']
61
+ entities = json.loads(Path(load_data('conf/config.json')).read_text())['entities']
63
62
 
64
63
  args = [
65
- (
66
- f"--{e['name']}",
67
- *ENTITY_SHORTHANDS.get(e['name'], ())
68
- )
69
- for e in entities if e['name'] not in ENTITY_EXCLUDE
64
+ (f"--{e['name']}", *ENTITY_SHORTHANDS.get(e['name'], ()))
65
+ for e in entities
66
+ if e['name'] not in ENTITY_EXCLUDE
70
67
  ]
71
68
 
72
69
  def decorator(f: FC) -> FC:
@@ -91,6 +88,7 @@ def config():
91
88
 
92
89
  TEMPLATEFLOW_HOME={TF_HOME}
93
90
  TEMPLATEFLOW_USE_DATALAD={'on' if TF_USE_DATALAD else 'off'}
91
+ TEMPLATEFLOW_AUTOUPDATE={'on' if TF_AUTOUPDATE else 'off'}
94
92
  """)
95
93
 
96
94
 
@@ -134,9 +132,7 @@ def update(local, overwrite):
134
132
  def ls(template, **kwargs):
135
133
  """List the assets corresponding to template and optional filters."""
136
134
  entities = {k: _nulls(v) for k, v in kwargs.items() if v != ''}
137
- click.echo(
138
- '\n'.join(f'{match}' for match in api.ls(template, **entities))
139
- )
135
+ click.echo('\n'.join(f'{match}' for match in api.ls(template, **entities)))
140
136
 
141
137
 
142
138
  @main.command()
@@ -145,9 +141,7 @@ def ls(template, **kwargs):
145
141
  def get(template, **kwargs):
146
142
  """Fetch the assets corresponding to template and optional filters."""
147
143
  entities = {k: _nulls(v) for k, v in kwargs.items() if v != ''}
148
- click.echo(
149
- '\n'.join(f'{match}' for match in api.get(template, **entities))
150
- )
144
+ click.echo('\n'.join(f'{match}' for match in api.get(template, **entities)))
151
145
 
152
146
 
153
147
  if __name__ == '__main__':