Skip to content

Commit

Permalink
chore: move to using Ruff Jupyter support (#543)
Browse files Browse the repository at this point in the history
Modernizing and using Ruff's built-in notebook support.

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii authored Oct 26, 2023
1 parent 7e44aa8 commit 41e1eff
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
9 changes: 1 addition & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,7 @@ repos:
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]

# Notebook formatting
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
hooks:
- id: nbqa-ruff
additional_dependencies: [ruff==0.0.255]
args: ["--extend-ignore=B008,T20,I002,E402", "--fix", "--show-fixes"]
types_or: [python, pyi, jupyter]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.1
Expand Down
4 changes: 1 addition & 3 deletions docs/user-guide/notebooks/SVGHistogram.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -575,9 +575,7 @@
" ),\n",
" ]\n",
"\n",
" return svg(*polygons, *texts, *circles, width=800, height=250)\n",
" pass\n",
" return None"
" return svg(*polygons, *texts, *circles, width=800, height=250)"
]
},
{
Expand Down
18 changes: 10 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ requires-python = ">=3.7"
dependencies = [
"boost-histogram>=1.3.1,<1.5",
"histoprint>=2.2.0",
'numpy>=1.14.5;python_version<"3.12"',
'numpy>=1.26.0b1;python_version>="3.12"',
'numpy>=1.14.5',
'typing-extensions>=4;python_version<"3.11"',
]
dynamic = ["version"]
Expand Down Expand Up @@ -150,6 +149,7 @@ module = [
]
ignore_missing_imports = true


[tool.pylint]
py-version = "3.7"
extension-pkg-allow-list = ["boost_histogram._core"]
Expand Down Expand Up @@ -184,9 +184,12 @@ messages_control.disable = [
"unused-argument", # Handled better by Ruff
]


[tool.ruff]
select = [
"E", "F", "W", # flake8
src = ["src"]

[tool.ruff.lint]
extend-select = [
"B", # flake8-bugbear
"I", # isort
"ARG", # flake8-unused-arguments
Expand All @@ -205,15 +208,14 @@ select = [
"UP", # pyupgrade
"YTT", # flake8-2020
]
extend-ignore = ["PLR", "E501", "PT011", "PT013", "PT004", "B017"]
ignore = ["PLR", "E501", "PT011", "PT013", "PT004", "B017"]
typing-modules = ["hist._compat.typing"]
src = ["src"]
unfixable = ["T20", "F841"]
exclude = []
isort.required-imports = ["from __future__ import annotations"]
flake8-unused-arguments.ignore-variadic-names = true

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"tests/test_plot.py" = ["B008"]
"docs/conf.py" = ["ARG001", "PTH"]
"noxfile.py" = ["T20"]
"**.ipynb" = ["B008", "T20", "I002", "E402", "E703", "B018"]

0 comments on commit 41e1eff

Please sign in to comment.