Skip to content

Commit 2a7a139

Browse files
committed
Merge remote-tracking branch 'upstream/maint/1.10.0'
2 parents 1e14c26 + e88eb78 commit 2a7a139

File tree

5 files changed

+36
-39
lines changed

5 files changed

+36
-39
lines changed

.github/workflows/schemacode_ci.yml

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,29 @@ defaults:
2323

2424
jobs:
2525
build:
26-
runs-on: ${{ matrix.os }}
27-
strategy:
28-
matrix:
29-
os: ["ubuntu-latest"]
30-
python-version: ["3.11"]
26+
name: Build & verify package
27+
runs-on: ubuntu-latest
28+
permissions:
29+
attestations: write
30+
id-token: write
3131
steps:
3232
- uses: actions/checkout@v4
33-
- uses: actions/setup-python@v5
3433
with:
35-
python-version: ${{ matrix.python-version }}
36-
- name: "Install build dependencies"
37-
run: pip install --upgrade build twine
38-
- name: "Install test dependencies on tag"
39-
run: pip install --upgrade tools/schemacode[all]
34+
fetch-depth: 0
35+
- name: Install the latest version of uv
36+
uses: astral-sh/setup-uv@v6
4037
if: ${{ startsWith(github.ref, 'refs/tags/schema-') }}
4138
- name: "Build archive on tag"
4239
run: |
43-
python -m pytest -k make_archive
40+
uv run --extra=tests pytest -k make_archive
4441
working-directory: tools/schemacode
4542
env:
4643
BIDSSCHEMATOOLS_RELEASE: 1
4744
if: ${{ startsWith(github.ref, 'refs/tags/schema-') }}
48-
- name: "Build source distribution and wheel"
49-
run: python -m build tools/schemacode
50-
- name: "Check distribution metadata"
51-
run: twine check tools/schemacode/dist/*
52-
- uses: actions/upload-artifact@v4
45+
- uses: hynek/build-and-inspect-python-package@v2
5346
with:
54-
name: dist
55-
path: tools/schemacode/dist/
47+
path: tools/schemacode
48+
attest-build-provenance-github: ${{ github.event_name != 'pull_request' }}
5649

5750
test:
5851
runs-on: ${{ matrix.os }}
@@ -83,8 +76,8 @@ jobs:
8376
- name: "Fetch packages"
8477
uses: actions/download-artifact@v4
8578
with:
86-
name: dist
87-
path: dist/
79+
name: Packages
80+
path: dist
8881

8982
- name: "Install package"
9083
run: |
@@ -104,20 +97,20 @@ jobs:
10497
if: success()
10598

10699
publish:
107-
runs-on: ${{ matrix.os }}
108100
name: Publish Python Package
109-
needs: [test]
110101
if: github.event_name == 'push'
111-
strategy:
112-
matrix:
113-
os: ["ubuntu-latest"]
114-
python-version: ["3.11"]
102+
runs-on: ubuntu-latest
103+
needs: [test]
104+
permissions:
105+
attestations: write
106+
id-token: write
107+
115108
steps:
116-
- name: "Fetch packages"
109+
- name: Download packages built by build-and-inspect-python-package
117110
uses: actions/download-artifact@v4
118111
with:
119-
name: dist
120-
path: dist/
112+
name: Packages
113+
path: dist
121114
- name: "Test PyPI upload"
122115
uses: pypa/gh-action-pypi-publish@release/v1
123116
with:
@@ -128,9 +121,6 @@ jobs:
128121
- name: "Upload to PyPI (on tags)"
129122
if: startsWith(github.ref, 'refs/tags/schema-')
130123
uses: pypa/gh-action-pypi-publish@release/v1
131-
with:
132-
user: __token__
133-
password: ${{ secrets.PYPI_API_TOKEN }}
134124

135125
validate_schema:
136126
runs-on: ubuntu-latest

tools/schemacode/pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ bst = "bidsschematools.__main__:cli"
6666
[project.urls]
6767
Homepage = "https://github.com/bids-standard/bids-specification"
6868

69+
[tool.pdm.build]
70+
excludes = [
71+
".gitignore",
72+
"**/.gitignore",
73+
]
74+
6975
[tool.black]
7076
exclude = "*"
7177

tools/schemacode/src/bidsschematools/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ def fixture(tests_data_dir):
9696
def schema_dir() -> Generator[str, None, None]:
9797
"""Path to the schema housed in the bids-specification repo."""
9898
with data.load.as_path("schema") as schema_path:
99+
if not schema_path.exists():
100+
pytest.skip("No schema found; probably in an installed package")
99101
yield str(schema_path)
100102

101103

tools/schemacode/src/bidsschematools/tests/test_schema.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010

1111
from bidsschematools import __bids_version__, schema, types
1212

13-
from ..data import load
1413

15-
16-
def test__get_bids_version(tmp_path):
14+
def test__get_bids_version(schema_dir):
1715
# Is the version being read in correctly?
18-
schema_path = str(load("schema"))
19-
bids_version = schema._get_bids_version(schema_path)
16+
bids_version = schema._get_bids_version(schema_dir)
2017
assert bids_version == __bids_version__
2118

19+
20+
def test__get_bids_version_fallback(tmp_path):
2221
# Does fallback to unknown development version work?
2322
expected_version = "1.2.3-dev"
2423
schema_path = os.path.join(tmp_path, "whatever", expected_version)

tools/schemacode/src/bidsschematools/tests/test_validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def test_select_schema_path(bids_examples, tmp_path):
274274
assert schema_path is None
275275

276276

277-
def test_bids_schema_versioncheck(monkeypatch):
277+
def test_bids_schema_versioncheck(monkeypatch, schema_dir):
278278
"""Test incompatible version."""
279279
import bidsschematools as bst
280280

0 commit comments

Comments
 (0)