Skip to content

Commit

Permalink
Move requirements to pyproject.toml (mne-tools#12178)
Browse files Browse the repository at this point in the history
Co-authored-by: Eric Larson <[email protected]>
  • Loading branch information
hoechenberger and larsoner authored Nov 14, 2023
1 parent 16f4411 commit 22a6dc6
Show file tree
Hide file tree
Showing 24 changed files with 231 additions and 262 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ jobs:
brew install [email protected]
which python
which pip
pip install --upgrade pip setuptools wheel
pip install --upgrade --only-binary "numpy,scipy,dipy,statsmodels" -ve . -r requirements.txt -r requirements_testing.txt -r requirements_testing_extra.txt PyQt6
pip install --upgrade pip
pip install --upgrade --only-binary "numpy,scipy,dipy,statsmodels" -ve .[full,test_extra]
# 3D too slow on Apple's software renderer, and numba causes us problems
pip uninstall -y vtk pyvista pyvistaqt numba
mkdir -p test-results
Expand Down
12 changes: 1 addition & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ jobs:
- os: ubuntu-latest
python: '3.10'
kind: conda
- os: ubuntu-latest
python: '3.10'
kind: notebook
- os: ubuntu-latest
python: '3.11'
kind: pip-pre
Expand All @@ -87,7 +84,6 @@ jobs:
with:
qt: true
pyvista: false
if: matrix.kind != 'notebook'
# Python (if pip)
- uses: actions/setup-python@v4
with:
Expand All @@ -103,19 +99,13 @@ jobs:
miniforge-variant: Mambaforge
use-mamba: ${{ matrix.kind != 'conda' }}
if: ${{ !startswith(matrix.kind, 'pip') }}
- name: 'Install OSMesa VTK variant'
run: |
# TODO: As of 2023/02/28, notebook tests need a pinned mesalib
mamba install -c conda-forge "vtk>=9.2=*osmesa*" "vtk-base>=9.2=*osmesa*" "mesalib=23.1.4" "numpy=1.24.4" "numba=0.57.1"
mamba list
if: matrix.kind == 'notebook'
- run: ./tools/github_actions_dependencies.sh
# Minimal commands on Linux (macOS stalls)
- run: ./tools/get_minimal_commands.sh
if: ${{ startswith(matrix.os, 'ubuntu') }}
- run: ./tools/github_actions_install.sh
- run: ./tools/github_actions_infos.sh
# Check Qt on non-notebook
# Check Qt
- run: ./tools/check_qt_import.sh $MNE_QT_BACKEND
if: ${{ env.MNE_QT_BACKEND != '' }}
- name: Run tests with no testing data
Expand Down
6 changes: 0 additions & 6 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
include *.rst
include LICENSE.txt
include SECURITY.md
include requirements.txt
include requirements_base.txt
include requirements_hdf5.txt
include requirements_testing.txt
include requirements_testing_extra.txt
include requirements_doc.txt
include mne/__init__.py

recursive-include examples *.py
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ clean-cache:

clean: clean-build clean-pyc clean-so clean-ctags clean-cache

wheel_quiet:
$(PYTHON) setup.py -q sdist bdist_wheel
wheel:
$(PYTHON) -m build

sample_data:
@python -c "import mne; mne.datasets.sample.data_path(verbose=True);"
Expand Down Expand Up @@ -57,7 +57,7 @@ codespell: # running manually
check-manifest:
check-manifest -q --ignore .circleci/config.yml,doc,logo,mne/io/*/tests/data*,mne/io/tests/data,mne/preprocessing/tests/data,.DS_Store,mne/_version.py

check-readme: clean wheel_quiet
check-readme: clean wheel
twine check dist/*

nesting:
Expand Down
13 changes: 6 additions & 7 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ stages:
displayName: 'Get Python'
- bash: |
set -eo pipefail
python -m pip install --progress-bar off --upgrade pip setuptools wheel
python -m pip install --progress-bar off -r requirements_base.txt -r requirements_hdf5.txt -r requirements_testing.txt
python -m pip install --progress-bar off --upgrade pip build
python -m pip install --progress-bar off -ve .[hdf5,test]
python -m pip uninstall -yq pytest-qt # don't want to set up display, etc. for this
pre-commit install --install-hooks
displayName: Install dependencies
Expand Down Expand Up @@ -107,8 +107,8 @@ stages:
displayName: 'Get Python'
- bash: |
set -e
python -m pip install --progress-bar off --upgrade pip setuptools wheel
python -m pip install --progress-bar off "mne-qt-browser[opengl] @ git+https://github.com/mne-tools/mne-qt-browser.git@main" pyvista scikit-learn pytest-error-for-skips python-picard "PyQt6!=6.5.1" qtpy nibabel
python -m pip install --progress-bar off --upgrade pip
python -m pip install --progress-bar off "mne-qt-browser[opengl] @ git+https://github.com/mne-tools/mne-qt-browser.git@main" pyvista scikit-learn pytest-error-for-skips python-picard "PyQt6!=6.5.1" qtpy nibabel sphinx-gallery
python -m pip uninstall -yq mne
python -m pip install --progress-bar off --upgrade -e .[test]
displayName: 'Install dependencies with pip'
Expand Down Expand Up @@ -166,11 +166,10 @@ stages:
displayName: 'Get Python'
- bash: |
set -e
python -m pip install --progress-bar off --upgrade pip setuptools wheel
python -m pip install --progress-bar off --upgrade pip
python -m pip install --progress-bar off --upgrade --pre --only-binary=\"numpy,scipy,matplotlib,vtk\" numpy scipy matplotlib vtk
python -c "import vtk"
python -m pip install --progress-bar off --upgrade -r requirements.txt -r requirements_testing.txt -r requirements_testing_extra.txt
python -m pip install -e .
python -m pip install --progress-bar off --upgrade -ve .[full,test_extra]
displayName: 'Install dependencies with pip'
- bash: |
set -e
Expand Down
2 changes: 1 addition & 1 deletion doc/changes/v0.24.rst
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ Enhancements

- All functions for reading and writing files should now automatically handle ``~`` (the tilde character) and expand it to the user's home directory. Should you come across any function that doesn't do it, please do let us know! (:gh:`9613`, :gh:`9845` by `Richard Höchenberger`_)

- All functions accepting a FreeSurfer subjects directory via a ``subjects_dir`` parameter can now consume :py:class:`pathlib.Path` objects too (used to be only strings) (:gh:`9613` by `Richard Höchenberger`_)
- All functions accepting a FreeSurfer subjects directory via a ``subjects_dir`` parameter can now consume :class:`pathlib.Path` objects too (used to be only strings) (:gh:`9613` by `Richard Höchenberger`_)

- Add support for colormap normalization in :meth:`mne.time_frequency.AverageTFR.plot` (:gh:`9851` by `Clemens Brunner`_)

Expand Down
14 changes: 10 additions & 4 deletions doc/development/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,11 @@ be reflected the next time you open a Python interpreter and ``import mne``
Finally, we'll add a few dependencies that are not needed for running
MNE-Python, but are needed for locally running our test suite::

$ pip install -r requirements_testing.txt
$ pip install -e .[test]

And for building our documentation::

$ pip install -r requirements_doc.txt
$ pip install -e .[doc]
$ conda install graphviz

.. note::
Expand All @@ -329,9 +329,15 @@ To build documentation, you will also require `optipng`_:
- On Windows, unzip :file:`optipng.exe` from the `optipng for Windows`_ archive
into the :file:`doc/` folder. This step is optional for Windows users.

You can also choose to install some optional linters for reStructuredText::
There are additional optional dependencies needed to run various tests, such as
scikit-learn for decoding tests, or nibabel for MRI tests. If you want to run all the
tests, consider using our MNE installers (which provide these dependencies) or pay
attention to the skips that ``pytest`` reports and install the relevant libraries.
For example, this traceback::

$ conda install -c conda-forge sphinx-autobuild doc8
SKIPPED [2] mne/io/eyelink/tests/test_eyelink.py:14: could not import 'pandas': No module named 'pandas'

indicates that ``pandas`` needs to be installed in order to run the Eyelink tests.


.. _basic-git:
Expand Down
1 change: 0 additions & 1 deletion doc/links.inc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@

.. installation links
.. _requirements file: https://raw.githubusercontent.com/mne-tools/mne-python/main/requirements.txt
.. _NVIDIA CUDA GPU processing: https://developer.nvidia.com/cuda-zone
.. _NVIDIA proprietary drivers: https://www.geforce.com/drivers

Expand Down
2 changes: 2 additions & 0 deletions mne/epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1902,6 +1902,8 @@ def get_data(
.. versionchanged:: 1.7
The default changed from ``False`` to ``True``.
.. versionadded:: 1.6
%(verbose)s
Returns
Expand Down
20 changes: 13 additions & 7 deletions mne/viz/_brain/tests/test_brain.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# License: Simplified BSD

import os
import sys
import platform
from pathlib import Path
from shutil import copyfile

Expand Down Expand Up @@ -662,15 +662,20 @@ def test_single_hemi(hemi, renderer_interactive_pyvistaqt, brain_gc):

@testing.requires_testing_data
@pytest.mark.slowtest
def test_brain_save_movie(tmp_path, renderer, brain_gc):
@pytest.mark.parametrize("interactive_state", (False, True))
def test_brain_save_movie(tmp_path, renderer, brain_gc, interactive_state):
"""Test saving a movie of a Brain instance."""
from imageio_ffmpeg import count_frames_and_secs
imageio_ffmpeg = pytest.importorskip("imageio_ffmpeg")
# TODO: Figure out why this fails -- some imageio_ffmpeg error
if os.getenv("MNE_CI_KIND", "") == "conda" and platform.system() == "Linux":
pytest.skip("Test broken for unknown reason on conda linux")

brain = _create_testing_brain(
hemi="lh", time_viewer=False, cortex=["r", "b"]
) # custom binarized
filename = tmp_path / "brain_test.mov"
for interactive_state in (False, True):

try:
# for coverage, we set interactivity
if interactive_state:
brain._renderer.plotter.enable()
Expand All @@ -688,11 +693,12 @@ def test_brain_save_movie(tmp_path, renderer, brain_gc):
filename, time_dilation=1.0, tmin=tmin, tmax=tmax, interpolation="nearest"
)
assert filename.is_file()
_, nsecs = count_frames_and_secs(filename)
_, nsecs = imageio_ffmpeg.count_frames_and_secs(filename)
assert_allclose(duration, nsecs, atol=0.2)

os.remove(filename)
brain.close()
finally:
brain.close()


_TINY_SIZE = (350, 300)
Expand Down Expand Up @@ -1093,7 +1099,7 @@ def test_brain_traces(renderer_interactive_pyvistaqt, hemi, src, tmp_path, brain
# TODO: don't skip on Windows, see
# https://github.com/mne-tools/mne-python/pull/10935
# for some reason there is a dependency issue with ipympl even using pyvista
@pytest.mark.skipif(sys.platform == "win32", reason="ipympl issue on Windows")
@pytest.mark.skipif(platform.system() == "Windows", reason="ipympl issue on Windows")
@testing.requires_testing_data
def test_brain_scraper(renderer_interactive_pyvistaqt, brain_gc, tmp_path):
"""Test a simple scraping example."""
Expand Down
Loading

0 comments on commit 22a6dc6

Please sign in to comment.