Skip to content

Commit

Permalink
Fix ruff/style configuration and add missing tests (#9)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
Mathieu Scheltienne and pre-commit-ci[bot] authored Aug 16, 2024
1 parent 75b1ebc commit f60d020
Show file tree
Hide file tree
Showing 14 changed files with 354 additions and 221 deletions.
1 change: 1 addition & 0 deletions .codespellignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fro
17 changes: 1 addition & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
files: (src/antio|tests|setup.py)

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.6
rev: v0.6.0
hooks:
- id: ruff
name: ruff linter
args: [--fix, --show-fixes]
files: (src/antio|tests|setup.py)
- id: ruff-format
name: ruff formatter
files: (src/antio|tests|setup.py)

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
Expand All @@ -24,13 +16,6 @@ repos:
additional_dependencies: [tomli]
files: (src/antio|tests)

- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
files: (src/antio|tests)
additional_dependencies: [tomli]

- repo: https://github.com/pappasam/toml-sort
rev: v0.23.1
hooks:
Expand Down
40 changes: 16 additions & 24 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ dependencies = [
]
description = 'Python package to handle I/O with the CNT format from ANT Neuro. '
keywords = [
'python',
'eeg',
'ant neuro',
'eego',
'cnt',
'eeg',
'eego',
'python',
]
license = {file = 'LICENSE'}
maintainers = [
{email = '[email protected]', name = 'Mathieu Scheltienne'},
{name= 'Eric Larson'},
{name = 'Eric Larson'},
]
name = 'antio'
readme = 'README.md'
Expand All @@ -53,9 +53,7 @@ full = [
]
style = [
'codespell[toml]>=2.2.4',
'isort',
'pydocstyle[toml]',
'ruff>=0.1.8',
'ruff>=0.6.0',
'toml-sort',
'yamllint',
]
Expand All @@ -75,9 +73,9 @@ source = 'https://github.com/mscheltienne/antio'
tracker = 'https://github.com/mscheltienne/antio/issues'

[tool.cibuildwheel]
archs = "native"
build = "cp312-*"
skip = "*musllinux*"
archs = "native"
test-command = "pytest {project}/tests"
test-extras = ["test"]

Expand All @@ -86,6 +84,7 @@ repair-wheel-command = [
"auditwheel repair -w {dest_dir} {wheel}",
"pipx run abi3audit --strict --report {wheel}",
]

[tool.cibuildwheel.macos]
repair-wheel-command = [
"delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}",
Expand Down Expand Up @@ -121,20 +120,6 @@ omit = [
'**/antio/_version.py',
]

[tool.isort]
extend_skip_glob = []
line_length = 88
multi_line_output = 3
profile = 'black'
py_version = 39

[tool.pydocstyle]
add_ignore = 'D100,D104,D107'
convention = 'numpy'
ignore-decorators = '(copy_doc|property|.*setter|.*getter|pyqtSlot|Slot)'
match = '^(?!__init__|test_).*\.py'
match-dir = '^.*antio.*'

[tool.pytest.ini_options]
addopts = ['--color=yes', '--cov-report=', '--durations=20', '--junit-xml=junit-results.xml', '--strict-config', '--tb=short', '-ra', '-v']
filterwarnings = [
Expand All @@ -154,16 +139,23 @@ line-ending = "lf"

[tool.ruff.lint]
ignore = []
select = ['A', 'B', 'E', 'F', 'G', 'LOG', 'NPY', 'PIE', 'PT', 'T20', 'UP', 'W']
select = ['A', 'B', 'D', 'E', 'F', 'G', 'I', 'LOG', 'NPY', 'PIE', 'PT', 'T20', 'UP', 'W']

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

[tool.ruff.lint.per-file-ignores]
'*' = [
'B904', # 'Within an except clause, raise exceptions with raise ... from ...'
'D100', # 'Missing docstring in public module'
'D104', # 'Missing docstring in public package'
'UP007', # 'Use `X | Y` for type annotations', requires python 3.10
]
'*.pyi' = ['E501']
'__init__.py' = ['F401']

[tool.ruff.lint.pydocstyle]
convention = 'numpy'

[tool.setuptools]
include-package-data = false

Expand Down
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
lib_files = []


class BinaryDistribution(Distribution):
def has_ext_modules(self):
class BinaryDistribution(Distribution): # noqa: D101
def has_ext_modules(self): # noqa: D102
return True


class build_ext(_build_ext):
class build_ext(_build_ext): # noqa: D101
def run(self):
"""Build libeep with cmake as part of the extension build process."""
src_dir = Path(__file__).parent / "src" / "libeep"
Expand Down Expand Up @@ -81,8 +81,8 @@ def run(self):

# Adapted from
# https://github.com/joerick/python-abi3-package-sample/blob/main/setup.py
class bdist_wheel_abi3(bdist_wheel):
def get_tag(self):
class bdist_wheel_abi3(bdist_wheel): # noqa: D101
def get_tag(self): # noqa: D102
python, abi, plat = super().get_tag()

if python.startswith("cp"):
Expand Down
4 changes: 2 additions & 2 deletions src/antio/commands/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@


@click.group()
def run() -> None: # noqa: D401
"""Main package entry-point."""
def run() -> None:
"""Main package entry-point.""" # noqa: D401


run.add_command(sys_info)
2 changes: 1 addition & 1 deletion src/antio/datasets/ca_208.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def _make_registry(
pooch.make_registry(folder, output=output, recursive=True)


def data_path(path: str | Path | None) -> Path: # pragma: no cover
def data_path(path: str | Path | None = None) -> Path: # pragma: no cover
"""Return the path to the dataset, downloaded if needed.
Parameters
Expand Down
8 changes: 0 additions & 8 deletions src/antio/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@ def read_raw_ant(
)

from mne.io import read_raw_ant
from mne.utils import warn

warn(
"This function is deprecated in favor of mne.io.read_raw_ant() and will be "
"removed in the future.",
DeprecationWarning,
module="antio",
)

return read_raw_ant(
fname=fname,
Expand Down
Loading

0 comments on commit f60d020

Please sign in to comment.