From a8c4a18ffc4564467d163ac4460ed34ca1406624 Mon Sep 17 00:00:00 2001 From: christian-B Date: Mon, 20 Jul 2026 15:05:03 +0100 Subject: [PATCH 1/5] no_type_check deprecated function --- spynnaker/pyNN/models/defaults.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spynnaker/pyNN/models/defaults.py b/spynnaker/pyNN/models/defaults.py index 962a878ee4b..e90fcc14e94 100644 --- a/spynnaker/pyNN/models/defaults.py +++ b/spynnaker/pyNN/models/defaults.py @@ -20,7 +20,8 @@ import logging from types import MappingProxyType from typing import ( - Any, Callable, FrozenSet, Iterable, List, Mapping, Optional, Tuple) + Any, Callable, FrozenSet, Iterable, List, Mapping, no_type_check, + Optional, Tuple) from spinn_utilities.classproperty import classproperty from spinn_utilities.log import FormatAdapter @@ -158,7 +159,7 @@ def wrapper(*args: Any, **kwargs: Any) -> None: return wrapper return wrap - +@no_type_check def defaults(cls: type) -> type: """ Deprecated! Extend AbstractProvidesDefaults instead From 422a58e57322ab9ce727a851ee67d25af8856ff5 Mon Sep 17 00:00:00 2001 From: christian-B Date: Mon, 20 Jul 2026 15:26:52 +0100 Subject: [PATCH 2/5] _csv Writer and Reader --- spynnaker/pyNN/utilities/neo_buffer_database.py | 2 +- spynnaker/pyNN/utilities/neo_csv.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spynnaker/pyNN/utilities/neo_buffer_database.py b/spynnaker/pyNN/utilities/neo_buffer_database.py index 9e9f24064f1..2f56139212b 100644 --- a/spynnaker/pyNN/utilities/neo_buffer_database.py +++ b/spynnaker/pyNN/utilities/neo_buffer_database.py @@ -54,7 +54,7 @@ from spynnaker.pyNN.utilities.neo_csv import NeoCsv if TYPE_CHECKING: - from _csv import _writer as CSVWriter + from _csv import Writer as CSVWriter from spynnaker.pyNN.models.common.types import Names as ConcreteNames from spynnaker.pyNN.models.populations.population import Population from .data_population import DataPopulation diff --git a/spynnaker/pyNN/utilities/neo_csv.py b/spynnaker/pyNN/utilities/neo_csv.py index 75c2490f8b8..e1042d3fc52 100644 --- a/spynnaker/pyNN/utilities/neo_csv.py +++ b/spynnaker/pyNN/utilities/neo_csv.py @@ -30,7 +30,7 @@ from spynnaker.pyNN.data import SpynnakerDataView if TYPE_CHECKING: - from _csv import _writer as CSVWriter, _reader as CSVReader + from _csv import Writer as CSVWriter, Reader as CSVReader from spynnaker.pyNN.utilities.neo_buffer_database import Annotations logger = FormatAdapter(logging.getLogger(__name__)) From 81722d1e18231931d089357a9cca280bc4c45e75 Mon Sep 17 00:00:00 2001 From: christian-B Date: Mon, 20 Jul 2026 15:27:43 +0100 Subject: [PATCH 3/5] use venv for mypy --- mypyd.bash | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/mypyd.bash b/mypyd.bash index af141a0c799..05c7c2583a8 100755 --- a/mypyd.bash +++ b/mypyd.bash @@ -14,18 +14,26 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This bash assumes that other repositories are installed in paralled -# requires the latest mypy -# pip install --upgrade mypy +# This bash assumes that other repositories are installed in parallel -utils="../SpiNNUtils/spinn_utilities" -machine="../SpiNNMachine/spinn_machine" -man="../SpiNNMan/spinnman" -pacman="../PACMAN/pacman" -spalloc="../spalloc/spalloc_client" -fec="../SpiNNFrontEndCommon/spinn_front_end_common" -test_base="../TestBase/spinnaker_testbase" +if [ "$#" -eq "0" ] + then + echo "Provide any argument to run setup" + source ../SupportScripts/venv/mypy_runner/bin/activate +else + python3 -m venv ../SupportScripts/venv/mypy_runner + source ../SupportScripts/venv/mypy_runner/bin/activate + pip3 install --upgrade ../SpiNNUtils + pip3 install --upgrade ../SpiNNMachine + pip3 install --upgrade ../SpiNNMan + pip3 install --upgrade ../spalloc + pip3 install --upgrade ../PACMAN + pip3 install --upgrade ../SpiNNFrontEndCommon + pip3 install --upgrade ../TestBase + pip3 install --upgrade ../sPyNNaker[test] + python3 -m pip install --upgrade mypy +fi -mypy --disallow-untyped-defs $utils $machine $man $pacman $spalloc $fec $test_base spynnaker unittests spynnaker_integration_tests proxy_integration_tests +mypy --disallow-untyped-defs spynnaker unittests spynnaker_integration_tests proxy_integration_tests From 6ffc802389fdf8b0acb26411428b759e5cdef09c Mon Sep 17 00:00:00 2001 From: christian-B Date: Mon, 20 Jul 2026 15:31:04 +0100 Subject: [PATCH 4/5] venv for mypy --- mypyd.bash | 1 - spynnaker/pyNN/models/populations/population.py | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/mypyd.bash b/mypyd.bash index 05c7c2583a8..bbfa9e483ae 100755 --- a/mypyd.bash +++ b/mypyd.bash @@ -14,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - # This bash assumes that other repositories are installed in parallel if [ "$#" -eq "0" ] diff --git a/spynnaker/pyNN/models/populations/population.py b/spynnaker/pyNN/models/populations/population.py index 31bc036c540..36268cbf235 100644 --- a/spynnaker/pyNN/models/populations/population.py +++ b/spynnaker/pyNN/models/populations/population.py @@ -672,6 +672,7 @@ def __create_model( is a class to instantiate. Must be ``None`` if ``cell_class`` is an instantiated object. """ + model: AbstractPyNNModel | PopulationApplicationVertex if inspect.isclass(cell_class): if cell_params is None: model = cell_class() From c8a3c066962c6b873393051cc20094d813e05a19 Mon Sep 17 00:00:00 2001 From: christian-B Date: Mon, 20 Jul 2026 16:24:17 +0100 Subject: [PATCH 5/5] 2 blank lines --- spynnaker/pyNN/models/defaults.py | 1 + 1 file changed, 1 insertion(+) diff --git a/spynnaker/pyNN/models/defaults.py b/spynnaker/pyNN/models/defaults.py index e90fcc14e94..d7f1c835182 100644 --- a/spynnaker/pyNN/models/defaults.py +++ b/spynnaker/pyNN/models/defaults.py @@ -159,6 +159,7 @@ def wrapper(*args: Any, **kwargs: Any) -> None: return wrapper return wrap + @no_type_check def defaults(cls: type) -> type: """