%global upstream_name mne Name: python-mne Version: 1.13.2 Release: 2%{?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 %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*' # Upstream's pytest suite is deliberately not run, because it cannot currently # run here at all. Its root conftest does an unconditional # from refleak.testing import Snapshot, assert_no_instances, gc_collect_once # at mne/conftest.py:25, and refleak is not packaged in Fedora. Verified in # mock: every selection, down to a single test file, dies at collection with # ImportError while loading conftest '.../mne/conftest.py' # E ModuleNotFoundError: No module named 'refleak' # so there is no subset worth selecting and no -k expression that helps. # Packaging python-refleak (pure Python, currently 0.2.2) is what would unblock # it; that is the one thing standing between this spec and a real test run. %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-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.