a5264cb
#global commit  f44636f00666b8eb869417960926d01690ff4f42
a5264cb
#global shortcommit #(c=#{commit}; echo ${c:0:7})
a5264cb
#global checkout_date 2023094
Packit fdc2c8d
%global upstream_version  1.6.1
c546f91
c980313
# setup.py does not list all requirements, and we also unbundle quite a few
c980313
# from the externals folder, so we can't only rely on the automatic generator
c980313
# here.
c980313
# Additionally, requirements.txt seems to be dev requirements, and is not used
c980313
# in setup.py for install_requires.
c980313
53011d9
Name:           python-mne
c546f91
c546f91
%if "0%{?commit}" != "0"
c546f91
Version:        %{upstream_version}^%{checkout_date}git%{shortcommit}
c546f91
%global python_version  %{upstream_version}.dev%{checkout_date}
c546f91
%else
c546f91
Version:        %{upstream_version}
c546f91
%global python_version  %{version}
c546f91
%endif
c546f91
d0e49cc
Release:        %autorelease
b202460
Summary:        Magnetoencephalography (MEG) and Electroencephalography (EEG) data analysis
b202460
b202460
# Bundled FieldTrip
b202460
# https://github.com/fieldtrip/fieldtrip/blob/master/realtime/src/buffer/python/FieldTrip.py
b202460
# Not possible to package because it is matlab package with some plugins
b202460
35eebc3
# SPDX
35eebc3
License:        BSD-3-Clause
b202460
URL:            http://martinos.org/mne/
c546f91
c546f91
c546f91
%if "0%{?commit}" != "0"
c546f91
Source0:        https://github.com/mne-tools/mne-python/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
c546f91
%else
b202460
Source0:        https://github.com/mne-tools/mne-python/archive/v%{version}/%{name}-%{version}.tar.gz
c546f91
%endif
c546f91
b202460
#Source1:        https://s3.amazonaws.com/mne-python/datasets/MNE-sample-data-processed.tar.gz
4e3d02f
ab85da9
# Fix pandas test
ab85da9
# https://github.com/mne-tools/mne-python/pull/12347
ab85da9
Patch:          https://patch-diff.githubusercontent.com/raw/mne-tools/mne-python/pull/12347.patch
ab85da9
4e3d02f
# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
4e3d02f
ExcludeArch:    %{ix86}
4e3d02f
352233f
# The base package is arched to make it easier for us to detect arch-dependent
352233f
# test failures, since the tests will always be run on every platform, and
352233f
# easier for us to skip failing tests if necessary, since we can be sure that
352233f
# %%ifarch macros work as expected.
5b08540
#
5b08540
# Since the package still contains no compiled machine code, we still have no
5b08540
# debuginfo.
5b08540
%global debug_package %{nil}
5b08540
fdb1b9d
BuildRequires:  python3-devel
b202460
fdb1b9d
%global _description %{expand:
b202460
This package is designed for sensor- and source-space analysis of M-EEG data,
b202460
including frequency-domain and time-frequency analyses and non-parametric
fdb1b9d
statistics.}
b202460
fdb1b9d
%description %_description
c980313
53011d9
%package -n python3-mne
b202460
Summary:        %{summary}
5b08540
352233f
# This package is now arched because some dependencies are not available on
352233f
# every architecture.
5b08540
b202460
Provides:       bundled(bootstrap)
b202460
Provides:       bundled(js-jquery)
b202460
Provides:       bundled(js-jquery-ui)
b202460
Provides:       bundled(js-d3)
b202460
Provides:       bundled(js-mpld3)
b202460
Provides:       bundled(python3-FieldTrip)
7e59b9e
BuildRequires:  python3-setuptools
b202460
BuildRequires:  python3-numpy
cd3234b
BuildRequires:  python3-scipy
cd3234b
b202460
# Test deps
c980313
BuildRequires:  python3-pytest
cd3234b
BuildRequires:  python3-pytest-mock
cd3234b
BuildRequires:  python3-pytest-xdist
cd3234b
BuildRequires:  python3-pytest-timeout
b202460
BuildRequires:  python3-matplotlib
cd3234b
BuildRequires:  python3-pandas
cd3234b
BuildRequires:  python3-h5py
7e59b9e
BuildRequires:  python3-decorator
352233f
%ifnarch s390x
352233f
# https://bugzilla.redhat.com/show_bug.cgi?id=2116690
cd3234b
BuildRequires:  python3-pymatreader
352233f
%endif
7e59b9e
BuildRequires:  python3-h5io
a472822
BuildRequires:  python3-jinja2
b202460
BuildRequires:  python3-scikit-learn
b202460
BuildRequires:  python3-Traits
cd3234b
BuildRequires:  python3-tqdm
cd3234b
BuildRequires:  python3-nibabel
c5f8697
%ifnarch s390x
53011d9
BuildRequires:  python3-pyedflib
c5f8697
%endif
cd3234b
BuildRequires:  python3-nilearn
cd3234b
BuildRequires:  python3-qt5
cd3234b
BuildRequires:  python3-dipy
cd3234b
BuildRequires:  python3-xlrd
77786f5
BuildRequires:  python3-nitime
fdb1b9d
BuildRequires:  python3-pooch
53011d9
BuildRequires:  python3-nbformat
53011d9
BuildRequires:  python3-vtk
53011d9
# Makes pytest segfault
53011d9
# BuildRequires:  python3-mayavi
cd3234b
b202460
Requires:       python3-matplotlib
7e59b9e
Requires:       python3-decorator
7e59b9e
Requires:       python3-h5io
7e59b9e
Requires:       python3-six
7e59b9e
Requires:       python3-tempita
77786f5
Requires:       python3-tqdm
352233f
%ifnarch s390x
a2e354a
Requires:       python3-pymatreader
352233f
%endif
b202460
Recommends:     python3-scikit-learn
b202460
Recommends:     python3-pandas
b202460
Recommends:     python3-patsy
b202460
Recommends:     python3-pillow
b202460
Recommends:     python3-h5py
b202460
Recommends:     python3-statsmodels
b202460
Recommends:     python3-Traits
b202460
c980313
# Should be included by the dep generator as they're mentioned in setup.py
c980313
# Requires:       python3-numpy
c980313
# Requires:       python3-scipy
c980313
53011d9
%description -n python3-mne %_description
b202460
b202460
%prep
c546f91
%if "0%{?commit}" != "0"
5466316
%autosetup -n mne-python-%{commit} -p1
c546f91
%else
5466316
%autosetup -n mne-python-%{version} -p1
c546f91
%endif
feabee8
a472822
# fix non-executable scripts
53011d9
sed -i -e '1{\@^#!/usr/bin/env python@d}' mne/commands/*.py
a472822
sed -i -e '1{\@^#!/usr/bin/env python@d}' mne/datasets/hf_sef/hf_sef.py
a472822
sed -i -e '1{\@^#!/usr/bin/env python@d}' mne/stats/cluster_level.py
a472822
469e2f7
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters
469e2f7
sed -r -i 's/--cov[^[:blank:]]+//g' pyproject.toml
469e2f7
53011d9
53011d9
%generate_buildrequires
c546f91
export SETUPTOOLS_SCM_PRETEND_VERSION='%{python_version}'
3451099
%pyproject_buildrequires
b202460
b202460
#cp -p %{SOURCE1} .
b202460
#python -c "import mne; mne.datasets.sample.data_path(verbose=True, download=False)"
b202460
b202460
%build
c546f91
export SETUPTOOLS_SCM_PRETEND_VERSION='%{python_version}'
fdb1b9d
%pyproject_wheel
b202460
b202460
%install
c546f91
export SETUPTOOLS_SCM_PRETEND_VERSION='%{python_version}'
fdb1b9d
%pyproject_install
2673145
%pyproject_save_files -l mne
b202460
b202460
%check
c546f91
export SETUPTOOLS_SCM_PRETEND_VERSION='%{python_version}'
b202460
export MNE_SKIP_TESTING_DATASET_TESTS=true
b202460
export MNE_SKIP_NETWORK_TESTS=1
cd3234b
export MNE_DONTWRITE_HOME=true
cd3234b
export MNE_FORCE_SERIAL=true
cd3234b
cd3234b
# Deselected tests require additional data or don't work in mock
1d6fcde
# Two deselected for sklearn warnings
8acae74
ignore="${ignore-} --ignore=mne/datasets/tests/test_datasets.py"
8acae74
ignore="${ignore-} --ignore=mne/utils/tests/test_numerics.py"
1d6fcde
# Tools directory ignored as it contains tests for upstream release process
fbf2d29
fdb1b9d
# required for some tests
fdb1b9d
mkdir subjects
fdb1b9d
fc5034c
# Hangs:
fc5034c
k="${k-}${k+ and }not test_thresholds[NumPy]"
e95e275
# FileNotFoundError (file 'test_eyelink.asc' not in repo):
e95e275
k="${k-}${k+ and }not test_annotations_without_offset"
7d6ffee
%ifarch s390x || ppc64le
7d6ffee
# Test fails on s390x and ppc64le.
7d6ffee
k="${k-}${k+ and }not test_spectrum_complex[welch-False]"
7d6ffee
%endif
fc5034c
a472822
# https://github.com/mne-tools/mne-python/blob/v1.0.3/tools/github_actions_test.sh#L7
a472822
# skip tests that require network
72f5382
m='not (slowtest or pgtest)'
72f5382
72f5382
# Erroring on DeprecationWarnings makes sense upstream, but is probably too
72f5382
# strict for distribution packaging.
72f5382
%pytest -v -m "${m}" ${ignore-} -k "${k-}" -W 'ignore::DeprecationWarning'
cd3234b
b202460
53011d9
%files -n python3-mne -f %{pyproject_files}
c980313
%doc README.rst examples
53011d9
%{_bindir}/mne
b202460
b202460
%changelog
d0e49cc
%autochangelog