diff --git a/scripts/update_bids.py b/scripts/update_bids.py index 26a59480..beef1606 100644 --- a/scripts/update_bids.py +++ b/scripts/update_bids.py @@ -133,7 +133,7 @@ def get_latest(versions: Iterable[BidsPathSpecFile]) -> tuple[str, BidsPathSpecF def main(): """update_bids entrypoint.""" - all_specs = list(get_specs()) + all_specs = sorted(get_specs(), key=lambda o: o["version"]) latest_version, latest_spec = get_latest(all_specs) generate_stub( specs, diff --git a/snakebids/paths/_config.py b/snakebids/paths/_config.py index c34ff1a4..fc059edd 100644 --- a/snakebids/paths/_config.py +++ b/snakebids/paths/_config.py @@ -18,7 +18,7 @@ # poetry run poe update-bids # -VALID_SPECS: TypeAlias = Literal["v0_11_0", "v0_0_0", "latest"] +VALID_SPECS: TypeAlias = Literal["v0_0_0", "v0_11_0", "latest"] # __all__ = ["set_bids_spec"] diff --git a/snakebids/paths/specs.py b/snakebids/paths/specs.py index 28011bc5..0f0ff435 100644 --- a/snakebids/paths/specs.py +++ b/snakebids/paths/specs.py @@ -15,8 +15,8 @@ # if not TYPE_CHECKING: __all__ = [ # noqa:F822 - "v0_11_0", "v0_0_0", + "v0_11_0", "latest", "LATEST", ] @@ -25,7 +25,7 @@ def __dir__(): return __all__ -_SPECS = ["v0_11_0", "v0_0_0"] +_SPECS = ["v0_0_0", "v0_11_0"] # LATEST = "v0_11_0" # diff --git a/snakebids/paths/specs.pyi b/snakebids/paths/specs.pyi index 421dac53..893b1578 100644 --- a/snakebids/paths/specs.pyi +++ b/snakebids/paths/specs.pyi @@ -7,27 +7,21 @@ from ._utils import BidsPathSpec LATEST: str -def v0_11_0(subject_dir: bool = True, session_dir: bool = True) -> BidsPathSpec: - """Spec corresponding to `BIDS v1.9.0`_. - - Significantly expanded from the v0.0.0 spec, now including long names for every - relevant entity. In addition to the official spec, it includes `from` and `to` - entities intended for transformations. Unknown entities are placed just before desc, - so that the description entity is always last. +def v0_0_0(subject_dir: bool = True, session_dir: bool = True) -> BidsPathSpec: + """Get the v0.0.0 BidsPathSpec. - .. _BIDS v1.9.0: https://bids-specification.readthedocs.io/en/v1.9.0/ + This spec alone equips :func:`~snakebids.bids` with 2 extra arguments: + ``include_subject_dir`` and ``include_session_dir``. These default to ``True``, but + if set ``False``, remove the subject and session dirs respectively from the output + path. For future specs, this behaviour should be achieved by modifying the spec and + generating a new :func:`~snakebids.bids` function Formatted as:: sub-{subject}/ses-{session}/{datatype}/{prefix}_sub-{subject}_ses-{session}_ - sample-{sample}_task-{task}_tracksys-{tracksys}_acq-{acquisition}_ - ce-{ceagent}_stain-{staining}_trc-{tracer}_rec-{reconstruction}_ - dir-{direction}_run-{run}_mod-{modality}_echo-{echo}_flip-{flip}_ - inv-{inversion}_mt-{mt}_proc-{processed}_part-{part}_space-{space}_ - atlas-{atlas}_seg-{segmentation}_hemi-{hemisphere}_res-{resolution}_ - den-{density}_roi-{roi}_from-{from}_to-{to}_split-{split}_ - recording-{recording}_chunk-{chunk}_model-{model}_subset-{subset}_ - label-{label}_..._desc-{description}_{suffix}{extension} + task-{task}_acq-{acq}_ce-{ce}_rec-{rec}_dir-{dir}_run-{run}_mod-{mod}_ + echo-{echo}_hemi-{hemi}_space-{space}_res-{res}_den-{den}_label-{label}_ + desc-{desc}_..._{suffix}{extension} Parameters @@ -41,21 +35,27 @@ def v0_11_0(subject_dir: bool = True, session_dir: bool = True) -> BidsPathSpec: """ ... -def v0_0_0(subject_dir: bool = True, session_dir: bool = True) -> BidsPathSpec: - """Get the v0.0.0 BidsPathSpec. +def v0_11_0(subject_dir: bool = True, session_dir: bool = True) -> BidsPathSpec: + """Spec corresponding to `BIDS v1.9.0`_. - This spec alone equips :func:`~snakebids.bids` with 2 extra arguments: - ``include_subject_dir`` and ``include_session_dir``. These default to ``True``, but - if set ``False``, remove the subject and session dirs respectively from the output - path. For future specs, this behaviour should be achieved by modifying the spec and - generating a new :func:`~snakebids.bids` function + Significantly expanded from the v0.0.0 spec, now including long names for every + relevant entity. In addition to the official spec, it includes `from` and `to` + entities intended for transformations. Unknown entities are placed just before desc, + so that the description entity is always last. + + .. _BIDS v1.9.0: https://bids-specification.readthedocs.io/en/v1.9.0/ Formatted as:: sub-{subject}/ses-{session}/{datatype}/{prefix}_sub-{subject}_ses-{session}_ - task-{task}_acq-{acq}_ce-{ce}_rec-{rec}_dir-{dir}_run-{run}_mod-{mod}_ - echo-{echo}_hemi-{hemi}_space-{space}_res-{res}_den-{den}_label-{label}_ - desc-{desc}_..._{suffix}{extension} + sample-{sample}_task-{task}_tracksys-{tracksys}_acq-{acquisition}_ + ce-{ceagent}_stain-{staining}_trc-{tracer}_rec-{reconstruction}_ + dir-{direction}_run-{run}_mod-{modality}_echo-{echo}_flip-{flip}_ + inv-{inversion}_mt-{mt}_proc-{processed}_part-{part}_space-{space}_ + atlas-{atlas}_seg-{segmentation}_hemi-{hemisphere}_res-{resolution}_ + den-{density}_roi-{roi}_from-{from}_to-{to}_split-{split}_ + recording-{recording}_chunk-{chunk}_model-{model}_subset-{subset}_ + label-{label}_..._desc-{description}_{suffix}{extension} Parameters