Skip to content
This repository has been archived by the owner on Jan 27, 2025. It is now read-only.

ENH: Refactor code linter and formatter dependencies #144

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/contrib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
with:
python-version: 3
- name: Lint EddyMotion
run: pipx run ruff check
run: pipx run ruff check --diff
16 changes: 5 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,9 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: debug-statements
- repo: https://github.com/timothycrosley/isort
rev: 5.10.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.4
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
- id: ruff
args: [ --fix ]
- id: ruff-format
4 changes: 3 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
http://www.sphinx-doc.org/en/master/config

"""

from packaging.version import Version
from eddymotion import __version__, __copyright__, __packagename__

from eddymotion import __copyright__, __packagename__, __version__

# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
Expand Down
46 changes: 18 additions & 28 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ doc = [
]

dev = [
"black",
"flake8",
"flake8-pyproject",
"isort",
"ruff",
"pre-commit",
"pre-commit-hooks",
]
Expand Down Expand Up @@ -113,32 +110,21 @@ version-file = "src/eddymotion/_version.py"
# Developer tool configurations
#

[tool.black]
line-length = 99
target-version = ['py39']
skip-string-normalization = true
exclude = '''
# Directories
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| venv
| _build
| build
| dist
)/
'''

[tool.isort]
profile = 'black'
skip_gitignore = true

[tool.ruff]
line-length = 99
target-version = "py39"
exclude = [
".eggs",
".git",
".hg",
".mypy_cache",
".tox",
".venv",
"venv",
"_build",
"build",
"dist",
]

[tool.ruff.lint]
select = [
Expand All @@ -147,6 +133,7 @@ select = [
"C",
"W",
"B",
"I",
]
ignore = [
"E203"
Expand All @@ -164,6 +151,9 @@ inline-quotes = "double"
[tool.ruff.format]
quote-style = "double"

[tool.ruff.lint.isort]
known-first-party=["eddymotion"]

[tool.pytest.ini_options]
pythonpath = "src/ test/"
norecursedirs = [".*", "_*"]
Expand Down
10 changes: 8 additions & 2 deletions test/test_dmri.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
# https://www.nipreps.org/community/licensing/
#
"""Unit tests exercising the dMRI data structure."""
import pytest

import numpy as np
import pytest

from eddymotion.data.dmri import load


Expand Down Expand Up @@ -54,7 +56,11 @@ def test_load(datadir, tmp_path):
assert np.allclose(dwi_h5.gradients, dwi_from_nifti1.gradients)

# Try loading NIfTI + b-vecs/vals
dwi_from_nifti2 = load(dwi_nifti_path, bvec_file=bvecs_path, bval_file=bvals_path,)
dwi_from_nifti2 = load(
dwi_nifti_path,
bvec_file=bvecs_path,
bval_file=bvals_path,
)

assert np.allclose(dwi_h5.dataobj, dwi_from_nifti2.dataobj)
assert np.allclose(dwi_h5.bzero, dwi_from_nifti2.bzero)
Expand Down