Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move project config to pyproject.toml, remove BINDER support #1202

Merged
merged 8 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ jobs:
# restore cache from last build. Unless __init__.py has changed since then
- restore_cache:
keys:
- data-cache-5-{{ checksum "./mne_bids/__init__.py" }}
- data-cache-0-{{ checksum "./mne_bids/__init__.py" }}

# Also restore pip cache to speed up installations
- restore_cache:
keys:
- pip-cache-1-{{ checksum "./test_requirements.txt" }}-{{ checksum "./doc/requirements.txt" }}
- pip-cache-0-{{ checksum "./pyproject.toml" }}

- run:
name: Setup Python3 environment
Expand All @@ -41,10 +41,8 @@ jobs:
name: Install Python packages
command: |
python -m pip install --upgrade --progress-bar off pip
python -m pip install --upgrade --progress-bar off -r test_requirements.txt
python -m pip install --upgrade --progress-bar off -r doc/requirements.txt
python -m pip install --upgrade https://github.com/mne-tools/mne-python/archive/refs/heads/main.zip
python -m pip install -e .
python -m pip install -e .[test,doc]

- run:
name: Build the documentation
Expand All @@ -62,13 +60,13 @@ jobs:

# Store the data cache
- save_cache:
key: data-cache-5-{{ checksum "./mne_bids/__init__.py" }}
key: data-cache-0-{{ checksum "./mne_bids/__init__.py" }}
paths:
- ~/mne_data

# Store pip cache
- save_cache:
key: pip-cache-1-{{ checksum "./test_requirements.txt" }}-{{ checksum "./doc/requirements.txt" }}
key: pip-cache-0-{{ checksum "./pyproject.toml" }}
paths:
- ~/.cache/pip

Expand Down Expand Up @@ -112,7 +110,7 @@ jobs:

- restore_cache:
keys:
- pip-cache-1-{{ checksum "./test_requirements.txt" }}-{{ checksum "./doc/requirements.txt" }}
- pip-cache-0-{{ checksum "./pyproject.toml" }}

- run:
name: Setup Python3 environment
Expand All @@ -124,10 +122,8 @@ jobs:
name: Install Python packages
command: |
python -m pip install --upgrade --progress-bar off pip
python -m pip install --upgrade --progress-bar off -r test_requirements.txt
python -m pip install --upgrade --progress-bar off -r doc/requirements.txt
python -m pip install --upgrade https://github.com/mne-tools/mne-python/archive/refs/heads/main.zip
python -m pip install -e .
python -m pip install -e .[test,doc]

- run:
name: Check links
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ on:
branches: ['**']
pull_request:
branches: ['**']
create:
branches: [main]
tags: ['**']
schedule:
- cron: "0 4 * * *"

Expand All @@ -32,7 +29,7 @@ jobs:
- uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: style-0-${{ env.pythonLocation }}-${{ hashFiles('setup.cfg') }}-${{ hashFiles('test_requirements.txt') }}
key: style-0-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down Expand Up @@ -60,7 +57,7 @@ jobs:
- uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: build-2-${{ env.pythonLocation }}-${{ hashFiles('setup.cfg') }}-${{ hashFiles('test_requirements.txt') }}
key: build-0-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}

- name: Install dependencies
run: |
Expand Down Expand Up @@ -177,12 +174,13 @@ jobs:
uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: test-1-${{ env.pythonLocation }}-${{ env.os }}-${{ hashFiles('setup.cfg') }}-${{ hashFiles('test_requirements.txt') }}
key: test-0-${{ env.pythonLocation }}-${{ env.os }}-${{ hashFiles('pyproject.toml') }}

- name: Install Python dependencies using pip
# This would be nicer once this feature is implemented: https://github.com/pypa/pip/issues/11440
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade -r test_requirements.txt
python -m pip install -e .[test]

- name: Install MNE (stable)
if: matrix.mne-version == 'mne-stable'
Expand Down
14 changes: 1 addition & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,13 @@ Then, `git clone` your fork and install it in "editable" mode.
```Shell
git clone https://github.com/<your-GitHub-username>/mne-bids
cd ./mne-bids
pip install -e .[full]
pip install -e .[dev]
git config --local blame.ignoreRevsFile .git-blame-ignore-revs
```

The last command is needed for `git diff` to work properly.
You should now have both the `mne` and `mne-bids` development versions available in your Python environment.

