Skip to content

Commit 59cd55e

Browse files
committed
From flake8 to ruff
1 parent 0e9e501 commit 59cd55e

File tree

9 files changed

+17
-23
lines changed

9 files changed

+17
-23
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster
44
ARG VARIANT="3.10-bullseye"
5-
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
5+
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}

.devcontainer/devcontainer.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"build": {
77
"dockerfile": "Dockerfile",
88
"context": "..",
9-
"args": {
9+
"args": {
1010
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
1111
// Append -bullseye or -buster to pin to an OS version.
1212
// Use -bullseye variants on local on arm64/Apple Silicon.
@@ -19,23 +19,22 @@
1919
// Configure properties specific to VS Code.
2020
"vscode": {
2121
// Set *default* container specific settings.json values on container create.
22-
"settings": {
22+
"settings": {
2323
"python.defaultInterpreterPath": "/usr/local/bin/python",
2424
"python.linting.enabled": true,
2525
"python.linting.pylintEnabled": true,
2626
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
2727
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
2828
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
2929
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
30-
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
3130
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
3231
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
3332
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
3433
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
3534
"python.testing.unittestEnabled": false,
3635
"python.testing.pytestEnabled": true
3736
},
38-
37+
3938
// Add the IDs of extensions you want installed when the container is created.
4039
"extensions": [
4140
"ms-python.python",
@@ -52,4 +51,4 @@
5251

5352
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
5453
"remoteUser": "vscode"
55-
}
54+
}

.flake8

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/python.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
run: |
2020
python -m pip install --upgrade pip
2121
pip install -r requirements-dev.txt
22-
- name: Lint with flake8
22+
- name: Lint with ruff
2323
run: |
24-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
24+
ruff . --select=E9,F63,F7,F82 --show-source
2525
- name: Check pyupgrade
2626
run: pyupgrade --py310-plus *.py tests/*.py
2727
- name: Check formatting with black

.pre-commit-config.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ repos:
1515
hooks:
1616
- id: isort
1717
name: isort (python)
18-
- repo: https://gitlab.com/pycqa/flake8
19-
rev: 4.0.1
18+
- repo: https://github.com/charliermarsh/ruff-pre-commit
19+
rev: v0.0.116
2020
hooks:
21-
- id: flake8
22-
exclude: '.venv/'
23-
args: ['--config=.flake8']
21+
- id: ruff
2422
- repo: https://github.com/asottile/pyupgrade
2523
rev: v3.1.0
2624
hooks:

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This is a template repository for any Python project that comes with the followi
44

55
* `black`: auto-formats code
66
* `isort`: sorts the imports
7-
* `flake8`: looks for common errors
7+
* `ruff`: looks for common errors
88
* `pyupgrade`: upgrades Python syntax
99

1010
All of those checks are run as pre-commit hooks using the `pre-commit` library.
@@ -63,7 +63,6 @@ Here's a short explanation of each file/folder in this template:
6363
* `python.yaml`: File configuring Github action that runs tools and tests
6464
* `tests`: Folder containing Python tests
6565
* `main_test.py`: File with pytest-style tests of main.py
66-
* `.flake8`: File configuring the flake8 tool
6766
* `.gitignore`: File describing what file patterns Git should never track
6867
* `.pre-commit-config.yaml`: File listing all the pre-commit hooks and args
6968
* `main.py`: The main (and currently only) Python file for the program

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ pythonpath = ['.']
1111
disable = "C0114,C0115,C0116"
1212

1313
[tool.isort]
14-
profile = "black"
14+
profile = "black"
15+
16+
[tool.ruff]
17+
line-length = 100
18+
ignore = ["D203"]

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pre-commit
33
black
44
isort
5-
flake8
5+
ruff
66
pyupgrade
77
pytest
88
coverage

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

0 commit comments

Comments
 (0)