Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build] replaces flake8 with ruff #1179

Merged
merged 4 commits into from
Apr 24, 2023
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
5 changes: 0 additions & 5 deletions .flake8

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: main

jobs:
flake8:
ruff:
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -20,11 +20,11 @@ jobs:
with:
python-version: ${{ matrix.python }}
architecture: x64
- name: Run flake8
- name: Run ruff
felixT2K marked this conversation as resolved.
Show resolved Hide resolved
run: |
pip install flake8
flake8 --version
flake8
pip install ruff
ruff --version
ruff check --diff .

black:
runs-on: ${{ matrix.os }}
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# this target runs checks on all files
quality:
isort . -c
flake8 ./
ruff check .
black --check .
mypy doctr/
pydocstyle doctr/
Expand All @@ -11,6 +11,7 @@ quality:
style:
isort .
black .
ruff --fix .

# Run tests for the library
test:
Expand Down
16 changes: 14 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ testing = [
"requests>=2.20.0",
]
quality = [
"flake8>=3.9.0",
"ruff>=0.0.260",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of security, I would have added an upper bound as well 0.1.0 for instance to avoid troubles with the CI later but nothing major 👍

"isort>=5.7.0",
"black>=22.1,<24.0",
"mypy>=0.812",
Expand Down Expand Up @@ -101,7 +101,7 @@ dev = [
"onnxruntime>=1.11.0",
"requests>=2.20.0",
# Quality
"flake8>=3.9.0",
"ruff>=0.0.260",
"isort>=5.7.0",
"black>=22.1,<24.0",
"mypy>=0.812",
Expand Down Expand Up @@ -170,6 +170,18 @@ src_paths = ["doctr", "tests", "scripts", "references", "demo", "docs", "api"]
skip_glob = "**/__init__.py"
known_third_party = ["tensorflow", "torch", "torchvision", "wandb", "fastprogress"]

[tool.ruff]
ignore = ["E402", "F403", "E731"]
frgfm marked this conversation as resolved.
Show resolved Hide resolved
exclude = [".git", "venv*", "build"]
line-length = 120
target-version = "py38"

[tool.ruff.per-file-ignores]
"**/__init__.py" = ["F401"]

[tool.ruff.flake8-quotes]
docstring-quotes = "double"

[tool.pydocstyle]
select = "D300,D301,D417"
match = ".*\\.py"
Expand Down