From 6500615f517fcc3f01815060109d9290df5e89c0 Mon Sep 17 00:00:00 2001 From: Stefan Appelhoff Date: Sat, 23 Nov 2024 21:40:17 +0100 Subject: [PATCH] misc maintenance (#124) * misc maintenance * ditch os.path * fixes * remove Makefile, add pypi trusted publishing --- .github/CONTRIBUTING.md | 82 +++++++++++----------------- .github/dependabot.yml | 2 + .github/workflows/python_build.yml | 33 +++++++---- .github/workflows/python_publish.yml | 31 ----------- .github/workflows/python_tests.yml | 35 +++++++----- .github/workflows/release.yml | 52 ++++++++++++++++++ .gitignore | 4 ++ MANIFEST.in | 1 - Makefile | 28 ---------- README.rst | 55 +++++++++++++------ docs/conf.py | 9 +-- docs/index.rst | 5 ++ pybv/io.py | 26 +++++---- pybv/tests/test_write_brainvision.py | 17 +++--- pyproject.toml | 12 ++++ 15 files changed, 217 insertions(+), 175 deletions(-) delete mode 100644 .github/workflows/python_publish.yml create mode 100644 .github/workflows/release.yml delete mode 100755 Makefile diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 2d286f1..5f55764 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -20,7 +20,8 @@ Then, in your Python environment follow these steps: ```Shell git clone https://github.com/USERNAME/pybv cd pybv -pip install -e ".[dev]" +git fetch --tags --prune --prune-tags +python -m pip install -e ".[dev]" pre-commit install ``` @@ -33,21 +34,15 @@ See https://pre-commit.com/ for more information. ## Running tests and coverage If you have followed the steps to get the development version, -you can run tests by making use of the `Makefile` and -[GNU Make](https://www.gnu.org/software/make/). +you can run tests as follows. From the project root, call: -- `make test` to run tests and coverage +- `pytest` to run tests and coverage - `pre-commit run -a` to run style checks (Ruff and some additional hooks) ## Building the documentation The documentation can be built using [Sphinx](https://www.sphinx-doc.org). -Again, assuming that you followed the steps to get the development version, -you can use the `Makefile`. -From the project root, call: - -- `make build-doc` to build the documentation and open a browser window to view it The publicly accessible documentation is built and hosted by [Read the Docs](https://readthedocs.org/). @@ -56,6 +51,9 @@ Credentials for Read the Docs are currently held by: - [@sappelhoff](https://github.com/sappelhoff/) - [@choldgraf](https://github.com/choldgraf/) +## Info about versioning + +We follow a [semantic versioning scheme](https://semver.org/). ## Making a release on GitHub, PyPi, and Conda-Forge @@ -67,64 +65,48 @@ and [Conda-Forge](https://anaconda.org/conda-forge/pybv). Credentials are currently held by: - GitHub - - Admin - - any admin of the [bids-standard GitHub organization](https://github.com/bids-standard) - - [@sappelhoff](https://github.com/sappelhoff/) - - [@choldgraf](https://github.com/choldgraf/) - - [@cbrnr](https://github.com/cbrnr/) - - Write - - [@hoechenberger](https://github.com/hoechenberger/) + - Admin + - any admin of the [bids-standard GitHub organization](https://github.com/bids-standard) + - [@sappelhoff](https://github.com/sappelhoff/) + - [@choldgraf](https://github.com/choldgraf/) + - [@cbrnr](https://github.com/cbrnr/) + - Write + - [@hoechenberger](https://github.com/hoechenberger/) - PyPi - - Owner - - [@sappelhoff](https://github.com/sappelhoff/) - - [@choldgraf](https://github.com/choldgraf/) - - Maintainer - - [@cbrnr](https://github.com/cbrnr/) + - Owner + - [@sappelhoff](https://github.com/sappelhoff/) + - [@choldgraf](https://github.com/choldgraf/) + - Maintainer + - [@cbrnr](https://github.com/cbrnr/) - Conda-Forge - - see: https://github.com/conda-forge/pybv-feedstock#feedstock-maintainers + - see: https://github.com/conda-forge/pybv-feedstock#feedstock-maintainers Releasing on GitHub will automatically trigger a release on PyPi via a GitHub Action -(The credentials for PyPi are stored as "GitHub Secrets"). +(see `.github/workflows/release.yml`). A release on PyPi in turn will automatically trigger a release on Conda-Forge. -Thus, the release protocol can be briefly described as follows: +The release protocol can be briefly described as follows: -1. You will need admin rights for the `pybv` GitHub repository. -1. Go to your Python environment for `pybv`. +1. Activate your Python environment for `pybv`. 1. Make sure all tests pass and the docs are built cleanly. -1. Update the `__version__` variable in `__init__.py`: - - Remove the `.devN` suffix. - - If the version preceding the `.devN` suffix is not the version to be - released, update the version as well according to - [semantic versioning](https://semver.org/) with its `major.minor.patch` - style. 1. If applicable, append new authors to the author metadata in the `CITATION.cff` file. -1. Update `docs/changelog.rst`, renaming the "current" headline to the new - version and (if applicable) extending the "Authors" section of the document. - - "Authors" are all people who committed code or in other ways contributed - to `pybv` (e.g., by extensively reviewing PRs). -1. Commit the change and git push to `main` (or make a pull request and merge it). +1. Update `docs/changes.rst`, renaming the "current" headline to the new + version +1. Commit the change and git push to upstream `main`. Include "REL" in your commit message. -1. Then, make an annotated tag `git tag -a -m "v1.2.3" v1.2.3 upstream/main` (This - assumes that you have a git remote configured with the name "upstream" and - pointing to https://github.com/bids-standard/pybv). Note also that the - version from `__init__.py` is preprended with a `v`: `1.2.3` --> `v1.2.3` +1. Then, make an annotated tag, for example for the version `1.2.3`: + `git tag -a -m "1.2.3" 1.2.3 upstream/main` + (This assumes that you have a git remote configured with the name "upstream" and + pointing to https://github.com/bids-standard/pybv). **NOTE: Make sure you have your `main` branch up to date for this step!** 1. `git push --follow-tags upstream` 1. Make a [release on GitHub](https://help.github.com/en/articles/creating-releases), - using the git tag from the previous step (e.g., `v1.2.3`). + using the git tag from the previous step (e.g., `1.2.3`). Fill the tag name into the "Release title" field, and fill the "Description" field as you see fit. 1. This will trigger a GitHub Action that will build the package and release it to PyPi. -1. The PyPi release will trigger a release on Conda-Forge. Then the release is done and `main` has to be prepared for development of the next release: -1. Update the `__version__` variable in `__init__.py`: - - Bump up the `major.minor.patch` version according to - [semantic versioning](https://semver.org/) so that the version will be - the version that is planned to be released next (e.g., `1.3.0`). - - Append `.dev0` to the version (e.g., `1.3.0.dev0`). - - (if you had a version like `1.3.0.dev0` before, release `1.3.0.dev1` instead, etc.) -1. Add a "Current (unreleased)" headline to `docs/changelog.rst`. +1. Add a "Current (unreleased)" headline to `docs/changes.rst`. 1. Commit the changes and git push to `main` (or make a pull request). diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5ace460..65f2296 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,3 +1,5 @@ +# Documentation +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file version: 2 updates: - package-ecosystem: "github-actions" diff --git a/.github/workflows/python_build.yml b/.github/workflows/python_build.yml index 65d7d34..e2de531 100644 --- a/.github/workflows/python_build.yml +++ b/.github/workflows/python_build.yml @@ -6,11 +6,11 @@ concurrency: on: push: - branches: [main] + branches: [ main ] pull_request: - branches: [main] + branches: [ main ] schedule: - - cron: "0 4 1 * *" + - cron: "0 4 * * MON" jobs: build: @@ -19,38 +19,51 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ["3.10", "3.11", "3.12"] + python-version: ["3.12"] + env: + TZ: Europe/Berlin + FORCE_COLOR: true steps: - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies + - name: Update pip etc. run: | python -m pip install --upgrade pip - python -m pip install --upgrade setuptools wheel build + python -m pip install --upgrade setuptools wheel build twine - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true - name: Build sdist run: python -m build --sdist + - name: Check sdist + run: twine check --strict dist/* - name: Install sdist - run: pip install ./dist/pybv-* + run: python -m pip install ./dist/pybv-* - name: Clean up working directory run: rm -rf ./* - name: Try importing pybv run: python -c 'import pybv; print(pybv.__version__)' - name: Remove sdist install - run: pip uninstall -y pybv + run: python -m pip uninstall -y pybv - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true - name: Build wheel run: python -m build --wheel + - name: Check wheel + run: twine check --strict dist/* - name: Install wheel - run: pip install ./dist/pybv-*.whl + run: python -m pip install ./dist/pybv-*.whl - name: Clean up working directory run: rm -rf ./* - name: Try importing pybv run: python -c 'import pybv; print(pybv.__version__)' - name: Remove wheel install - run: pip uninstall -y pybv + run: python -m pip uninstall -y pybv diff --git a/.github/workflows/python_publish.yml b/.github/workflows/python_publish.yml deleted file mode 100644 index bc056b1..0000000 --- a/.github/workflows/python_publish.yml +++ /dev/null @@ -1,31 +0,0 @@ -# This workflows will upload a Python Package using Twine when a release is created -# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries - -name: Upload Python Package - -on: - release: - types: [created] - -jobs: - deploy: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install --upgrade setuptools wheel build twine - - name: Build and publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - make dist-build - twine upload dist/* diff --git a/.github/workflows/python_tests.yml b/.github/workflows/python_tests.yml index faadc82..ee34557 100644 --- a/.github/workflows/python_tests.yml +++ b/.github/workflows/python_tests.yml @@ -6,11 +6,11 @@ concurrency: on: push: - branches: [main] + branches: [ main ] pull_request: - branches: [main] + branches: [ main ] schedule: - - cron: "0 4 1 * *" + - cron: "0 4 * * MON" jobs: @@ -29,29 +29,36 @@ jobs: python-version: "3.12" mne-version: mne-main + runs-on: ${{ matrix.platform }} + env: TZ: Europe/Berlin FORCE_COLOR: true - - runs-on: ${{ matrix.platform }} - steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - uses: actions/cache@v4 + with: + path: ${{ env.pythonLocation }} + key: v-0-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }} + - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install -e .[dev] + python -m pip install -e ".[dev]" - - name: install MNE-Python main + - name: Install MNE-Python main (development version) if: matrix.mne-version == 'mne-main' run: | - pip install -U https://github.com/mne-tools/mne-python/archive/refs/heads/main.zip + python -m pip install -U https://github.com/mne-tools/mne-python/archive/refs/heads/main.zip - name: Display versions and environment information run: | @@ -62,17 +69,19 @@ jobs: mne sys_info - name: Check formatting + if: matrix.platform == 'ubuntu-latest' run: | - make check-manifest + check-manifest pre-commit run --all-files - name: Test with pytest - run: | - make test + # Options defined in pyproject.toml + run: pytest - name: Build docs run: | - make build-doc + make -C docs/ clean + make -C docs/ html - name: Upload artifacts if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.12' && matrix.mne-version == 'mne-stable'}} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..6674117 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,52 @@ +# Upload a Python Package using Twine when a release is created + +name: release +on: # yamllint disable-line rule:truthy + release: + types: [published] + push: + branches: + - main + pull_request: + branches: + - main + +permissions: + contents: read + +jobs: + package: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install --upgrade setuptools wheel build twine + - run: python -m build --sdist --wheel + - run: twine check --strict dist/* + - uses: actions/upload-artifact@v4 + with: + name: dist + path: dist + include-hidden-files: true + + pypi-upload: + needs: package + runs-on: ubuntu-latest + if: github.event_name == 'release' + permissions: + id-token: write # for trusted publishing + environment: + name: pypi + url: https://pypi.org/p/pybv + steps: + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist + - uses: pypa/gh-action-pypi-publish@release/v1 + if: github.event_name == 'release' diff --git a/.gitignore b/.gitignore index e324adf..b85e76b 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,7 @@ htmlcov/ .vscode/ .venv .idea +.ruff_cache +*.vmrk +*.eeg +*.vhdr diff --git a/MANIFEST.in b/MANIFEST.in index 4a2f8ad..76b277f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -19,5 +19,4 @@ exclude .readthedocs.yaml exclude .git-blame-ignore-revs exclude .pre-commit-config.yaml exclude .gitignore -exclude Makefile global-exclude *.pyc diff --git a/Makefile b/Makefile deleted file mode 100755 index d1e13a0..0000000 --- a/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -.PHONY: all inplace test check-manifest build-doc dist-build - -all: inplace check-manifest test build-doc dist-build - -inplace: - @echo "Installing pybv" - @python -m pip install --editable . - -test: - @echo "Running pytest: doctests" - @pytest pybv/io.py --doctest-modules -W ignore::UserWarning --verbose - @echo "Running pytest: test modules" - @pytest --cov=./pybv --cov-report=xml --verbose - -check-manifest: - @echo "Running check-manifest" - @check-manifest - -build-doc: - @echo "Building documentation" - make -C docs/ clean - make -C docs/ html - cd docs/ && make view - -dist-build: - @echo "Building dist" - rm -rf dist - @python -m build diff --git a/README.rst b/README.rst index 79f156f..06ac7b7 100644 --- a/README.rst +++ b/README.rst @@ -1,14 +1,18 @@ .. image:: https://github.com/bids-standard/pybv/workflows/Python%20build/badge.svg :target: https://github.com/bids-standard/pybv/actions?query=workflow%3A%22Python+build%22 - :alt: GitHub Actions Python build + :alt: Python build .. image:: https://github.com/bids-standard/pybv/workflows/Python%20tests/badge.svg :target: https://github.com/bids-standard/pybv/actions?query=workflow%3A%22Python+tests%22 - :alt: GitHub Actions Python tests + :alt: Python tests .. image:: https://codecov.io/gh/bids-standard/pybv/branch/main/graph/badge.svg :target: https://codecov.io/gh/bids-standard/pybv - :alt: Codecov + :alt: Test coverage + +.. image:: https://readthedocs.org/projects/pybv/badge/?version=stable + :target: https://pybv.readthedocs.io/en/stable/?badge=stable + :alt: Documentation Status .. image:: https://badge.fury.io/py/pybv.svg :target: https://badge.fury.io/py/pybv @@ -18,10 +22,6 @@ :target: https://anaconda.org/conda-forge/pybv :alt: Conda version -.. image:: https://readthedocs.org/projects/pybv/badge/?version=stable - :target: https://pybv.readthedocs.io/en/stable/?badge=stable - :alt: Documentation Status - .. image:: https://zenodo.org/badge/157434681.svg :target: https://zenodo.org/badge/latestdoi/157434681 :alt: Zenodo archive @@ -30,16 +30,17 @@ pybv ==== -``pybv`` is a lightweight I/O utility for the BrainVision data format. +For documentation, see the: -The BrainVision data format is a recommended data format for use in the -`Brain Imaging Data Structure `_. +- `stable documentation `_ +- `latest (development) documentation `_ +.. docs_readme_include_label -The documentation can be found under the following links: +``pybv`` is a lightweight I/O utility for the BrainVision data format. -- for the `stable release `_ -- for the `latest (development) version `_ +The BrainVision data format is a recommended data format for use in the +`Brain Imaging Data Structure `_. About the BrainVision data format ================================= @@ -73,7 +74,6 @@ A documentation for the BrainVision file format is provided by Brain Products. You can `view the specification `_ as hosted by Brain Products. - Installation ============ @@ -87,11 +87,26 @@ After you have a working installation of MNE-Python (or only ``numpy`` if you do not want to read data and only write it), you can install ``pybv`` through the following: -- ``pip install --upgrade pybv`` +.. code-block:: Text + + python -m pip install --upgrade pybv or if you use `conda `_: -- ``conda install --channel conda-forge pybv`` +.. code-block:: Text + + conda install --channel conda-forge pybv + +For installing the **latest (development)** version of ``pyprep``, call: + +.. code-block:: Text + + python -m pip install --upgrade https://github.com/bids-standard/pybv/archive/refs/heads/main.zip + +Both the *stable* and the *latest* installation will additionally install +all required dependencies automatically. +The dependencies are defined in the ``pyproject.toml`` file under the +``dependencies`` and ``project.optional-dependencies`` sections. Contributing ============ @@ -100,7 +115,13 @@ The development of ``pybv`` is taking place on `GitHub `_. For more information, please see -`CONTRIBUTING.md `_ +`CONTRIBUTING.md `_. + +Citing +====== + +If you use this software in academic work, please cite it using the `Zenodo entry `_. +Metadata is encoded in the `CITATION.cff` file. Usage ===== diff --git a/docs/conf.py b/docs/conf.py index 9666074..81be0f1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -3,17 +3,18 @@ See: https://www.sphinx-doc.org/en/master/usage/configuration.html """ -import os import sys from datetime import date +from pathlib import Path from intersphinx_registry import get_intersphinx_mapping import pybv -curdir = os.path.dirname(__file__) -sys.path.append(os.path.abspath(os.path.join(curdir, "..", "pybv"))) -sys.path.append(os.path.abspath(os.path.join(curdir, "sphinxext"))) +curdir = Path(__file__).parent + +sys.path.append((curdir.parent / "pybv").resolve().as_posix()) +sys.path.append((curdir / "sphinxext").resolve().as_posix()) # see: https://sphinx.readthedocs.io/en/1.3/extensions.html extensions = [ diff --git a/docs/index.rst b/docs/index.rst index 10e6ce9..1220764 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,4 +1,9 @@ +==== +pybv +==== + .. include:: ../README.rst + :start-after: .. docs_readme_include_label .. toctree:: :hidden: diff --git a/pybv/io.py b/pybv/io.py index 46a5f41..800bb59 100644 --- a/pybv/io.py +++ b/pybv/io.py @@ -5,7 +5,7 @@ import os import shutil import sys -from os import path as op +from pathlib import Path from warnings import warn import numpy as np @@ -63,7 +63,7 @@ def write_brainvision( fname_base : str The base name for the output files. Three files will be created (*.vhdr*, *.vmrk*, *.eeg*), and all will share this base name. - folder_out : str + folder_out : str | pathlib.Path The folder where output files will be saved. Will be created if it does not exist. overwrite : bool @@ -182,6 +182,8 @@ def write_brainvision( """ # input checks + folder_out = Path(folder_out) + if not isinstance(data, np.ndarray): raise ValueError(f"data must be np.ndarray, but found: {type(data)}") @@ -299,13 +301,13 @@ def write_brainvision( ) # create output file names/paths, checking if they already exist - folder_out_created = not op.exists(folder_out) - os.makedirs(folder_out, exist_ok=True) - eeg_fname = op.join(folder_out, fname_base + ".eeg") - vmrk_fname = op.join(folder_out, fname_base + ".vmrk") - vhdr_fname = op.join(folder_out, fname_base + ".vhdr") + folder_out_created = not folder_out.exists() + folder_out.mkdir(parents=True, exist_ok=True) + eeg_fname = folder_out / f"{fname_base}.eeg" + vmrk_fname = folder_out / f"{fname_base}.vmrk" + vhdr_fname = folder_out / f"{fname_base}.vhdr" for fname in (eeg_fname, vmrk_fname, vhdr_fname): - if op.exists(fname) and not overwrite: + if fname.exists() and not overwrite: raise OSError( f"File already exists: {fname}.\n" f"Consider setting overwrite=True." ) @@ -341,7 +343,7 @@ def write_brainvision( else: # else, only remove the files we might have created for fname in (eeg_fname, vmrk_fname, vhdr_fname): - if op.exists(fname): # pragma: no cover + if fname.exists(): # pragma: no cover os.remove(fname) raise @@ -604,7 +606,7 @@ def _write_vmrk_file(vmrk_fname, eeg_fname, events, meas_date): print("", file=fout) print("[Common Infos]", file=fout) print("Codepage=UTF-8", file=fout) - print(f"DataFile={eeg_fname.split(os.sep)[-1]}", file=fout) + print(f"DataFile={eeg_fname.name}", file=fout) print("", file=fout) print("[Marker Infos]", file=fout) print( @@ -703,8 +705,8 @@ def _write_vhdr_file( print("", file=fout) print("[Common Infos]", file=fout) print("Codepage=UTF-8", file=fout) - print(f"DataFile={op.basename(eeg_fname)}", file=fout) - print(f"MarkerFile={op.basename(vmrk_fname)}", file=fout) + print(f"DataFile={eeg_fname.name}", file=fout) + print(f"MarkerFile={vmrk_fname.name}", file=fout) if format.startswith("binary"): print("DataFormat=BINARY", file=fout) diff --git a/pybv/tests/test_write_brainvision.py b/pybv/tests/test_write_brainvision.py index 3470fba..cd93fc6 100644 --- a/pybv/tests/test_write_brainvision.py +++ b/pybv/tests/test_write_brainvision.py @@ -2,7 +2,6 @@ import itertools import os -import os.path as op import re from datetime import datetime, timezone @@ -705,10 +704,10 @@ def test_cleanup(tmpdir): folder_out=folder_out, fmt="binary_float999", ) - assert not op.exists(folder_out) - assert not op.exists(folder_out / fname + ".eeg") - assert not op.exists(folder_out / fname + ".vmrk") - assert not op.exists(folder_out / fname + ".vhdr") + assert not (folder_out).exists() + assert not (folder_out / fname + ".eeg").exists() + assert not (folder_out / fname + ".vmrk").exists() + assert not (folder_out / fname + ".vhdr").exists() # if folder already existed before erroneous writing, it is not deleted os.makedirs(folder_out) @@ -721,12 +720,12 @@ def test_cleanup(tmpdir): folder_out=folder_out, fmt="binary_float999", ) - assert op.exists(folder_out) + assert folder_out.exists() # but all other (incomplete/erroneous) files are deleted - assert not op.exists(folder_out / fname + ".eeg") - assert not op.exists(folder_out / fname + ".vmrk") - assert not op.exists(folder_out / fname + ".vhdr") + assert not (folder_out / fname + ".eeg").exists() + assert not (folder_out / fname + ".vmrk").exists() + assert not (folder_out / fname + ".vhdr").exists() def test_overwrite(tmpdir): diff --git a/pyproject.toml b/pyproject.toml index 07691e9..25418fd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,6 +64,18 @@ Documentation = "https://pybv.readthedocs.io" Issues = "https://github.com/bids-standard/pybv/issues" Repository = "https://github.com/bids-standard/pybv" +[tool.coverage.report] +# Regexes for lines to exclude from consideration +exclude_lines = ["if 0:", "if __name__ == .__main__.:", "pragma: no cover"] + +[tool.coverage.run] +omit = ["*tests*"] + +[tool.pytest.ini_options] +addopts = """. --doctest-modules --cov=pybv/ --cov-report=xml --cov-config=pyproject.toml --verbose -s""" +filterwarnings = [ +] + [tool.ruff.lint] ignore = ["D203", "D213"] select = ["A", "B006", "D", "E", "F", "I", "UP", "W"]