### Install additional Python packages required for development

Navigate to the root of the `mne-bids` repository and call:

```Shell
pip install -r test_requirements.txt
pip install -r doc/requirements.txt
```

This will install several packages for running tests and building the documentation for `mne-bids`.

### Install the BIDS validator

For a complete development setup of `mne-bids`, it is necessary to install the
Expand Down Expand Up @@ -137,7 +126,6 @@ We suggest installing our git pre-commit hooks to automatically run style
checks before a commit is created:

```Shell
pip install pre-commit
pre-commit install
```

Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ exclude Makefile
exclude CONTRIBUTING.md
exclude *.yml
exclude .mailmap
exclude test_requirements.txt
exclude .gitignore
exclude .pre-commit-config.yaml
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test:
--doctest-modules \
--cov=mne_bids mne_bids/tests/ mne_bids/commands/tests/ \
--cov-report=xml \
--cov-config=setup.cfg \
--cov-config=pyproject.toml \
--verbose \
--ignore mne-python \
--ignore examples
Expand Down
23 changes: 0 additions & 23 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,6 @@
}
intersphinx_timeout = 5

# Resolve binder filepath_prefix. From the docs:
# "A prefix to append to the filepath in the Binder links. You should use this
# if you will store your built documentation in a sub-folder of a repository,
# instead of in the root."
# we will store dev docs in a `dev` subdirectory and all other docs in a
# directory "v" + version_str. E.g., "v0.3"
if "dev" in version:
filepath_prefix = "dev"
else:
filepath_prefix = "v{}".format(version)

