diff --git a/.github/workflows/compat.yml b/.github/workflows/compat.yml new file mode 100644 index 00000000..20e4815e --- /dev/null +++ b/.github/workflows/compat.yml @@ -0,0 +1,88 @@ +name: Compatibility + +# Released clients and this branch against an Archive before and after a renames table +# (tests/compat/README.md). Nightly, it catches changes in the Archive's skeleton +# builder and in the clients' dependencies. Replay a proposed table before merging it +# into a template with "Run workflow". + +on: + push: + branches: [master, 'maint/*'] + pull_request: + schedule: + - cron: '23 3 * * *' + workflow_dispatch: + inputs: + renames-url: + description: >- + HTTPS URL of a renames table to replay: rows of the root renames.tsv, or a + template's .renames.tsv (set the template). Empty runs the sample table. + required: false + default: '' + template: + description: Template of a .renames.tsv fragment (tpl-X); empty for root rows + required: false + default: '' + archive-ref: + description: Ref of templateflow/templateflow whose build-skeletons.py builds the Archive + required: false + default: master + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + compat: + name: Python ${{ matrix.python-version }} + runs-on: ubuntu-26.04 + timeout-minutes: 45 + strategy: + fail-fast: false + matrix: + # SPEC 0 + python-version: ['3.13', '3.14', '3.15'] + env: + TEMPLATEFLOW_COMPAT_PYTHON: ${{ matrix.python-version }} + TEMPLATEFLOW_ARCHIVE_SCRIPTS: ${{ github.workspace }}/archive/.github/scripts + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 # hatch-vcs versions the client under test + persist-credentials: false + - uses: actions/checkout@v7 + with: + repository: templateflow/templateflow + ref: ${{ inputs.archive-ref || 'master' }} + path: archive + sparse-checkout: .github/scripts + persist-credentials: false + - uses: astral-sh/setup-uv@v10.4.1 + - name: Fetch the table to replay + if: inputs.renames-url != '' + env: + URL: ${{ inputs.renames-url }} + TEMPLATE: ${{ inputs.template }} + run: | + curl -fsSL --proto '=https' --max-filesize 1048576 -o "$RUNNER_TEMP/renames.tsv" "$URL" + echo "TEMPLATEFLOW_COMPAT_RENAMES=$RUNNER_TEMP/renames.tsv" >> "$GITHUB_ENV" + if [ -n "$TEMPLATE" ]; then + echo "TEMPLATEFLOW_COMPAT_TEMPLATE=$TEMPLATE" >> "$GITHUB_ENV" + fi + cat "$RUNNER_TEMP/renames.tsv" + - name: Set up the test environment + run: | + uv venv --python "$TEMPLATEFLOW_COMPAT_PYTHON" "$RUNNER_TEMP/compat" + uv pip install --python "$RUNNER_TEMP/compat/bin/python" . pytest + - name: Run the compatibility matrix + run: >- + "$RUNNER_TEMP/compat/bin/python" -m pytest -o addopts="" -rxXs + --junitxml="$RUNNER_TEMP/compat.xml" tests/compat + - uses: actions/upload-artifact@v7 + if: always() + with: + name: compat-python-${{ matrix.python-version }} + path: ${{ runner.temp }}/compat.xml diff --git a/CHANGES.rst b/CHANGES.rst index 9de2765d..d879648f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,37 @@ +Unreleased (26.0.0) +=================== +TemplateFlow 2.0 file names: the client reads the v2 skeleton and resolves old names. + +* New home folders start from the v2 skeleton (``templateflow-skel-v2.zip``): current + names only, with ``renames.tsv`` and a manifest of every file's size and checksum. + Updates make the home match it: they add files, refresh text files, prune stubs of + names the Archive no longer uses, and reset downloads the Archive changed. +* Existing home folders keep the legacy skeleton, which older clients read, until + ``templateflow update --migrate`` (or ``templateflow.update(migrate=True)``) moves + them to the v2 skeleton. Files downloaded under an old name move to the new one when + their checksum matches. ``templateflow config`` shows the home's layout. +* ``ls()`` and ``get()`` resolve old names through ``renames.tsv``: old-style queries + find the renamed files with a ``TemplateFlowAliasWarning`` (a ``FutureWarning``) + that gives the query to use instead, and files removed from the Archive are still + served until templateflow 27.0. In homes that have not migrated, current queries + find the old names, and ``ls()`` returns one file when a home holds both names. + A query that also finds files by the home's own names adds renamed files only when + it names them by a value (``desc='CSF'``), not through ``None`` or ``Query.ANY``. +* New ``get_atlas_metadata(template, atlas)`` reads + ``tpl-