Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fslr-convention
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo committed Feb 25, 2025
2 parents 7f0fffc + 93be74e commit aa5be6f
Show file tree
Hide file tree
Showing 111 changed files with 1,430 additions and 1,060 deletions.
7 changes: 4 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ jobs:
# failures for local file:/// -- yoh found no better way,
linkchecker -t 1 --check-extern \
--ignore-url 'file:///.*' \
--ignore-url 'https://bids-specification.readthedocs.io/en/stable/.*' \
--ignore-url 'https://doi.org/.*' \
--ignore-url 'https://fonts.gstatic.com' \
--ignore-url 'https://github.com/bids-standard/bids-specification/(pull|tree)/.*' \
--ignore-url 'https://github.com/[^/]*' \
--ignore-url 'https://doi.org/.*' \
--ignore-url 'https://bids-specification.readthedocs.io/en/stable/.*' \
--ignore-url 'https://github.com/bids-standard/bids-specification/(pull|tree)/.*' \
--ignore-url 'https://www.incf.org' \
~/project/site/*html ~/project/site/*/*.html
else
echo "Release PR - do nothing"
Expand Down
5 changes: 3 additions & 2 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[codespell]
skip = *.js,*.svg,*.eps,.git,node_modules,env,venv,.mypy_cache,package-lock.json,CITATION.cff,tools/new_contributors.tsv,./tools/schemacode/docs/build
ignore-words-list = fo,te,als,Acknowledgements,acknowledgements,weill,bu,winn,manuel
skip = *.js,*.svg,*.eps,.git,node_modules,env,venv,.mypy_cache,package-lock.json,CITATION.cff,tools/new_contributors.tsv,./tools/schemacode/docs/build,venvs
ignore-regex = \bHEP\b
ignore-words-list = acknowledgements,als,bu,fo,te,weill,winn
builtin = clear,rare,en-GB_to_en-US
# this overloads default dictionaries and I have not yet figured out
# how to have multiple https://github.com/codespell-project/codespell/issues/2727
Expand Down
45 changes: 35 additions & 10 deletions .github/workflows/publish_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- "master"
- "maint/*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -34,13 +35,27 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: 3
- run: env
- run: git status
- name: Determine master/maintenance branch
id: branch
run: |
if [[ "$GITHUB_REF_NAME" = "master" ]]; then
echo "branch=jsr-dist" | tee -a $GITHUB_OUTPUT
echo "mode=dev" | tee -a $GITHUB_OUTPUT
else
echo "branch=jsr-maint" | tee -a $GITHUB_OUTPUT
echo "mode=maint" | tee -a $GITHUB_OUTPUT
fi
- name: Install bidsschematools
run: |
pip install --upgrade tools/schemacode
git clean -fxd tools/schemacode
- name: Checkout jsr-dist
- name: Checkout ${{ steps.branch.outputs.branch }}
run: |
git checkout -t origin/jsr-dist
git checkout -t origin/$JSR_BRANCH
env:
JSR_BRANCH: ${{ steps.branch.outputs.branch }}
- name: Regenerate schema
run: bst export > schema.json
- name: Regenerate context types
Expand All @@ -54,36 +69,46 @@ jobs:
bst export-metaschema > /tmp/schema.json
npx --package=json-schema-to-typescript json2ts --unknownAny /tmp/schema.json > metaschema.ts
- name: Determine next version
id: version
run: |
BASE=$( jq -r .schema_version schema.json )
if [[ "$BASE" =~ ^[0-9]*.[0-9]*.[0-9]*$ ]]; then
if [[ "$BASE" =~ ^[0-9]*\.[0-9]*\.[0-9]*$ ]]; then
# Release, so unconditionally update version
VERSION=$BASE
jq ".version = \"$VERSION\"" jsr.json > tmp.json && mv tmp.json jsr.json
else
echo release=true | tee -a $GITHUB_OUTPUT
elif [[ "$BASE" =~ ^[0-9]*\.[0-9]*\.[0-9]*\.post[0-9]*$ ]]; then
# Post-release, so replace .post with + for JSR semver
VERSION=${BASE/.post/+}
jq ".version = \"$VERSION\"" jsr.json > tmp.json && mv tmp.json jsr.json
echo release=true | tee -a $GITHUB_OUTPUT
elif [[ "$GITHUB_REF_NAME" = "master" ]]; then
DENOVER=$( jq -r .version jsr.json )
# Get the reference of the latest commit to touch the schema directory
HASH=$( git log -n 1 --pretty=%h $REF -- src/schema )
HASH=$( git log -n 1 --pretty=%h $GITHUB_REF -- src/schema )
if [[ $DENOVER =~ ^"$BASE".[0-9] ]]; then
PREFIX=${DENOVER%+*}
let SERIAL=1+${PREFIX#$BASE.}
else
SERIAL=1
fi
VERSION="$BASE.$SERIAL+$HASH"
echo release=true | tee -a $GITHUB_OUTPUT
else
echo release=false | tee -a $GITHUB_OUTPUT
fi
echo VERSION=$VERSION | tee -a $GITHUB_ENV
env:
REF: ${{ github.ref }}
- name: Check for changes, set version and commit
echo version=$VERSION | tee -a $GITHUB_OUTPUT
- name: Bump version (${{ steps.version.outputs.version }}) if changed
if: steps.version.outputs.release == 'true'
run: |
if ! git diff -s --exit-code; then
jq ".version = \"$VERSION\"" jsr.json > tmp.json && mv tmp.json jsr.json
git add jsr.json schema.json context.ts metaschema.ts
git commit -m "Update schema JSR distribution"
git commit -m "Update schema JSR distribution ($VERSION)"
git push
fi
- name: Publish to JSR
if: success()
if: success() && steps.version.outputs.release == 'true'
run: |
npx jsr publish
25 changes: 17 additions & 8 deletions .github/workflows/schemacode_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ on:
push:
branches:
- "master"
- "maint/*"
tags:
- "schema-*"
pull_request:
branches:
- "master"
- "maint/*"
- "*"

concurrency:
Expand Down Expand Up @@ -36,7 +39,9 @@ jobs:
run: pip install --upgrade tools/schemacode[all]
if: ${{ startsWith(github.ref, 'refs/tags/schema-') }}
- name: "Build archive on tag"
run: pytest tools/schemacode/bidsschematools -k make_archive
run: |
python -m pytest -k make_archive
working-directory: tools/schemacode
env:
BIDSSCHEMATOOLS_RELEASE: 1
if: ${{ startsWith(github.ref, 'refs/tags/schema-') }}
Expand All @@ -56,7 +61,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
include:
- os: macos-latest
python-version: 3
Expand Down Expand Up @@ -87,14 +92,15 @@ jobs:
- name: "Run tests"
run: |
python -m pytest -vs --pyargs bidsschematools -m "not validate_schema" \
--cov-append --cov-report=xml --cov=bidsschematools --doctest-modules
python -m pytest -vs --doctest-modules -m "not validate_schema" \
--cov-append --cov-report=xml --cov-report=term --cov=src/bidsschematools
working-directory: tools/schemacode

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: unit_${{ matrix.os }}_${{ matrix.python-version }}
path: coverage.xml
path: tools/schemacode/coverage.xml
if: success()

publish:
Expand Down Expand Up @@ -143,13 +149,16 @@ jobs:
python -m pip install -e ./tools/schemacode[all]
- name: Run schema validation tests
run: python -m pytest --pyargs bidsschematools -m "validate_schema" --cov-append --cov-report=xml --cov=bidsschematools
run: |
python -m pytest -vs --doctest-modules -m "not validate_schema" \
--cov-append --cov-report=xml --cov-report=term --cov=src/bidsschematools
working-directory: tools/schemacode

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: schema_validation
path: coverage.xml
path: tools/schemacode/coverage.xml
if: success()

upload_to_codecov:
Expand All @@ -164,7 +173,7 @@ jobs:
uses: actions/download-artifact@v4

- name: Upload to CodeCov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required but might help API rate limits
fail_ci_if_error: true
27 changes: 17 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
# See https://pre-commit.com/hooks.html for more hooks
ci:
skip: [shellcheck]
exclude: 'tools/schemacode/bidsschematools/tests/data/broken_dataset_description.json'
exclude: 'tools/schemacode/src/bidsschematools/tests/data/broken_dataset_description.json'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: [--unsafe]
- id: check-json
- id: check-toml
- id: check-ast
- id: check-added-large-files
- id: check-case-conflict
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.2
rev: 0.31.1
hooks:
- id: check-dependabot
- id: check-github-workflows
Expand All @@ -25,7 +27,7 @@ repos:
- id: check-readthedocs
files: readthedocs.yml
- repo: https://github.com/psf/black
rev: 24.8.0
rev: 25.1.0
hooks:
- id: black
files: ^tools/(?!schemacode)
Expand All @@ -35,7 +37,7 @@ repos:
files: tools/schemacode
args: ["--config", "tools/schemacode/pyproject.toml", "--verbose"]
- repo: https://github.com/pyCQA/isort
rev: 5.13.2
rev: 6.0.0
hooks:
- id: isort
files: ^tools/(?!schemacode)
Expand All @@ -45,10 +47,10 @@ repos:
files: tools/schemacode
args: ["--settings-file", "tools/schemacode/pyproject.toml"]
- repo: https://github.com/pyCQA/flake8
rev: 7.1.1
rev: 7.1.2
hooks:
- id: flake8
args: [--config=tools/schemacode/setup.cfg]
args: [--config=tools/schemacode/.flake8]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
Expand All @@ -61,13 +63,18 @@ repos:
- id: yamllint
args: [-f=standard, -c=.yamllint.yml]
files: src/schema/.*/.*\.yaml
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.14.0
hooks:
- id: pretty-format-toml
args: [--autofix, --indent, '4', --no-sort]
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.1
hooks:
- id: codespell
args: ["--config=.codespellrc", "--dictionary=-", "--dictionary=.codespell_dict"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
rev: v1.15.0
hooks:
- id: mypy
# Sync with project.optional-dependencies.typing
Expand All @@ -83,7 +90,7 @@ repos:
- types-jsonschema
- jsonschema
- httpx
args: ["tools/schemacode/bidsschematools"]
args: ["tools/schemacode/src"]
pass_filenames: false
- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.10.0
Expand Down
4 changes: 2 additions & 2 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
/src/derivatives/diffusion-derivatives.md @francopestilli @oesteban @Lestropie

# The schema
/src/schema/ @tsalo @erdalkaraca
/tools/schemacode/ @tsalo @erdalkaraca
/src/schema/ @erdalkaraca
/tools/schemacode/ @erdalkaraca
49 changes: 0 additions & 49 deletions CODE_OF_CONDUCT.md

This file was deleted.

Loading

0 comments on commit aa5be6f

Please sign in to comment.