Skip to content

Commit c1364a3

Browse files
committed
Add ruff
1 parent e9defb6 commit c1364a3

File tree

8 files changed

+32
-55
lines changed

8 files changed

+32
-55
lines changed

.flake8

-5
This file was deleted.

.github/workflows/tests.yml

+20
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,27 @@ on:
1212

1313
jobs:
1414

15+
style:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Install Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.11"
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install ruff==0.4.6
27+
# Update output format to enable automatic inline annotations.
28+
- name: Run Ruff Linter
29+
run: ruff check --output-format=github
30+
- name: Run Ruff Formatter
31+
run: ruff format --check
32+
1533
test:
1634
runs-on: ubuntu-latest
35+
needs: [style]
1736
steps:
1837
- uses: actions/checkout@v2
1938
- name: Set up Python ${{ matrix.python-version }}
@@ -25,3 +44,4 @@ jobs:
2544
python -m pip install --upgrade pip
2645
pip install torch==1.9.0+cpu torchvision==0.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
2746
make install_dev
47+

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,7 @@ venv.bak/
105105
/site
106106

107107
# mypy
108-
.mypy_cache/
108+
.mypy_cache/
109+
110+
# ruff
111+
.ruff_cache/

.pre-commit-config.yaml

-23
This file was deleted.

Makefile

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
python3 -m venv .venv
55

66
install_dev: .venv
7-
.venv/bin/pip install -e .[test]
8-
.venv/bin/pre-commit install
7+
.venv/bin/pip install -e ".[test]"
98

109
test: .venv
1110
.venv/bin/pytest -p no:cacheprovider tests/
@@ -16,7 +15,9 @@ table:
1615
table_timm:
1716
.venv/bin/python misc/generate_table_timm.py
1817

19-
precommit: install_dev
20-
.venv/bin/pre-commit run --all-files
18+
fixup:
19+
.venv/bin/ruff check --fix
20+
.venv/bin/ruff format
21+
22+
all: fixup test
2123

22-
all: precommit test

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ make install_dev # create .venv, install SMP in dev mode
478478
#### Run tests and code checks
479479

480480
```bash
481-
make all # run precommit, tests
481+
make fixup # Ruff for formatting and lint checks
482482
```
483483

484484
#### Update table with encoders

pyproject.toml

-19
Original file line numberDiff line numberDiff line change
@@ -1,19 +0,0 @@
1-
[tool.black]
2-
line-length = 119
3-
target-version = ['py37', 'py38']
4-
include = '\.pyi?$'
5-
exclude = '''
6-
/(
7-
\.eggs
8-
| \.git
9-
| \.hg
10-
| \.mypy_cache
11-
| \.tox
12-
| \.venv
13-
| docs
14-
| _build
15-
| buck-out
16-
| build
17-
| dist
18-
)/
19-
'''

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
REQUIRED = []
3636

3737
# What packages are optional?
38-
EXTRAS = {"test": ["pytest", "mock", "pre-commit"]}
38+
EXTRAS = {"test": ["pytest", "mock", "ruff==0.4.6"]}
3939

4040
# Import the README and use it as the long-description.
4141
# Note: this will only work if 'README.md' is present in your MANIFEST.in file!

0 commit comments

Comments
 (0)