Skip to content

Commit 83991d5

Browse files
authored
Merge branch 'main' into dependabot/pip/pybids-lte-0.17.2
2 parents 7465ae7 + 7cb7f67 commit 83991d5

37 files changed

+704
-445
lines changed

.circleci/config.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: 2.1
22
orbs:
3-
codecov: codecov/codecov@1.0.5
3+
codecov: codecov/codecov@3.2.4
44

55
jobs:
66
run_pytests:
@@ -9,7 +9,7 @@ jobs:
99
type: string
1010
default: "3.8"
1111
machine:
12-
image: ubuntu-2004:202201-02
12+
image: ubuntu-2404:2024.08.1
1313
working_directory: /home/circleci/src/CuBIDS
1414
steps:
1515
- checkout:
@@ -31,10 +31,8 @@ jobs:
3131
source activate cubids
3232
conda install -c conda-forge -y datalad
3333
34-
# Add nodejs and the validator
35-
conda install nodejs
36-
npm install -g yarn && \
37-
npm install -g bids-validator
34+
# Add deno to run the schema validator
35+
conda install deno
3836
3937
# Install CuBIDS
4038
pip install -e .[tests]
@@ -64,7 +62,8 @@ jobs:
6462
6563
# We need curl for the codecov upload
6664
apt-get update
67-
apt-get install -yqq curl
65+
apt-get install -y -qq curl
66+
apt-get install -y gnupg
6867
6968
cd /home/circleci/src/coverage/
7069
echo "Merge coverage files"
@@ -83,7 +82,7 @@ jobs:
8382

8483
deploy_pypi:
8584
machine:
86-
image: ubuntu-2004:202201-02
85+
image: ubuntu-2404:2024.08.1
8786
working_directory: /home/circleci/src/CuBIDS
8887
steps:
8988
- checkout:

cubids/cli.py

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def _parse_validate():
4343
type=PathExists,
4444
action="store",
4545
help=(
46-
"the root of a BIDS dataset. It should contain "
46+
"The root of a BIDS dataset. It should contain "
4747
"sub-X directories and dataset_description.json"
4848
),
4949
)
@@ -107,6 +107,41 @@ def _enter_validate(argv=None):
107107
workflows.validate(**args)
108108

109109

110+
def _parse_bids_version():
111+
parser = argparse.ArgumentParser(
112+
description="cubids bids-version: Get BIDS Validator and Schema version",
113+
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
114+
)
115+
PathExists = partial(_path_exists, parser=parser)
116+
117+
parser.add_argument(
118+
"bids_dir",
119+
type=PathExists,
120+
action="store",
121+
help=(
122+
"The root of a BIDS dataset. It should contain "
123+
"sub-X directories and dataset_description.json"
124+
),
125+
)
126+
parser.add_argument(
127+
"--write",
128+
action="store_true",
129+
default=False,
130+
help=(
131+
"Save the validator and schema version to 'dataset_description.json' "
132+
"when using `cubids bids-version /bids/path --write`. "
133+
"By default, `cubids bids-version /bids/path` prints to the terminal."
134+
),
135+
)
136+
return parser
137+
138+
139+
def _enter_bids_version(argv=None):
140+
options = _parse_bids_version().parse_args(argv)
141+
args = vars(options).copy()
142+
workflows.bids_version(**args)
143+
144+
110145
def _parse_bids_sidecar_merge():
111146
parser = argparse.ArgumentParser(
112147
description=("bids-sidecar-merge: merge critical keys from one sidecar to another"),
@@ -153,7 +188,7 @@ def _parse_group():
153188
type=PathExists,
154189
action="store",
155190
help=(
156-
"the root of a BIDS dataset. It should contain "
191+
"The root of a BIDS dataset. It should contain "
157192
"sub-X directories and dataset_description.json"
158193
),
159194
)
@@ -220,7 +255,7 @@ def _parse_apply():
220255
type=PathExists,
221256
action="store",
222257
help=(
223-
"the root of a BIDS dataset. It should contain "
258+
"The root of a BIDS dataset. It should contain "
224259
"sub-X directories and dataset_description.json"
225260
),
226261
)
@@ -230,7 +265,7 @@ def _parse_apply():
230265
action="store",
231266
help=(
232267
"path to the _summary.tsv that has been edited "
233-
"in the MergeInto and RenameKeyGroup columns. If the "
268+
"in the MergeInto and RenameEntitySet columns. If the "
234269
" summary table is located in the code/CuBIDS "
235270
"directory, then users can just pass the summary tsv "
236271
"filename instead of the full path to the tsv"
@@ -242,7 +277,7 @@ def _parse_apply():
242277
action="store",
243278
help=(
244279
"path to the _files.tsv that has been edited "
245-
"in the MergeInto and RenameKeyGroup columns. If the "
280+
"in the MergeInto and RenameEntitySet columns. If the "
246281
"files table is located in the code/CuBIDS "
247282
"directory, then users can just pass the files tsv "
248283
"filename instead of the full path to the tsv"
@@ -316,7 +351,7 @@ def _parse_datalad_save():
316351
type=PathExists,
317352
action="store",
318353
help=(
319-
"the root of a BIDS dataset. It should contain "
354+
"The root of a BIDS dataset. It should contain "
320355
"sub-X directories and dataset_description.json"
321356
),
322357
)
@@ -358,7 +393,7 @@ def _parse_undo():
358393
type=PathExists,
359394
action="store",
360395
help=(
361-
"the root of a BIDS dataset. It should contain "
396+
"The root of a BIDS dataset. It should contain "
362397
"sub-X directories and dataset_description.json"
363398
),
364399
)
@@ -582,7 +617,7 @@ def _parse_remove_metadata_fields():
582617
type=PathExists,
583618
action="store",
584619
help=(
585-
"the root of a BIDS dataset. It should contain "
620+
"The root of a BIDS dataset. It should contain "
586621
"sub-X directories and dataset_description.json"
587622
),
588623
)
@@ -628,7 +663,7 @@ def _parse_print_metadata_fields():
628663
type=PathExists,
629664
action="store",
630665
help=(
631-
"the root of a BIDS dataset. It should contain "
666+
"The root of a BIDS dataset. It should contain "
632667
"sub-X directories and dataset_description.json"
633668
),
634669
)
@@ -655,6 +690,7 @@ def _enter_print_metadata_fields(argv=None):
655690

656691
COMMANDS = [
657692
("validate", _parse_validate, workflows.validate),
693+
("bids-version", _parse_bids_version, workflows.bids_version),
658694
("sidecar-merge", _parse_bids_sidecar_merge, workflows.bids_sidecar_merge),
659695
("group", _parse_group, workflows.group),
660696
("apply", _parse_apply, workflows.apply),

cubids/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""Constants for CuBIDS."""
22

33
# Names of identifier variables.
4-
# Used to place KeyGroup and ParamGroup at the beginning of a dataframe,
4+
# Used to place EntitySet and ParamGroup at the beginning of a dataframe,
55
# but both are hardcoded in the relevant function.
6-
ID_VARS = set(["KeyGroup", "ParamGroup", "FilePath"])
6+
ID_VARS = set(["EntitySet", "ParamGroup", "FilePath"])
77
# Entities that should not be used to group parameter sets
88
NON_KEY_ENTITIES = set(["subject", "session", "extension"])
99
# Multi-dimensional keys SliceTiming XXX: what is this line about?

0 commit comments

Comments
 (0)