Skip to content

Commit

Permalink
[REL] v0.3.0 (#725)
Browse files Browse the repository at this point in the history
* update changelodg

* use deno validator

* do not validate during tests

* update doc

* update links in changelog

* add release protocol

* fix links

* fix
  • Loading branch information
Remi-Gau authored Sep 11, 2024
1 parent 745e8c2 commit 4e51aad
Show file tree
Hide file tree
Showing 18 changed files with 273 additions and 81 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/run_tests_matlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ jobs:
sudo apt-get -y -qq update
sudo apt-get -y install unzip wget
- name: Install Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Install bids validator
run: npm install -g bids-validator

run: deno install -Agf -n bids-validator jsr:@bids/validator

- name: Install bids example
run: |
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/run_tests_octave.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ jobs:
sudo apt-get -y -qq update
sudo apt-get -y install unzip wget
- name: Install Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Install bids validator
run: npm install -g bids-validator
run: deno install -Agf -n bids-validator jsr:@bids/validator

- name: Install bids-example
run: |
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cff-version: 1.2.0

title: bids-matlab

version: 0.2.0
version: 0.3.0

license: MIT

Expand Down
22 changes: 22 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,25 @@ make update_schema
A new version of the schema is fetched automatically regularly via continuous integration
(see the [github action](.github/workflows/update_schema.yml)) when pushing to the repo
or opening a pull-request.

## release protocol

- [ ] create a dedicated branch for the release candidate
- [ ] update version in `citation.cff`
- [ ] documentation related
- [ ] ensure the documentation is up to date
- [ ] make sure the doc builds correctly and fix any error
- [ ] update jupyter books
- [ ] update binder
- [ ] update changelog
- [ ] change from `[unreleased]` to the version number
- [ ] remove unused sections (like `security`)
- [ ] run `make release`
- [ ] open a pull request (PR) from this release candidate branch targeting the default branch
- [ ] fix any remaining failing continuous integration (test, markdown and code linting...)
- [ ] merge to default branch
- [ ] create a github tagged release
- [ ] after release
- [ ] set version in `citation.cff` to dev
- [ ] update changelog
- [ ] add an `[unreleased]` section
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
.PHONY: clean manual
.PHONY: clean manual

clean:
rm version.txt

version.txt: clean CITATION.cff
grep -w "^version" CITATION.cff | sed "s/version: /v/g" > version.txt

manual:
cd docs && sh create_manual.sh

update_schema:
wget https://bids-specification.readthedocs.io/en/latest/schema.json -O schema.json
# get schema from a PR on the spec
# wget https://bids-specification--1377.org.readthedocs.build/en/1377/schema.json -O schema.json

release: version.txt
python docs/generate_doc.py
python docs/add_links_to_changelog.py
Binary file added docs/__pycache__/utils.cpython-312.pyc
Binary file not shown.
28 changes: 28 additions & 0 deletions docs/add_links_to_changelog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# replace PR numbers and github usernames with links
from __future__ import annotations

import re

from utils import root_dir

change_log = root_dir() / "docs" / "source" / "changelog.md"

with open(change_log) as f:
lines = f.readlines()

with open(change_log, "w") as f:
for line in lines:
if match := re.search(r" @([a-zA-Z0-9_\-]+)", line):
username = match[1]
line = line.replace(
match[0], f" by [{username}](https://github.com/{username}) "
)

if match := re.search(r"\#([0-9]+)", line):
pr_number = match[1]
line = line.replace(
match[0],
f"[{pr_number}](https://github.com/bids-standard/bids-matlab/pull/{pr_number})",
)

f.write(line)
Binary file removed docs/bids-matlab.pdf
Binary file not shown.
5 changes: 0 additions & 5 deletions docs/create_manual.sh

This file was deleted.

207 changes: 178 additions & 29 deletions docs/source/changelog.md

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions docs/source/dev_doc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ developer documentation
.. autofunction:: +bids.+internal.keep_file_for_query
.. _list_all_trial_types:
.. autofunction:: +bids.+internal.list_all_trial_types
.. _list_events:
.. autofunction:: +bids.+internal.list_events
.. _match_structure_fields:
.. autofunction:: +bids.+internal.match_structure_fields
.. _nansum:
.. autofunction:: +bids.+internal.nansum
.. _parse_filename:
.. autofunction:: +bids.+internal.parse_filename
.. _plot_diagnostic_table:
Expand All @@ -54,6 +58,8 @@ developer documentation
.. autofunction:: +bids.+internal.regexify
.. _replace_placeholders:
.. autofunction:: +bids.+internal.replace_placeholders
.. _resolve_bids_uri:
.. autofunction:: +bids.+internal.resolve_bids_uri
.. _return_file_index:
.. autofunction:: +bids.+internal.return_file_index
.. _return_file_info:
Expand Down
8 changes: 8 additions & 0 deletions docs/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from __future__ import annotations

from pathlib import Path


def root_dir() -> Path:
"""Return path to root directory."""
return Path(__file__).parent.parent
10 changes: 0 additions & 10 deletions tests/tests_utils/test_create_participants_tsv.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@ function test_create_participants_tsv_basic()
bids_path = fullfile(bids_path, 'asl001');
end

validate_dataset(bids_path);

output_filename = bids.util.create_participants_tsv(bids_path, 'verbose', false);

participants = bids.util.tsvread(output_filename);
assertEqual(participants.participant_id, {'sub-Sub103'});

validate_dataset(bids_path);

delete(output_filename);

end
Expand All @@ -34,20 +30,14 @@ function test_create_participants_tsv_already_exist()
skip_if_octave('mixed-string-concat warning thrown');

bids_path = temp_dir();

copyfile(fullfile(get_test_data_dir(), 'ds210'), bids_path);

if bids.internal.is_octave
bids_path = fullfile(bids_path, 'ds210');
end

output_filename = bids.util.create_participants_tsv(bids_path);

validate_dataset(bids_path);

assertWarning(@()bids.util.create_participants_tsv(bids_path, 'verbose', true), ...
'create_participants_tsv:participantFileExist');

delete(output_filename);

end
15 changes: 8 additions & 7 deletions tests/tests_utils/test_create_readme.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@

function test_create_readme_basic()

bids_path = fullfile(get_test_data_dir(), 'ds210');

validate_dataset(bids_path);
source_ds = fullfile(get_test_data_dir(), 'ds210');
tmp_path = temp_dir();
copyfile(source_ds, tmp_path);
if bids.internal.is_octave()
bids_path = fullfile(tmp_path, 'ds210');
else
bids_path = tmp_path;
end

bids.util.create_readme(bids_path, false, ...
'tolerant', true, ...
'verbose', false);

assertEqual(exist(fullfile(bids_path, 'README.md'), 'file'), 2);

validate_dataset(bids_path);

delete(fullfile(bids_path, 'README.md'));

end

function test_create_readme_warning_already_present()
Expand Down
8 changes: 0 additions & 8 deletions tests/tests_utils/test_create_scans_tsv.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,13 @@ function test_create_scans_tsv_basic_no_session()
bids_path = tmp_path;
end

validate_dataset(bids_path);

output_filenames = bids.util.create_scans_tsv(bids_path, 'verbose', false);

assertEqual(numel(output_filenames), 1);
assertEqual(exist(fullfile(bids_path, output_filenames{1}), 'file'), 2);
content = bids.util.tsvread(fullfile(bids_path, output_filenames{1}));
assertEqual(fieldnames(content), {'filename'; 'acq_time'; 'comments'});

validate_dataset(bids_path);

end

function test_create_scans_tsv_basic()
Expand All @@ -41,15 +37,11 @@ function test_create_scans_tsv_basic()
bids_path = tmp_path;
end

validate_dataset(bids_path);

output_filenames = bids.util.create_scans_tsv(bids_path, 'verbose', false);

assertEqual(numel(output_filenames), 28);
assertEqual(exist(fullfile(bids_path, output_filenames{1}), 'file'), 2);
content = bids.util.tsvread(fullfile(bids_path, output_filenames{1}));
assertEqual(fieldnames(content), {'filename'; 'acq_time'; 'comments'});

validate_dataset(bids_path);

end
12 changes: 4 additions & 8 deletions tests/tests_utils/test_create_sessions_tsv.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@ function test_create_sessions_tsv_no_session()
bids_path = fullfile(bids_path, 'ds210');
end

validate_dataset(bids_path);

output_filenames = bids.util.create_sessions_tsv(bids_path, 'verbose', false);

assert(isempty(output_filenames));

validate_dataset(bids_path);

skip_if_octave('mixed-string-concat warning thrown');

assertWarning(@() bids.util.create_sessions_tsv(bids_path, 'verbose', true), ...
Expand All @@ -35,21 +31,21 @@ function test_create_sessions_tsv_basic()

bids_path = temp_dir();

copyfile(fullfile(get_test_data_dir(), 'ieeg_epilepsy'), bids_path);
copyfile(fullfile(get_test_data_dir(), 'synthetic'), bids_path);

if bids.internal.is_octave
bids_path = fullfile(bids_path, 'ieeg_epilepsy');
bids_path = fullfile(bids_path, 'synthetic');
end

validate_dataset(bids_path);

output_filenames = bids.util.create_sessions_tsv(bids_path, 'verbose', false);

assertEqual(numel(output_filenames), 1);
assertEqual(numel(output_filenames), 5);
assertEqual(exist(fullfile(bids_path, output_filenames{1}), 'file'), 2);
content = bids.util.tsvread(fullfile(bids_path, output_filenames{1}));
assertEqual(fieldnames(content), {'session_id'; 'acq_time'; 'comments'});
assertEqual(content.session_id, {'ses-postimp'; 'ses-preimp'});
assertEqual(content.session_id, {'ses-01'; 'ses-02'});

validate_dataset(bids_path);

Expand Down
6 changes: 1 addition & 5 deletions tests/utils/validate_dataset.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
function validate_dataset(bids_path)

if ispc
return
end

[sts, msg] = bids.validate(bids_path, '--config.ignore=99 --ignoreNiftiHeaders');
[sts, msg] = bids.validate(bids_path, '--ignoreNiftiHeaders');
assert(sts == 0, msg);

end
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.2.0
v0.3.0

0 comments on commit 4e51aad

Please sign in to comment.