Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/mne-tools/mne-python into e…
Browse files Browse the repository at this point in the history
…poch_reject
  • Loading branch information
withmywoessner committed Jan 5, 2024
2 parents fbe4cd2 + 596122d commit ee599a7
Show file tree
Hide file tree
Showing 140 changed files with 1,597 additions and 1,281 deletions.
56 changes: 56 additions & 0 deletions .github/actions/rename_towncrier/rename_towncrier.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env python3

# Adapted from action-towncrier-changelog
import json
import os
import re
import subprocess
import sys
from pathlib import Path

from github import Github
from tomllib import loads

event_name = os.getenv('GITHUB_EVENT_NAME', 'pull_request')
if not event_name.startswith('pull_request'):
print(f'No-op for {event_name}')
sys.exit(0)
if 'GITHUB_EVENT_PATH' in os.environ:
with open(os.environ['GITHUB_EVENT_PATH'], encoding='utf-8') as fin:
event = json.load(fin)
pr_num = event['number']
basereponame = event['pull_request']['base']['repo']['full_name']
real = True
else: # local testing
pr_num = 12318 # added some towncrier files
basereponame = "mne-tools/mne-python"
real = False

g = Github(os.environ.get('GITHUB_TOKEN'))
baserepo = g.get_repo(basereponame)

# Grab config from upstream's default branch
toml_cfg = loads(Path("pyproject.toml").read_text("utf-8"))

config = toml_cfg["tool"]["towncrier"]
pr = baserepo.get_pull(pr_num)
modified_files = [f.filename for f in pr.get_files()]

# Get types from config
types = [ent["directory"] for ent in toml_cfg["tool"]["towncrier"]["type"]]
type_pipe = "|".join(types)

# Get files that potentially match the types
directory = toml_cfg["tool"]["towncrier"]["directory"]
assert directory.endswith("/"), directory

file_re = re.compile(rf"^{directory}({type_pipe})\.rst$")
found_stubs = [
f for f in modified_files if file_re.match(f)
]
for stub in found_stubs:
fro = stub
to = file_re.sub(rf"{directory}{pr_num}.\1.rst", fro)
print(f"Renaming {fro} to {to}")
if real:
subprocess.check_call(["mv", fro, to])
21 changes: 21 additions & 0 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: autofix.ci

on: # yamllint disable-line rule:truthy
pull_request:
types: [opened, synchronize, labeled, unlabeled]

permissions:
contents: read

jobs:
autofix:
name: Autoupdate changelog entry
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: pip install --upgrade towncrier pygithub
- run: python ./.github/actions/rename_towncrier/rename_towncrier.py
- uses: autofix-ci/action@ea32e3a12414e6d3183163c3424a7d7a8631ad84
15 changes: 15 additions & 0 deletions .github/workflows/check_changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Changelog

on: # yamllint disable-line rule:truthy
pull_request:
types: [opened, synchronize, labeled, unlabeled]

jobs:
changelog_checker:
name: Check towncrier entry in doc/changes/devel/
runs-on: ubuntu-latest
steps:
- uses: larsoner/action-towncrier-changelog@co # revert to scientific-python @ 0.1.1 once bug is fixed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BOT_USERNAME: changelog-bot
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -56,7 +56,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -69,4 +69,4 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
Expand All @@ -28,7 +28,7 @@ jobs:
pip install build twine
- run: python -m build --sdist --wheel
- run: twine check --strict dist/*
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist
Expand All @@ -43,7 +43,7 @@ jobs:
name: pypi
url: https://pypi.org/p/mne
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
timeout-minutes: 3
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: pre-commit/action@v3.0.0
Expand Down Expand Up @@ -84,25 +84,24 @@ jobs:
qt: true
pyvista: false
# Python (if pip)
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
if: startswith(matrix.kind, 'pip')
# Python (if conda)
- uses: conda-incubator/setup-miniconda@v3
- uses: mamba-org/setup-micromamba@v1
with:
python-version: ${{ env.PYTHON_VERSION }}
environment-file: ${{ env.CONDA_ENV }}
activate-environment: mne
miniforge-version: latest
miniforge-variant: Mambaforge
use-mamba: ${{ matrix.kind != 'conda' }}
environment-name: mne
create-args: >-
python=${{ env.PYTHON_VERSION }}
mamba
fmt!=10.2.0
if: ${{ !startswith(matrix.kind, 'pip') }}
- 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
- run: ./tools/check_qt_import.sh $MNE_QT_BACKEND
Expand Down
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@ junit-results.xml
*.tmproj
*.png
*.dat
# make sure we ship data files
!mne/data/**/*.dat
!mne/data/**/*.fif
!mne/data/**/*.fif.gz
!mne/icons/**/*.png
.DS_Store
events.eve
foo-lh.label
foo.lout
bar.lout
foobar.lout
epochs_data.mat
memmap*.dat
tmp-*.w
tmtags
auto_examples
Expand All @@ -41,7 +45,6 @@ MNE-brainstorm-data*
physionet-sleep-data*
MEGSIM*
build
mne/_version.py
coverage
htmlcov
.cache/
Expand All @@ -63,11 +66,11 @@ tutorials/misc/report.h5
tutorials/io/fnirs.csv
pip-log.txt
.coverage*
!.coveragerc
coverage.xml
tags
doc/coverages
doc/samples
doc/*.dat
doc/fil-result
doc/optipng.exe
sg_execution_times.rst
Expand All @@ -94,6 +97,7 @@ cover
.venv/
venv/
*.json
!codemeta.json
.hypothesis/
.ruff_cache/
.ipynb_checkpoints/
9 changes: 3 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:
# Ruff mne
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
rev: v0.1.9
hooks:
- id: ruff
name: ruff lint mne
Expand All @@ -13,7 +13,7 @@ repos:

# Ruff tutorials and examples
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
rev: v0.1.9
hooks:
- id: ruff
name: ruff lint tutorials and examples
Expand Down Expand Up @@ -53,12 +53,9 @@ repos:

# mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
rev: v1.8.0
hooks:
- id: mypy
# Avoid the conflict between mne/__init__.py and mne/__init__.pyi by ignoring the former
exclude: ^mne/(beamformer|channels|commands|datasets|decoding|export|forward|gui|html_templates|inverse_sparse|io|minimum_norm|preprocessing|report|simulation|source_space|stats|time_frequency|utils|viz)?/?__init__\.py$
additional_dependencies: ["numpy==1.26.2"]

ci:
autofix_prs: false
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ MNE-Python is maintained by a community of scientists and research labs. The pro

Users and contributors to MNE-Python are expected to follow our [code of conduct](https://github.com/mne-tools/.github/blob/main/CODE_OF_CONDUCT.md).

The [contributing guide](https://mne.tools/dev/install/contributing.html) has details on the preferred contribution workflow
The [contributing guide](https://mne.tools/dev/development/contributing.html) has details on the preferred contribution workflow
and the recommended system configuration for a smooth contribution/development experience.
31 changes: 9 additions & 22 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
Copyright © 2011-2022, authors of MNE-Python
All rights reserved.
Copyright 2011-2023 MNE-Python authors

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
86 changes: 0 additions & 86 deletions MANIFEST.in

This file was deleted.

Loading

0 comments on commit ee599a7

Please sign in to comment.