Skip to content

Commit 018af1c

Browse files
authored
Merge branch 'master' into spec-refac
2 parents 52794c2 + 7e5805f commit 018af1c

30 files changed

+376
-437
lines changed

.github/workflows/validation.yml

Lines changed: 12 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -37,62 +37,33 @@ jobs:
3737
runs-on: ubuntu-latest
3838
steps:
3939
- uses: actions/checkout@v4
40-
- uses: actions/setup-python@v5
41-
with:
42-
python-version: 3
43-
- name: Install dependencies
44-
run: pip install yamllint
40+
- uses: actions/setup-uv@v6
4541
- name: Lint yml files in src/schema
46-
run: yamllint -f standard src/schema/ -c .yamllint.yml
42+
run: uvx yamllint -f standard src/schema/ -c .yamllint.yml
4743

4844
# Python best practices
4945
python-style:
5046
runs-on: ubuntu-latest
5147
steps:
5248
- uses: actions/checkout@v4
53-
- uses: actions/setup-python@v5
54-
with:
55-
python-version: 3
56-
- run: python -m pip install --upgrade flake8 black isort[colors]
57-
- run: black --diff --color --check tools/schemacode
58-
- run: isort --diff --color --check tools/schemacode
59-
- run: flake8
60-
working-directory: tools/schemacode
49+
- uses: actions/setup-uv@v6
50+
- run: uvx ruff format --diff
51+
- run: uvx ruff check
6152

6253
# Avoid Latin phrases to improve readability
6354
latin-phrases:
6455
runs-on: ubuntu-latest
6556
steps:
6657
- uses: actions/checkout@v4
67-
- uses: actions/setup-python@v5
68-
with:
69-
python-version: 3
70-
- name: Install dependencies
71-
run: |
72-
python -m pip install --upgrade pip
73-
python -m pip install -r tools/requirements.txt
74-
- name: Run Python script to check for Latin phrases - Master
75-
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
76-
run: |
77-
python no-bad-latin.py
78-
working-directory: tools
79-
- name: Run Python script to check for Latin phrases - Pull Request
80-
if: github.event.pull_request
81-
run: |
82-
python no-bad-latin.py
83-
working-directory: tools
58+
- uses: actions/setup-uv@v6
59+
- name: Check for Latin phrases
60+
run: uv run tools/no-bad-latin.py
8461

8562
# Validate CITATION.cff
8663
validate_cff:
8764
runs-on: ubuntu-latest
8865
steps:
89-
- uses: actions/checkout@v4
90-
- uses: actions/setup-python@v5
91-
with:
92-
python-version: 3
93-
- name: Install dependencies
94-
run: |
95-
python -m pip install --upgrade pip setuptools
96-
pip3 install cffconvert
97-
- name: Validate CITATION.cff
98-
run: make validate_citation_cff
66+
- uses: actions/checkout@v4
67+
- uses: actions/setup-uv@v6
68+
- name: Validate CITATION.cff
69+
run: uvx cffconvert --validate

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
src/schema.json
2+
13
site/
24
.DS_Store
35
.idea

.pre-commit-config.yaml

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,6 @@ repos:
2626
files: src/metaschema.json
2727
- id: check-readthedocs
2828
files: readthedocs.yml
29-
- repo: https://github.com/psf/black
30-
rev: 25.1.0
31-
hooks:
32-
- id: black
33-
files: ^tools/(?!schemacode)
34-
args: ["--verbose"]
35-
- id: black
36-
name: "black bidsschematools"
37-
files: tools/schemacode
38-
args: ["--config", "tools/schemacode/pyproject.toml", "--verbose"]
39-
- repo: https://github.com/pyCQA/isort
40-
rev: 6.0.1
41-
hooks:
42-
- id: isort
43-
files: ^tools/(?!schemacode)
44-
args: ["--profile", "black"]
45-
- id: isort
46-
name: "isort bidsschematools"
47-
files: tools/schemacode
48-
args: ["--settings-file", "tools/schemacode/pyproject.toml"]
49-
- repo: https://github.com/pyCQA/flake8
50-
rev: 7.2.0
51-
hooks:
52-
- id: flake8
53-
args: [--config=tools/schemacode/.flake8]
5429
- repo: https://github.com/pre-commit/mirrors-prettier
5530
rev: v4.0.0-alpha.8
5631
hooks:
@@ -63,11 +38,11 @@ repos:
6338
- id: yamllint
6439
args: [-f=standard, -c=.yamllint.yml]
6540
files: src/schema/.*/.*\.yaml
66-
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
67-
rev: v2.14.0
41+
- repo: https://github.com/ComPWA/taplo-pre-commit
42+
rev: v0.9.3
6843
hooks:
69-
- id: pretty-format-toml
70-
args: [--autofix, --indent, '4', --no-sort]
44+
- id: taplo-format
45+
args: [-o, 'array_auto_collapse=false']
7146
- repo: https://github.com/codespell-project/codespell
7247
rev: v2.4.1
7348
hooks:
@@ -79,9 +54,9 @@ repos:
7954
- id: mypy
8055
# Sync with project.optional-dependencies.typing
8156
additional_dependencies:
57+
- acres
8258
- click
8359
- markdown-it-py
84-
- importlib_resources
8560
- pandas-stubs
8661
- pyparsing
8762
- pytest

