Skip to content
Open
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
73 changes: 8 additions & 65 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,59 +1,12 @@
repos:
- repo: https://github.com/psf/black
rev: 26.3.1
hooks:
- id: black
name: black
description: "Black: The uncompromising Python code formatter"
entry: black
language: python
language_version: python3
minimum_pre_commit_version: 2.9.2
require_serial: true
types_or: [python, pyi]
- id: black-jupyter
name: black-jupyter
description:
"Black: The uncompromising Python code formatter (with Jupyter Notebook support)"
entry: black
language: python
minimum_pre_commit_version: 2.9.2
require_serial: true
types_or: [python, pyi, jupyter]
additional_dependencies: [".[jupyter]"]

- repo: https://github.com/pycqa/flake8
rev: 7.3.0
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- flake8-simplify

- repo: https://gitlab.com/kennon.mckeever/nbhooks
rev: 1.0.1
hooks:
- id: nb-ensure-clean
name: nb-ensure-clean
description: Ensure that committed Jupyter notebooks contain no outputs.
entry: nb-ensure-clean
files: \.ipynb$
language: python

- repo: https://github.com/asottile/pyupgrade
rev: v3.21.2
hooks:
- id: pyupgrade
args: [--py310-plus]

- repo: https://github.com/PyCQA/isort
rev: 8.0.1
hooks:
- id: isort
name: isort (python)
args: [--add-import, "from __future__ import annotations"]
types: [python]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.8
hooks:
# Run the linter
- id: ruff-check
args: [ --fix ]
# Run the formatter
- id: ruff-format

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
Expand All @@ -77,16 +30,6 @@ repos:
.gitignore
)

- repo: https://github.com/PyCQA/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
files: bmipy/.*\.py$
args:
- --convention=numpy
- --add-select=D417
additional_dependencies: [".[toml]"]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.19.1
hooks:
Expand Down
2 changes: 2 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Nox configuration."""

from __future__ import annotations

import pathlib
Expand Down
29 changes: 25 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,31 @@ where = [
[tool.coverage.run]
relative_files = true

[tool.isort]
known_first_party = "bmipy"
profile = "black"
force_single_line = true
[tool.ruff.lint]
select = [
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"C90", # mccabe
"D", # pydocstyle
"E", "W", # pycodestyle
"F", # Pyflakes
"FA", # flake8-future-annotations
"I", # isort
# "SIM", # flake8-simplify
"UP", # pyupgrade
]

[tool.ruff.lint.per-file-ignores]
"tests/**.py" = ["D"]

[tool.ruff.lint.isort]
force-single-line = true

[tool.ruff.lint.mccabe]
max-complexity = 10

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

[tool.mypy]
check_untyped_defs = true
Expand Down
4 changes: 0 additions & 4 deletions setup.cfg

This file was deleted.