Skip to content

Commit

Permalink
chore: use ruff format (#633)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 authored Mar 4, 2024
1 parent 293a561 commit 37774e5
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 49 deletions.
35 changes: 8 additions & 27 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,22 @@ ci:
autoupdate_commit_msg: "ci(pre-commit.ci): autoupdate"

repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.16
hooks:
- id: check-docstring-first
- id: end-of-file-fixer
- id: trailing-whitespace
- id: validate-pyproject

- repo: https://github.com/crate-ci/typos
rev: v1.19.0
hooks:
- id: typos

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
rev: v0.3.0
hooks:
- id: ruff
args: ["--fix"]

- repo: https://github.com/psf/black
rev: 24.1.1
hooks:
- id: black

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.16
hooks:
- id: validate-pyproject

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
Expand All @@ -38,13 +29,3 @@ repos:
additional_dependencies:
- numpy
- psygnal

# manual hooks

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
exclude: CHANGELOG.md
stages:
- "manual"
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@

**Implemented enhancements:**

- Enable option to raise excpetion if magicgui cannot determine widget for provided value/annotation [\#476](https://github.com/pyapp-kit/magicgui/pull/476) ([Czaki](https://github.com/Czaki))
- Enable option to raise exception if magicgui cannot determine widget for provided value/annotation [\#476](https://github.com/pyapp-kit/magicgui/pull/476) ([Czaki](https://github.com/Czaki))

**Documentation:**

Expand Down Expand Up @@ -418,7 +418,7 @@

**Documentation:**

- adds waveform generator exemple [\#322](https://github.com/pyapp-kit/magicgui/pull/322) ([glyg](https://github.com/glyg))
- adds waveform generator example [\#322](https://github.com/pyapp-kit/magicgui/pull/322) ([glyg](https://github.com/glyg))
- add example of adding mpl FigureCanvas to widget [\#321](https://github.com/pyapp-kit/magicgui/pull/321) ([tlambert03](https://github.com/tlambert03))

## [v0.3.3](https://github.com/pyapp-kit/magicgui/tree/v0.3.3) (2021-11-08)
Expand Down
4 changes: 3 additions & 1 deletion docs/gallery_conf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Gallery configuration for docs."""

import warnings
from pathlib import Path

Expand All @@ -10,7 +12,7 @@
warnings.filterwarnings("ignore", category=DeprecationWarning)


def qt_window_scraper(block, script: GalleryScript):
def qt_window_scraper(block: tuple, script: GalleryScript) -> str:
"""Scrape screenshots from open Qt windows.
Parameters
Expand Down
32 changes: 14 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ test = [
"annotated_types",
]
dev = [
"black",
"ruff",
"ipython",
"mypy",
Expand Down Expand Up @@ -138,45 +137,42 @@ matrix.backend.features = [
]


# https://github.com/charliermarsh/ruff
# https://docs.astral.sh/ruff
[tool.ruff]
line-length = 88
target-version = "py38"
src = ["src", "tests"]

[tool.ruff.lint]
pydocstyle = { convention = "numpy" }
select = [
"E", # style errors
"F", # flakes
"W", # warnings
"D", # pydocstyle
"D417", # Missing argument descriptions in Docstrings
"I", # isort
"UP", # pyupgrade
"C", # flake8-comprehensions
"C4", # flake8-comprehensions
"B", # flake8-bugbear
"A001", # flake8-builtins
"TCH", # type checking
"TID", # tidy imports
"RUF", # ruff-specific rules
]
ignore = [
"D100", # Missing docstring in public module
"D107", # Missing docstring in __init__
"D203", # 1 blank line required before class docstring
"D212", # Multi-line docstring summary should start at the first line
"D213", # Multi-line docstring summary should start at the second line
"D401", # First line should be in imperative mood
"D413", # Missing blank line after last section
"D416", # Section name should end with a colon
"C901", # Function is too complex
]

[tool.ruff.per-file-ignores]
"tests/*.py" = ["D", "E501"]
"docs/examples/*.py" = ["D", "B"]
"docs/examples/napari/*" = ["E501"]
"docs/examples/notebooks/*" = ["E501"]
"src/magicgui/widgets/_image/*.py" = ["D"]
"setup.py" = ["F821"]
[tool.ruff.lint.per-file-ignores]
"tests/*.py" = ["D", "S", "E501"]
"docs/*.py" = ["B"]
"docs/examples/*.py" = ["D", "B", "E501"]
"src/magicgui/widgets/_image/*.py" = ["D"]

# https://docs.astral.sh/ruff/formatter/
[tool.ruff.format]
docstring-code-format = true

# https://docs.pytest.org/en/6.2.x/customize.html
[tool.pytest.ini_options]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def test_create_widget_annotation(annotation, expected_type):
wdg.close()


def test_create_widget_annotation_overwritte_parrams():
def test_create_widget_annotation_overwrite_parrams():
wdg1 = widgets.create_widget(annotation=widgets.ProgressBar)
assert isinstance(wdg1, widgets.ProgressBar)
assert wdg1.visible
Expand Down

0 comments on commit 37774e5

Please sign in to comment.