pdf_build_src/check_pandoc_log.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# go through the logs (list of dicts)
1414
duplicate_link_refs = []
1515
for log_dict in logs:
16-
1716
# Check for DuplicateLinkReference
1817
logtype = log_dict.get("type", None)
1918
logverbosity = log_dict.get("verbosity", None)

pdf_build_src/pandoc_script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def _flatten_values(lst):
6666
# appendices/ as a resource-path so that the relative files can
6767
# be found.
6868
build_root = HERE.parent
69-
cmd += [f'--resource-path=.:{build_root / "appendices"}']
69+
cmd += [f"--resource-path=.:{build_root / 'appendices'}"]
7070

7171
# Add input files to command
7272
# The filenames in `markdown_list` will ensure correct order when sorted

pdf_build_src/process_markdowns.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ def remove_internal_links_reference(root_path):
158158
# first find, which links need to be remove by scanning the
159159
# references, and remove the reference
160160
for ind, line in enumerate(data):
161-
162161
match = pattern_ref.search(line)
163162

164163
if match:
@@ -175,7 +174,6 @@ def remove_internal_links_reference(root_path):
175174
# link
176175
pattern = re.compile(r"\[([^\]]+)\]\[" + f"{link}" + r"\]")
177176
for ind, line in enumerate(data):
178-
179177
match = pattern.search(line)
180178

181179
if match:
@@ -256,7 +254,6 @@ def assert_no_multiline_links(root_path):
256254
code_context = False
257255
macro_context = False
258256
for ind, line in enumerate(data):
259-
260257
# do not check "code blocks" or "macros"
261258
if line.strip().startswith("```"):
262259
code_context = not code_context
@@ -277,8 +274,7 @@ def assert_no_multiline_links(root_path):
277274

278275
if len(problems) > 0:
279276
msg = (
280-
"Found multiline markdown links! Please reformat as single"
281-
" line links.\n\n"
277+
"Found multiline markdown links! Please reformat as single line links.\n\n"
282278
)
283279
msg += json.dumps(problems, indent=4)
284280
raise AssertionError(msg)
@@ -378,7 +374,6 @@ def correct_table(table, offset=[0.0, 0.0], debug=False):
378374
# correct alignment of fences and populate the new table (A List of str)
379375
new_table = []
380376
for i, row in enumerate(table):
381-
382377
if i == 1:
383378
str_format = " {:-{align}{width}} "
384379
else:
@@ -678,7 +673,6 @@ def process_macros(duplicated_src_dir_path):
678673

679674

680675
if __name__ == "__main__":
681-
682676
duplicated_src_dir_path = "src_copy/src"
683677

684678
# make a copy of the src directory in the current directory

pdf_build_src/remove_admonitions.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@
1616
def remove_admonitions(
1717
input_folder: str | Path, output_folder: str | Path, indent: str = None
1818
):
19-
2019
if indent is None:
2120
indent = INDENT
2221

2322
md_files = Path(input_folder).glob("**/*.md")
2423

2524
for file in md_files:
26-
2725
with open(file, "r", encoding="utf8") as f:
2826
content = f.readlines()
2927

@@ -32,11 +30,9 @@ def remove_admonitions(
3230
print(f"processing: {file}\n to: {output_file}")
3331

3432
with open(output_file, "w", encoding="utf8") as f:
35-
3633
is_admonition = False
3734
counter = 0
3835
for line in content:
39-
4036
if any(line.startswith(x) for x in ADMONITION_DELIMITERS):
4137
is_admonition = True
4238
counter = 0

pdf_build_src/test_remove_admonitions.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ def test_remove_admonitions(tmp_path):
1212
generated_files = list(tmp_path.glob("**/*.md"))
1313

1414
for file in generated_files:
15-
1615
expected = expected_folder / file.relative_to(tmp_path)
1716

1817
with open(expected, "r", encoding="utf8") as f:

0 commit comments

Comments
 (0)