From f469797d56c171815058f6bc8ea1f8281d73a356 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 5 Dec 2024 14:47:05 -0500 Subject: [PATCH] chore: Enable 3.13 tests (#909) * fix: Drop deprecated TraitDictAnys * chore: Enable 3.13 tests * chore(ci): Install tox-uv for consistency --- .github/workflows/tox.yml | 10 ++++++---- niworkflows/interfaces/bids.py | 8 ++++---- niworkflows/interfaces/norm.py | 3 ++- tox.ini | 4 ++-- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 485f33e0377..7d7a41d5720 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -94,7 +94,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] #, "3.13"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] dependencies: [latest, pre] include: - python-version: "3.9" @@ -168,9 +168,11 @@ jobs: - uses: actions/checkout@v4 - name: Install the latest version of uv uses: astral-sh/setup-uv@v4 + - name: Install tox + run: uv tool install tox --with=tox-uv - name: Show tox config - run: uvx tox c + run: tox c - name: Show tox config (this call) - run: uvx tox c -e ${{ matrix.check }} + run: tox c -e ${{ matrix.check }} - name: Run check - run: uvx tox -e ${{ matrix.check }} + run: tox -e ${{ matrix.check }} diff --git a/niworkflows/interfaces/bids.py b/niworkflows/interfaces/bids.py index cc72789b94b..0dbfbae52ec 100644 --- a/niworkflows/interfaces/bids.py +++ b/niworkflows/interfaces/bids.py @@ -312,7 +312,7 @@ class _PrepareDerivativeInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec): desc='a list entities that will not be propagated from the source file', ) in_file = InputMultiObject(File(exists=True), mandatory=True, desc='the object to be saved') - meta_dict = traits.DictStrAny(desc='an input dictionary containing metadata') + meta_dict = traits.Dict(Str, desc='an input dictionary containing metadata') source_file = InputMultiObject( File(exists=False), mandatory=True, desc='the source file(s) to extract entities from' ) @@ -320,7 +320,7 @@ class _PrepareDerivativeInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec): class _PrepareDerivativeOutputSpec(TraitedSpec): out_file = OutputMultiObject(File(exists=True), desc='derivative file path') - out_meta = traits.DictStrAny(desc='derivative metadata') + out_meta = traits.Dict(Str, desc='derivative metadata') out_path = OutputMultiObject(Str, desc='relative path in target directory') fixed_hdr = traits.List(traits.Bool, desc='whether derivative header was fixed') @@ -733,7 +733,7 @@ class _SaveDerivativeInputSpec(TraitedSpec): exists=True, mandatory=True, desc='Path to the base directory for storing data.' ) in_file = InputMultiObject(File(exists=True), mandatory=True, desc='the object to be saved') - metadata = traits.DictStrAny(desc='metadata to be saved alongside the file') + metadata = traits.Dict(Str, desc='metadata to be saved alongside the file') relative_path = InputMultiObject( traits.Str, desc='path to the file relative to the base directory' ) @@ -802,7 +802,7 @@ class _DerivativesDataSinkInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec): desc='a list entities that will not be propagated from the source file', ) in_file = InputMultiObject(File(exists=True), mandatory=True, desc='the object to be saved') - meta_dict = traits.DictStrAny(desc='an input dictionary containing metadata') + meta_dict = traits.Dict(Str, desc='an input dictionary containing metadata') source_file = InputMultiObject( File(exists=False), mandatory=True, desc='the source file(s) to extract entities from' ) diff --git a/niworkflows/interfaces/norm.py b/niworkflows/interfaces/norm.py index de4234bdad2..9fa9c240e42 100644 --- a/niworkflows/interfaces/norm.py +++ b/niworkflows/interfaces/norm.py @@ -32,6 +32,7 @@ BaseInterface, BaseInterfaceInputSpec, File, + Str, isdefined, traits, ) @@ -100,7 +101,7 @@ class _SpatialNormalizationInputSpec(BaseInterfaceInputSpec): # Load other settings from file. settings = traits.List(File(exists=True), desc='pass on the list of settings files') # Resolution of the default template. - template_spec = traits.DictStrAny(desc='template specifications') + template_spec = traits.Dict(Str, desc='template specifications') template_resolution = traits.Enum(1, 2, None, desc='(DEPRECATED) template resolution') # Use explicit masking? explicit_masking = traits.Bool( diff --git a/tox.ini b/tox.ini index 6efe90bb503..53b3e1e66e0 100644 --- a/tox.ini +++ b/tox.ini @@ -2,9 +2,9 @@ requires = tox>=4 envlist = - py3{9,10,11,12}-latest + py3{9,10,11,12,13}-latest py39-min - py3{10,11,12}-pre + py3{10,11,12,13}-pre skip_missing_interpreters = true # Configuration that allows us to split tests across GitHub runners effectively