%global upstream_name mne Name: python-mne Version: 1.13.2 Release: 3%{?dist} Summary: Magnetoencephalography (MEG) and Electroencephalography (EEG) data analysis # The project is BSD-3-Clause throughout (pyproject.toml: license = # "BSD-3-Clause", license-files = ["LICENSE.txt"]). # # A copy of the FieldTrip realtime buffer Python client is bundled under # mne/externals. It cannot be unbundled: upstream FieldTrip ships it only as # part of a MATLAB toolbox, which is not packageable here. License: BSD-3-Clause URL: https://mne.tools/ # The GitHub archive is used in preference to the PyPI sdist on purpose. # [tool.hatch.build] excludes "/mne/**/tests", "/examples" and "/doc" from the # published artifacts, so the sdist carries neither the test suite nor the # examples shipped below as %%doc. Source0: https://github.com/mne-tools/mne-python/archive/v%{version}/%{name}-%{version}.tar.gz # Pure Python: mne/ contains no .c, .pyx or .cpp, and pyproject.toml declares no # ext-modules. The .pyi files present are lazy_loader type stubs, not compiled # artifacts. Fedora packaged this arched to expose per-arch test failures; that # rationale does not apply here, since the test suite cannot run (see %%check), # so the guideline default applies. BuildArch: noarch BuildRequires: python3-devel # %%pyproject_buildrequires brings in the build backend (hatchling, hatch-vcs) # and every runtime dependency, which covers almost all of what %%check needs in # order to import the package. scikit-learn is the one exception: upstream # declares it optional, but mne/decoding/{base,ems,receptive_field,search_light, # time_delaying_ridge,time_frequency,transformer}.py all import it at module # level, so mne.decoding.* cannot be imported without it. BuildRequires: python3-scikit-learn # Upstream's suite needs these. refleak is the one that matters: mne's ROOT # conftest imports it unconditionally, so without it pytest dies at collection # for any selection at all. It is packaged here now (python-refleak 0.2.2). BuildRequires: python3-pytest BuildRequires: python3-pytest-timeout BuildRequires: python3-refleak BuildRequires: python3-pandas BuildRequires: python3-h5io BuildRequires: python3-pymatreader %global _description %{expand: MNE-Python is an open-source package for exploring, visualizing and analyzing human neurophysiological data: MEG, EEG, sEEG, ECoG, NIRS and more. It covers sensor- and source-space analysis, including preprocessing, forward and inverse modelling, frequency-domain and time-frequency analysis, machine learning and non-parametric statistics.} %description %_description %package -n python3-%{upstream_name} Summary: %{summary} Provides: bundled(python3-FieldTrip) # Runtime dependencies are generated from the wheel metadata; mne declares them # completely in pyproject.toml, so nothing needs adding back by hand. # # Below are the optional dependencies that are actually packaged and that unlock # substantial functionality. mne uses lazy_loader, so these are genuinely soft: # importing mne does not touch them, and only the corresponding submodule fails # if one is absent. scikit-learn is the notable one -- mne.decoding is # unimportable without it -- but it stays a Recommends because nothing outside # mne.decoding needs it. # # Not listed: dipy and nilearn (in this COPR, but not in Fedora proper), # pyvista/pyvistaqt and PySide6 (the 3D backend, not packaged), and pyedflib # (not packaged anywhere). Recommends: python3-h5io Recommends: python3-h5py Recommends: python3-nibabel Recommends: python3-pandas Recommends: python3-patsy Recommends: python3-pillow Recommends: python3-pymatreader Recommends: python3-pyvista Recommends: python3-pyvistaqt Recommends: python3-scikit-learn Recommends: python3-statsmodels Recommends: python3-threadpoolctl %description -n python3-%{upstream_name} %_description %prep %autosetup -n mne-python-%{version} -p1 # Drop env shebangs from library modules that are not scripts, so they are not # flagged as non-executable-script. Only these two still carry one; the # mne/commands/*.py arm of the sed the Fedora spec used to do is now a no-op. sed -i -e '1{\@^#!/usr/bin/env python@d}' mne/stats/cluster_level.py sed -i -e '1{\@^#!/usr/bin/env python@d}' mne/datasets/hf_sef/hf_sef.py # Shipped as %%doc, but upstream has it mode 0755 with no shebang, which # rpmlint flags as spurious-executable-perm. It is the only such file in the # tree; everything under mne/ is normalised to 0644 by the wheel install. chmod 0644 examples/preprocessing/esg_rm_heart_artefact_pcaobs.py %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files -l %{upstream_name} %check # Keep matplotlib headless and stop mne from writing a config into the build # home; both are reached during import, not just under test. export MPLBACKEND=Agg export MNE_DONTWRITE_HOME=true # Import every installed module. mne uses lazy_loader, so "import mne" on its # own resolves almost nothing -- importing the whole tree is what actually # proves the generated Requires are complete. This is not a token check: it # covers 297 modules. # # Excluded: mne.gui builds a Qt application object at import time, which needs a # running display rather than just a Qt binding. mne.html_templates is data # rather than importable # code; and the two conftest modules are test scaffolding that upstream's hatch # exclude (which only covers mne/**/tests) leaves behind in the wheel. %pyproject_check_import -e 'mne.gui*' -e 'mne.html_templates*' -e '*conftest*' # Now the real suite, bounded. It was unrunnable until python-refleak was # packaged: mne/conftest.py:25 imports it unconditionally and it is the ROOT # conftest, so every selection died at collection. # # Three guards, each earned. COPR build 10827012 ran this suite for exactly # 5.00 h and was killed by the COPR timeout having produced ZERO pytest output # (see docs/python-mne-check-hang.md): # * an external `timeout` — the spec's own --session-timeout did NOT bound the # run, because it is not reliably enforced across pytest-xdist workers. # coreutils timeout is plugin-independent and cannot be defeated. # * no -n/xdist, for the same reason, and because the algorithms are already # threaded. # * PYTHONUNBUFFERED, so a kill does not take the whole log with it — that is # what made the original failure impossible to diagnose. # # The selection is the dependency-light core: I/O, annotations, events, # filtering and the coordinate transforms. Not the full suite, which needs # optional dependencies and downloads sample datasets over the network. export PYTHONUNBUFFERED=1 export MNE_SKIP_TESTING_DATASET_TESTS=true export MNE_SKIP_NETWORK_TESTS=1 export MNE_FORCE_SERIAL=true mkdir -p subjects timeout -k 60 1800 %{python3} -m pytest -o addopts= -v -W ignore::Warning \ --timeout=300 --timeout-method=signal \ --pyargs \ mne/tests/test_annotations.py \ mne/tests/test_defaults.py \ mne/tests/test_event.py \ mne/tests/test_filter.py \ mne/tests/test_line_endings.py \ mne/tests/test_ola.py \ mne/tests/test_transforms.py \ mne/io/tests/test_apply_function.py %files -n python3-%{upstream_name} -f %{pyproject_files} %doc README.rst %doc examples %{_bindir}/mne %changelog * Mon Sep 14 2026 Morgan Hough - 1.13.2-3 - Run upstream's test suite, bounded. It became possible today: the blocker was refleak, which mne's root conftest imports unconditionally and which Fedora does not package -- it is now packaged here as python-refleak 0.2.2. - Apply the two findings from the 1.12.1 five-hour %%check hang rather than rediscovering them: an EXTERNAL timeout, because --session-timeout is not enforced across pytest-xdist workers, and --timeout-method=signal, because the thread method cannot interrupt the BLAS/HDF5 C code mne sits in. No xdist. PYTHONUNBUFFERED so a kill cannot take the log with it. - %%pyproject_check_import stays: it covers all 297 installed modules, which is the packaging-correctness check the test suite does not give us. * Mon Sep 14 2026 Morgan Hough - 1.13.2-2 - Correct a wrong claim in the -1 spec: it said pyvista was not packaged, and excluded mne.viz.backends.* from %%pyproject_check_import on that basis. This COPR ships python3-pyvista 0.48.4 and python3-pyvistaqt 0.12.0; only Fedora proper does not, and the -1 check was run on a host without the COPR enabled. - Recommend both, so the 3D backend works on a normal install. - Un-exclude mne.viz.backends.*, taking %%check from 295 modules to 297. No pyvista BuildRequires is needed for that: mne/viz/backends/renderer.py selects its backend through importlib at call time and imports none at module level, and the one module that does import pyvista directly, _pyvista, is private and skipped by the macro regardless. Verified by building with the COPR repo absent. - mne.gui stays excluded, for the real reason: it constructs a Qt application at import time and so needs a display, not merely a Qt binding. * Sun Sep 13 2026 Morgan Hough - 1.13.2-1 - Reintroduce python-mne, at 1.13.2. Fedora retired the package ("Orphaned for 6+ weeks", src.fedoraproject.org rawhide c45d1ed), so it is reconstructed from the last live dist-git spec (f7fef1a, 1.9.0) and brought forward four minor releases. It was the one package in this COPR with no spec in git; its only build (10827012, 1.12.1-4) failed, and that SRPM and its logs have since been pruned, so there was nothing to recover from COPR either. - Build from git as an SCM package rather than an uploaded SRPM, per ci/PROCEDURES.md golden rule 1. - Explicit Release instead of %%autorelease. %%autorelease resolves to 1 on every build in this COPR (rpkg without rpmautospec), so rebuilds would never supersede -- ci/PROCEDURES.md gate 5. - Drop the SETUPTOOLS_SCM_PRETEND_VERSION exports. Upstream moved to hatchling/hatch-vcs and now carries a static version in [project] with no "dynamic" field, so the version needs no help from the environment. - Switch to BuildArch: noarch. There is no compiled code in the tree. - Cut the BuildRequires list down to python3-devel plus scikit-learn. The rest of the 1.9.0 list was either a test dependency for a suite that no longer runs, a package that no longer resolves (pyedflib is packaged nowhere; dipy and nilearn exist only in this COPR), or a dependency mne has since dropped outright (Traits, nitime, six, tempita, xlrd, nbformat, vtk, qt5). - Replace the accumulated -k skip list with %%pyproject_check_import over all 297 installed modules, which is what actually verifies the installed tree. The pytest suite is unrunnable until python-refleak is packaged; see %%check. - Narrow the shebang sed to the two files that still carry one; its mne/commands/*.py arm had silently become a no-op. - Drop the executable bit on the one example that ships 0755 without a shebang, clearing the only substantive rpmlint finding.