sphinx_gallery_conf = {
"doc_module": "mne_bids",
"reference_url": {
Expand All @@ -193,16 +182,4 @@
"within_subsection_order": ExampleTitleSortKey,
"gallery_dirs": "auto_examples",
"filename_pattern": "^((?!sgskip).)*$",
"binder": {
# Required keys
"org": "mne-tools",
"repo": "mne-bids",
"branch": "gh-pages", # noqa: E501 Can be any branch, tag, or commit hash. Use a branch that hosts your docs.
"binderhub_url": "https://mybinder.org", # noqa: E501 Any URL of a binderhub deployment. Must be full URL (e.g. https://mybinder.org).
"filepath_prefix": filepath_prefix, # noqa: E501 A prefix to prepend to any filepaths in Binder links.
"dependencies": [
"../test_requirements.txt",
"./requirements.txt",
],
},
}
12 changes: 0 additions & 12 deletions doc/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions examples/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@ Examples
--------

The following examples demonstrate some common use-cases of MNE-BIDS.
Each example has a badge called "Binder" at the end. By clicking on that badge,
you can interactively run the examples in your browser.

The examples are loosely ordered from basic to more advanced use cases.
176 changes: 174 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,115 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "mne-bids"
description = "MNE-BIDS: Organizing MEG, EEG, and iEEG data according to the BIDS specification and facilitating their analysis with MNE-Python"
dynamic = ["version"]
authors = [
{ name = "MNE-BIDS Developers" },
]
maintainers = [
{ name = "Stefan Appelhoff", email = "[email protected]" },
]
license = { text = "BSD-3-Clause" }
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.9"
keywords = [
"meg",
"eeg",
"ieeg",
"bids",
"brain imaging data structure",
"neuroscience",
"neuroimaging",
]
classifiers = [
"Topic :: Scientific/Engineering",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"License :: OSI Approved",
"Topic :: Software Development",
"Topic :: Scientific/Engineering",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
"Programming Language :: Python",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
scripts = { mne_bids = "mne_bids.commands.run:main" }
dependencies = [
"mne>=1.5",
"numpy>=1.21.2",
"scipy>=1.7.1",
]
[project.optional-dependencies]
# Variants with dependencies that will get installed on top of those listed unter
# project.dependencies

# Dependencies for using all mne_bids features
full = [
"nibabel >= 3.2.1",
"pybv >= 0.7.5",
"eeglabio >= 0.0.2",
"pymatreader >= 0.0.30",
"matplotlib >= 3.5.0",
"pandas >= 1.3.2",
"EDFlib-Python >= 1.0.6", # drop once mne <1.7 is no longer supported
"edfio >= 0.2.1",
]

# Dependencies for running the test infrastructure
test = [
"mne_bids[full]",
"pytest",
"pytest-cov",
"pytest-sugar",
"check-manifest",
"pydocstyle",
"flake8",
"black",
]

# Dependencies for building the documentation
doc = [
"nilearn",
"sphinx",
"sphinx_gallery",
"sphinx-copybutton",
"pydata-sphinx-theme",
"numpydoc",
"matplotlib",
"pillow",
"pandas",
"mne-nirs @ https://github.com/mne-tools/mne-nirs/archive/refs/heads/main.zip",
"seaborn",
"openneuro-py",
]

# Dependencies for developer installations
dev = ["mne_bids[test,doc,full]", "pre-commit"]

[project.urls]
"Homepage" = "https://mne.tools/mne-bids"
"Download" = "https://pypi.org/project/mne-bids/#files"
"Bug Tracker" = "https://github.com/mne-tools/mne-bids/issues/"
"Documentation" = "https://mne.tools/mne-bids"
"Forum" = "https://mne.discourse.group/"
"Source Code" = "https://github.com/mne-tools/mne-bids"

[tool.setuptools.packages.find]
where = ["."]
include = ["mne_bids"]
exclude = ["tests"]
namespaces = false

[tool.setuptools.dynamic]
version = {attr = "mne_bids.__version__"}

[tool.ruff]
select = ["E", "F", "W", "D"]
exclude = ["__init__.py"]
Expand All @@ -8,5 +120,65 @@ convention = "numpy"
[tool.black]
exclude = "(dist/)|(build/)|(.*\\.ipynb)"

[tool.check-manifest]
ignore = [".pre-commit-config.yaml"]
[tool.coverage.run]
omit = [
"*tests*",
]

[tool.coverage.report]
# Regexes for lines to exclude from consideration
exclude_lines = [
"pragma: no cover",
"if 0:",
"if __name__ == .__main__.:",
]

[tool.isort]
skip_glob = "*/*"

[tool.pydocstyle]
convention = "pep257"
match_dir = "^(?!\\.|doc|examples).*$"
add-ignore = ["D100", "D104", "D107", "D413"]
add-select = ["D214", "D215", "D404", "D405", "D406", "D407", "D408", "D409", "D410", "D411"]
ignore-decorators = "property"

[tool.flake8]
max-line-length = 88
exclude = "__init__.py"
ignore = ["I101", "I100", "I201"]
extend-ignore = ["W503", "E203"]
per-file-ignores = [
"mne_bids/commands/tests/test_*.py:E402",
"mne_bids/tests/test_*.py:E402",
]

[tool.pytest]
addopts = """--durations=20 -ra --junit-xml=junit-results.xml --tb=short
--ignore=doc --ignore=examples --ignore=mne_bids/tests/data"""
filterwarnings = [
"error",
"ignore:Estimation of line frequency only supports.*:RuntimeWarning",
"ignore:There are channels without locations (n/a)*:RuntimeWarning",
"ignore:Did not find any electrodes.tsv.*:RuntimeWarning",
"ignore:Did not find any coordsystem.json.*:RuntimeWarning",
"ignore:Did not find any events.tsv.*:RuntimeWarning",
"ignore:No events found or provided.*:RuntimeWarning",
"ignore:Participants file not found for.*:RuntimeWarning",
"ignore:Converting to FIF for anonymization:RuntimeWarning",
"ignore:Converting to BV for anonymization:RuntimeWarning",
"ignore:Converting data files to BrainVision format:RuntimeWarning",
"ignore:Writing of electrodes.tsv is not supported for datatype.*:RuntimeWarning",
"ignore:numpy.ufunc size changed.*:RuntimeWarning",
"ignore:tostring\\(\\) is deprecated.*:DeprecationWarning",
"ignore:MEG ref channel RMSP did not.*:RuntimeWarning",
"ignore:`product` is deprecated as of NumPy.*:DeprecationWarning",
# Python 3.10+ and NumPy 1.22 (and maybe also newer NumPy versions?)
"ignore:.*distutils\\.sysconfig module is deprecated.*:DeprecationWarning",
# numba with NumPy dev
"ignore:`np.MachAr` is deprecated.*:DeprecationWarning",
# old MNE _fake_click
"ignore:The .*_event function was deprecated in Matplotlib.*:",
"ignore:datetime\\.datetime\\.utcfromtimestamp.* is deprecated and scheduled for removal in a future version.*:DeprecationWarning",
]

Loading
Loading