From 8630c3ae800bfff9b041d98a68b1082fdab0e756 Mon Sep 17 00:00:00 2001 From: AxelNoun <150222552+AxelNoun@users.noreply.github.com> Date: Tue, 6 Oct 2026 16:07:20 +0200 Subject: [PATCH 1/2] Apply the sonpy platform marker to the ced and all extras sonpy 1.9.12 only publishes wheels for Windows, and for Linux and macOS on Python 3.14. Elsewhere `pip install neo[ced]` fell back to the sonpy source distribution. Use the marker already present in the `test` extra for `ced` and `all`, so those platforms install nothing and CedRawIO raises its ImportError on first use. Make that ImportError name the platform constraint, as the CedRawIO docstring already stated, and update the docstring to cover both extras. Follow-up to #1891. --- neo/rawio/cedrawio.py | 13 ++++++++----- pyproject.toml | 5 +++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/neo/rawio/cedrawio.py b/neo/rawio/cedrawio.py index b9f60340b..917806139 100644 --- a/neo/rawio/cedrawio.py +++ b/neo/rawio/cedrawio.py @@ -37,7 +37,10 @@ def _get_sonpy_namespace(): """Return the sonpy namespace exposing SonFile, whatever the installed layout.""" if importlib.util.find_spec("sonpy") is None: - raise ImportError("sonpy is not installed. Install it with `pip install sonpy`.") + raise ImportError( + "sonpy is not installed. sonpy only publishes wheels for Windows, and for Linux and macOS " + "from Python 3.14 onwards; on those platforms install it with `pip install sonpy`." + ) sonpy = importlib.import_module("sonpy") @@ -77,10 +80,10 @@ class CedRawIO(BaseRawIO): * This IO reads smr and smrx files - * sonpy is installed by the ``ced`` extra, but upstream only publishes wheels for Windows, - and for Linux and macOS from Python 3.14 onwards. Elsewhere the extra resolves to nothing - installable and this class raises an ImportError naming the constraint on first use; the - PyPI source distribution ships a Windows binary and is not usable. + * sonpy is installed by the ``ced`` and ``all`` extras, but upstream only publishes wheels for + Windows, and for Linux and macOS from Python 3.14 onwards. Elsewhere both extras skip sonpy + and this class raises an ImportError naming the constraint on first use; the PyPI source + distribution ships a Windows binary and is not usable. * Old smr files can be read without sonpy using Spike2RawIO. Only smrx requires this class. diff --git a/pyproject.toml b/pyproject.toml index 0cb04114e..1517beec7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -98,7 +98,8 @@ neomatlabio = ["scipy>=1.0.0"] nixio = ["nixio>=1.5.0"] tiffio = ["pillow"] edf = ["pyedflib"] -ced = ["sonpy"] +# sonpy wheels exist only for Windows, and for Linux/macOS from Python 3.14 (same marker as in `test`) +ced = ["sonpy; platform_system=='Windows' or python_version>='3.14'"] nwb = ["pynwb"] maxwell = ["h5py"] biocam = ["h5py"] @@ -124,7 +125,7 @@ all = [ "pytest", "pytest-cov", "scipy>=1.0.0", - "sonpy", + "sonpy; platform_system=='Windows' or python_version>='3.14'", "tqdm", "wenv; sys_platform!='win32'", "zugbruecke>=0.2; sys_platform!='win32'", From 8e21e4f6abc42b50113a6d764e002c4bf7e3d09d Mon Sep 17 00:00:00 2001 From: AxelNoun <150222552+AxelNoun@users.noreply.github.com> Date: Mon, 23 Nov 2026 23:45:14 +0100 Subject: [PATCH 2/2] Restrict the sonpy marker to the platforms its binaries support sonpy 1.9.12 ships x86_64 binaries only: win_amd64, manylinux x86_64, and a macOS wheel tagged universal2 whose extension module contains a single x86_64 slice. Skip sonpy on Windows ARM64 and, from Python 3.14, on any non-x86_64 Linux or macOS machine, including Apple Silicon. --- neo/rawio/cedrawio.py | 6 +++--- pyproject.toml | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/neo/rawio/cedrawio.py b/neo/rawio/cedrawio.py index 917806139..46feaef65 100644 --- a/neo/rawio/cedrawio.py +++ b/neo/rawio/cedrawio.py @@ -38,8 +38,8 @@ def _get_sonpy_namespace(): """Return the sonpy namespace exposing SonFile, whatever the installed layout.""" if importlib.util.find_spec("sonpy") is None: raise ImportError( - "sonpy is not installed. sonpy only publishes wheels for Windows, and for Linux and macOS " - "from Python 3.14 onwards; on those platforms install it with `pip install sonpy`." + "sonpy is not installed. sonpy only publishes wheels for Windows x64, and from Python 3.14 " + "for Linux and macOS on x86_64; on those platforms install it with `pip install sonpy`." ) sonpy = importlib.import_module("sonpy") @@ -81,7 +81,7 @@ class CedRawIO(BaseRawIO): * This IO reads smr and smrx files * sonpy is installed by the ``ced`` and ``all`` extras, but upstream only publishes wheels for - Windows, and for Linux and macOS from Python 3.14 onwards. Elsewhere both extras skip sonpy + Windows x64, and from Python 3.14 for Linux and macOS on x86_64. Elsewhere both extras skip sonpy and this class raises an ImportError naming the constraint on first use; the PyPI source distribution ships a Windows binary and is not usable. diff --git a/pyproject.toml b/pyproject.toml index 9faf32345..0dc54a586 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,7 +64,7 @@ test = [ "coverage", "coveralls", "pillow", - "sonpy; platform_system=='Windows' or python_version>='3.14'", + "sonpy; (platform_system=='Windows' and platform_machine!='ARM64') or (python_version>='3.14' and platform_machine=='x86_64' and (platform_system=='Linux' or platform_system=='Darwin'))", "pynwb", "probeinterface", "zugbruecke>=0.2", @@ -98,8 +98,8 @@ neomatlabio = ["scipy>=1.0.0"] nixio = ["nixio>=1.5.0"] tiffio = ["pillow"] edf = ["pyedflib"] -# sonpy wheels exist only for Windows, and for Linux/macOS from Python 3.14 (same marker as in `test`) -ced = ["sonpy; platform_system=='Windows' or python_version>='3.14'"] +# sonpy binaries exist only for Windows x64, and from Python 3.14 for Linux and macOS on x86_64 (the macOS "universal2" wheel holds only x86_64 code); same marker as in `test` +ced = ["sonpy; (platform_system=='Windows' and platform_machine!='ARM64') or (python_version>='3.14' and platform_machine=='x86_64' and (platform_system=='Linux' or platform_system=='Darwin'))"] nwb = ["pynwb"] maxwell = ["h5py"] biocam = ["h5py"] @@ -125,7 +125,7 @@ all = [ "pytest", "pytest-cov", "scipy>=1.0.0", - "sonpy; platform_system=='Windows' or python_version>='3.14'", + "sonpy; (platform_system=='Windows' and platform_machine!='ARM64') or (python_version>='3.14' and platform_machine=='x86_64' and (platform_system=='Linux' or platform_system=='Darwin'))", "tqdm", "wenv; sys_platform!='win32'", "zugbruecke>=0.2; sys_platform!='win32'",