Skip to content

Commit fbeb79c

Browse files
committed
dev: use ruff instead of black and pylint
1 parent 6f04f21 commit fbeb79c

File tree

9 files changed

+286
-415
lines changed

9 files changed

+286
-415
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
- name: Install the project
2525
run: uv sync --all-extras --dev
2626

27-
- name: Run black
28-
run: uv run black --check .
27+
- name: Run ruff
28+
run: uv run ruff format --check
2929

3030
- name: Run mypy
3131
run: uv run mypy src

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ uv run pytest
335335
To format the code, run:
336336

337337
```sh
338-
uv run black .
338+
uv run ruff format
339339
```
340340

341341
To type-check the code, run:

pyproject.toml

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@ apy = "apyanki.cli:main"
3232
[dependency-groups]
3333
dev = [
3434
"pytest>=7.3.1",
35-
"pylint>=3.0.2",
3635
"bump2version>=1.0.1",
37-
"black>=24.3.0",
3836
"mypy>=1.3.0",
3937
"types-beautifulsoup4>=4.12.0.5",
4038
"types-markdown>=3.4.2.9",
39+
"ruff>=0.12.0",
4140
]
4241

4342
[build-system]
@@ -47,23 +46,6 @@ build-backend = "hatchling.build"
4746
[tool.pytest]
4847
filterwarnings = ["ignore::DeprecationWarning:html5lib.*:"]
4948

50-
[tool.pylint.master]
51-
init-hook = 'import sys; sys.path.append("/usr/share/anki")'
52-
53-
[tool.pylint.reports]
54-
output-format = "colorized"
55-
56-
[tool.pylint.format]
57-
max-line-length = "88"
58-
59-
[tool.pylint."messages control"]
60-
max-statements = 75
61-
disable = [
62-
"invalid-name",
63-
"too-many-branches",
64-
"too-many-instance-attributes",
65-
]
66-
6749
[tool.mypy]
6850
exclude = ".venv"
6951
strict = true

src/apyanki/anki.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ def _init_load_profile(
109109

110110
def _init_load_collection(self) -> None:
111111
"""Load the Anki collection"""
112-
# pylint: disable=import-outside-toplevel
113112
from anki.collection import Collection
114113
from anki.errors import DBError
115114

@@ -132,7 +131,6 @@ def _init_load_collection(self) -> None:
132131
@staticmethod
133132
def _init_load_config() -> None:
134133
"""Load custom configuration"""
135-
# pylint: disable=import-outside-toplevel
136134
from anki import latex
137135

138136
# Update LaTeX commands
@@ -160,7 +158,6 @@ def __exit__(
160158

161159
def sync(self) -> None:
162160
"""Sync collection to AnkiWeb"""
163-
# pylint: disable=import-outside-toplevel
164161
from anki.sync import SyncAuth
165162

166163
if self._profile is None:
@@ -230,7 +227,6 @@ def sync(self) -> None:
230227

231228
def check_media(self) -> None:
232229
"""Check media (will rebuild missing LaTeX files)"""
233-
# pylint: disable=import-outside-toplevel
234230
from anki.notes import NoteId
235231

236232
with cd(self.col.media.dir()):
@@ -289,7 +285,6 @@ def delete_notes(self, ids: NoteId | list[NoteId]) -> None:
289285

290286
def get_model(self, model_name: str) -> Optional[NotetypeDict]:
291287
"""Get model from model name"""
292-
# pylint: disable=import-outside-toplevel
293288
from anki.models import NotetypeId
294289

295290
model_id = self.model_name_to_id.get(model_name)

src/apyanki/cli.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,5 +735,4 @@ def backup(target_file: Path, include_media: bool, legacy: bool) -> None:
735735

736736

737737
if __name__ == "__main__":
738-
# pylint: disable=no-value-for-parameter
739738
main()

src/apyanki/fields.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,8 @@ def img_paths_from_field_latex(html: str, ntd: NotetypeDict, anki: Anki) -> list
166166
167167
Note: The returned paths are relative to the Anki media directory.
168168
"""
169-
# pylint: disable=import-outside-toplevel
170169
from anki import latex
171170

172-
# pylint: disable=protected-access
173171
proto = anki.col._backend.extract_latex(
174172
text=html, svg=ntd.get("latexsvg", False), expand_clozes=False
175173
)

src/apyanki/note.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ def __repr__(self) -> str:
8282

8383
def pprint(self, print_raw: bool = False, list_cards: bool = False) -> None:
8484
"""Print to screen"""
85-
# pylint: disable=import-outside-toplevel
8685
from anki import latex
8786

8887
header = f"[green]# Note (nid: {self.n.id})[/green]"

tests/common.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Implement some basic test fixtures"""
22

3-
# pylint: disable=too-few-public-methods
43
import os
54
import tempfile
65
import shutil

uv.lock

Lines changed: 282 additions & 383 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)