Skip to content

Commit f5395ef

Browse files
authored
build: use ruff instead of isort, black, and flake8 (#58)
Drops all the previous linters & formatters (isort, black, flake8) in favor of the modern alternative: ruff.
1 parent 67d9c98 commit f5395ef

File tree

13 files changed

+48
-99
lines changed

13 files changed

+48
-99
lines changed

.github/workflows/publish-pypi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171

7272
- name: Publish to PyPI
7373
if: >-
74-
github.event_name == 'release'
74+
github.event_name == 'release'
7575
|| (
7676
github.event_name == 'workflow_dispatch'
7777
&& github.event.inputs.pypi_repo == 'pypi'

.pre-commit-config.yaml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,21 @@
11
repos:
2-
- repo: https://github.com/ambv/black
3-
rev: 6305bf1ae645ab7541be4f5028a86239316178eb # frozen: 26.1.0
4-
hooks:
5-
- id: black
6-
language_version: python3
7-
82
- repo: https://github.com/pre-commit/pre-commit-hooks
9-
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
3+
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
104
hooks:
115
- id: trailing-whitespace
126

13-
- repo: https://github.com/PyCQA/flake8/
14-
rev: d93590f5be797aabb60e3b09f2f52dddb02f349f # frozen: 7.3.0
15-
hooks:
16-
- id: flake8
17-
18-
- repo: https://github.com/PyCQA/isort
19-
rev: a333737ed43df02b18e6c95477ea1b285b3de15a # frozen: 8.0.1
7+
- repo: https://github.com/astral-sh/ruff-pre-commit
8+
# Ruff version.
9+
rev: b969e2851312ca2b24bbec879ba4954341d1bd12 # frozen: v0.15.5
2010
hooks:
21-
- id: isort
11+
# Run the linter.
12+
- id: ruff-check
13+
args: [--fix]
14+
# Run the formatter.
15+
- id: ruff-format
2216

2317
- repo: https://github.com/semgrep/pre-commit
24-
rev: 'c4106f790c25be2d683c6cdbd7f9780c55f9b0a3' # frozen: v1.153.1
18+
rev: "300faea09b7bc82adb8280d3b640ba81f813e22a" # frozen: v1.154.0
2519
hooks:
2620
- id: semgrep
2721
entry: semgrep
@@ -36,4 +30,4 @@ repos:
3630
- --config=p/trailofbits
3731
- --config=r/yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha.third-party-action-not-pinned-to-commit-sha
3832
- --error
39-
- --skip-unknown-extensions
33+
- --skip-unknown-extensions

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
v1.4.0 - TBD
2+
++++++++++++
3+
4+
*No changes yet.*
5+
6+
17
v1.3.0 - March 1st 2026
28
+++++++++++++++++++++++
39

docs/contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Recommendations
1515
Code Style
1616
++++++++++
1717

18-
We are using `Black <https://github.com/python/black>`_ and `Flake 8 <http://flake8.pycqa.org/en/latest/>`_ to ensure a consistent code-style and reduce common Python issues in changes.
18+
We use `Ruff <https://docs.astral.sh/ruff/>`_ to ensure a consistent code-style and reduce common Python issues in code changes.
1919

2020
You can install a checker by running ``pre-commit install`` after installing our development requirements (``pip install -e '.[dev]'``). After that, you can add your changes through ``git`` and run ``pre-commit`` to check if your changes are issue-free.
2121

example/src/example/settings.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@
4444
AUTH_PASSWORD_VALIDATORS = [
4545
{
4646
"NAME": (
47-
"django.contrib.auth.password_validation"
48-
".UserAttributeSimilarityValidator"
47+
"django.contrib.auth.password_validation.UserAttributeSimilarityValidator"
4948
),
5049
},
5150
{

pyproject.toml

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "uv_build"
44

55
[project]
66
name = "pytest-django-queries"
7-
version = "1.3.0"
7+
version = "1.4.0"
88
description = "Generate performance reports from your django database performance tests."
99
readme = "README.md"
1010
license = "MIT"
@@ -65,33 +65,6 @@ test = [
6565
"pytest-xdist",
6666
]
6767

68-
[tool.black]
69-
target_version = ['py35', 'py36', 'py37', 'py38']
70-
include = '\.pyi?$'
71-
exclude = '''
72-
/(\.git/
73-
|\.eggs
74-
|\.hg
75-
|__pycache__
76-
|\.cache
77-
|\.ipynb_checkpoints
78-
|\.mypy_cache
79-
|\.pytest_cache
80-
|\.tox
81-
|\.venv
82-
|node_modules
83-
|_build
84-
|buck-out
85-
|build
86-
|dist
87-
|media
88-
|infrastructure
89-
|templates
90-
|locale
91-
|docs
92-
)/
93-
'''
94-
9568
[tool.coverage.run]
9669
branch = true
9770
omit = [
@@ -118,27 +91,6 @@ exclude_lines = [
11891
"if __name__ == .__main__.:",
11992
]
12093

121-
[tool.isort]
122-
skip = [
123-
"docs",
124-
]
125-
multi_line_output = 3
126-
include_trailing_comma = true
127-
line_length = 88
128-
known_first_party = [
129-
"pytest_django_queries",
130-
]
131-
known_third_party = [
132-
"beautifultable",
133-
"bs4",
134-
"click",
135-
"django",
136-
"jinja2",
137-
"mock",
138-
"pytest",
139-
"setuptools",
140-
]
141-
14294
[tool.uv.workspace]
14395
members = [
14496
"example",

setup.cfg

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

src/pytest_django_queries/diff.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,7 @@ def _generate_mapping(self):
162162

163163
def _iter_module(self, module_entries):
164164
yield self.header_rows
165-
for _, test_comparison in sorted(
166-
module_entries.items()
167-
): # type: SingleEntryComparison
165+
for _, test_comparison in sorted(module_entries.items()): # type: SingleEntryComparison
168166
yield test_comparison.to_string(lengths=self.longest_props)
169167

170168
def _iter_modules(self):

src/pytest_django_queries/entry.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@ def iter_entries(entries):
4949
for module_name, module_data in sorted(entries.items()):
5050
assert_type(module_data, dict)
5151

52-
yield module_name, (
53-
Entry(test_name, module_name, test_data)
54-
for test_name, test_data in sorted(module_data.items())
52+
yield (
53+
module_name,
54+
(
55+
Entry(test_name, module_name, test_data)
56+
for test_name, test_data in sorted(module_data.items())
57+
),
5558
)
5659

5760

tests/test_cli.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ def test_load_valid_json_file_shows_correct_data(testdir):
7070
runner = CliRunner()
7171
result = runner.invoke(cli.main, ["show", "test_file.json"])
7272
assert result.exit_code == 0, result.output
73-
assert result.stdout.strip() == dedent("""
73+
assert (
74+
result.stdout.strip()
75+
== dedent("""
7476
+---------+--------------------------------------+
7577
| Module | Tests |
7678
+---------+--------------------------------------+
@@ -91,6 +93,7 @@ def test_load_valid_json_file_shows_correct_data(testdir):
9193
| module3 | |
9294
+---------+--------------------------------------+
9395
""").strip()
96+
)
9497

9598

9699
def test_load_valid_json_file_shows_correct_html_data(testdir):

0 commit comments

Comments
 (0)