Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/pip/pybids-lte-0.17.2
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo authored Dec 13, 2024
2 parents 7465ae7 + 7cb7f67 commit 83991d5
Show file tree
Hide file tree
Showing 37 changed files with 704 additions and 445 deletions.
15 changes: 7 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2.1
orbs:
codecov: codecov/codecov@1.0.5
codecov: codecov/codecov@3.2.4

jobs:
run_pytests:
Expand All @@ -9,7 +9,7 @@ jobs:
type: string
default: "3.8"
machine:
image: ubuntu-2004:202201-02
image: ubuntu-2404:2024.08.1
working_directory: /home/circleci/src/CuBIDS
steps:
- checkout:
Expand All @@ -31,10 +31,8 @@ jobs:
source activate cubids
conda install -c conda-forge -y datalad
# Add nodejs and the validator
conda install nodejs
npm install -g yarn && \
npm install -g bids-validator
# Add deno to run the schema validator
conda install deno
# Install CuBIDS
pip install -e .[tests]
Expand Down Expand Up @@ -64,7 +62,8 @@ jobs:
# We need curl for the codecov upload
apt-get update
apt-get install -yqq curl
apt-get install -y -qq curl
apt-get install -y gnupg
cd /home/circleci/src/coverage/
echo "Merge coverage files"
Expand All @@ -83,7 +82,7 @@ jobs:

deploy_pypi:
machine:
image: ubuntu-2004:202201-02
image: ubuntu-2404:2024.08.1
working_directory: /home/circleci/src/CuBIDS
steps:
- checkout:
Expand Down
54 changes: 45 additions & 9 deletions cubids/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _parse_validate():
type=PathExists,
action="store",
help=(
"the root of a BIDS dataset. It should contain "
"The root of a BIDS dataset. It should contain "
"sub-X directories and dataset_description.json"
),
)
Expand Down Expand Up @@ -107,6 +107,41 @@ def _enter_validate(argv=None):
workflows.validate(**args)


def _parse_bids_version():
parser = argparse.ArgumentParser(
description="cubids bids-version: Get BIDS Validator and Schema version",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
PathExists = partial(_path_exists, parser=parser)

parser.add_argument(
"bids_dir",
type=PathExists,
action="store",
help=(
"The root of a BIDS dataset. It should contain "
"sub-X directories and dataset_description.json"
),
)
parser.add_argument(
"--write",
action="store_true",
default=False,
help=(
"Save the validator and schema version to 'dataset_description.json' "
"when using `cubids bids-version /bids/path --write`. "
"By default, `cubids bids-version /bids/path` prints to the terminal."
),
)
return parser


def _enter_bids_version(argv=None):
options = _parse_bids_version().parse_args(argv)
args = vars(options).copy()
workflows.bids_version(**args)


def _parse_bids_sidecar_merge():
parser = argparse.ArgumentParser(
description=("bids-sidecar-merge: merge critical keys from one sidecar to another"),
Expand Down Expand Up @@ -153,7 +188,7 @@ def _parse_group():
type=PathExists,
action="store",
help=(
"the root of a BIDS dataset. It should contain "
"The root of a BIDS dataset. It should contain "
"sub-X directories and dataset_description.json"
),
)
Expand Down Expand Up @@ -220,7 +255,7 @@ def _parse_apply():
type=PathExists,
action="store",
help=(
"the root of a BIDS dataset. It should contain "
"The root of a BIDS dataset. It should contain "
"sub-X directories and dataset_description.json"
),
)
Expand All @@ -230,7 +265,7 @@ def _parse_apply():
action="store",
help=(
"path to the _summary.tsv that has been edited "
"in the MergeInto and RenameKeyGroup columns. If the "
"in the MergeInto and RenameEntitySet columns. If the "
" summary table is located in the code/CuBIDS "
"directory, then users can just pass the summary tsv "
"filename instead of the full path to the tsv"
Expand All @@ -242,7 +277,7 @@ def _parse_apply():
action="store",
help=(
"path to the _files.tsv that has been edited "
"in the MergeInto and RenameKeyGroup columns. If the "
"in the MergeInto and RenameEntitySet columns. If the "
"files table is located in the code/CuBIDS "
"directory, then users can just pass the files tsv "
"filename instead of the full path to the tsv"
Expand Down Expand Up @@ -316,7 +351,7 @@ def _parse_datalad_save():
type=PathExists,
action="store",
help=(
"the root of a BIDS dataset. It should contain "
"The root of a BIDS dataset. It should contain "
"sub-X directories and dataset_description.json"
),
)
Expand Down Expand Up @@ -358,7 +393,7 @@ def _parse_undo():
type=PathExists,
action="store",
help=(
"the root of a BIDS dataset. It should contain "
"The root of a BIDS dataset. It should contain "
"sub-X directories and dataset_description.json"
),
)
Expand Down Expand Up @@ -582,7 +617,7 @@ def _parse_remove_metadata_fields():
type=PathExists,
action="store",
help=(
"the root of a BIDS dataset. It should contain "
"The root of a BIDS dataset. It should contain "
"sub-X directories and dataset_description.json"
),
)
Expand Down Expand Up @@ -628,7 +663,7 @@ def _parse_print_metadata_fields():
type=PathExists,
action="store",
help=(
"the root of a BIDS dataset. It should contain "
"The root of a BIDS dataset. It should contain "
"sub-X directories and dataset_description.json"
),
)
Expand All @@ -655,6 +690,7 @@ def _enter_print_metadata_fields(argv=None):

COMMANDS = [
("validate", _parse_validate, workflows.validate),
("bids-version", _parse_bids_version, workflows.bids_version),
("sidecar-merge", _parse_bids_sidecar_merge, workflows.bids_sidecar_merge),
("group", _parse_group, workflows.group),
("apply", _parse_apply, workflows.apply),
Expand Down
4 changes: 2 additions & 2 deletions cubids/constants.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Constants for CuBIDS."""

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

0 comments on commit 83991d5

Please sign in to comment.