Skip to content

Commit 8519acc

Browse files
Pin ruff version and prep for v0.0.12 release (#34)
1 parent 879572f commit 8519acc

File tree

11 files changed

+39
-42
lines changed

11 files changed

+39
-42
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repos:
1111
hooks:
1212
- id: ruff
1313
name: Ruff
14-
entry: ruff
14+
entry: ruff check
1515
args: [--fix, --exit-non-zero-on-fix]
1616
types: [python]
1717
language: system

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ update-lockfiles:
2424
.PHONY: format
2525
format:
2626
black $(sources)
27-
ruff $(sources) --fix --exit-zero
27+
ruff format $(sources)
2828

2929
.PHONY: lint
3030
lint:
3131
black $(sources) --check --diff
32-
ruff $(sources)
32+
ruff check $(sources) --fix
3333

3434
.PHONY: test
3535
test:

pyproject.toml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ dynamic = ['version']
4848
dependencies = [
4949
'pytest>=7',
5050
'black>=23',
51-
'ruff>=0.0.258',
51+
'ruff>=0.5.0',
5252
]
5353

5454
[project.entry-points.pytest11]
@@ -64,12 +64,18 @@ xfail_strict = true
6464

6565
[tool.ruff]
6666
line-length = 120
67-
exclude = ['cases_update']
68-
extend-select = ['Q', 'RUF100', 'C90', 'UP', 'I']
69-
flake8-quotes = {inline-quotes = 'single', multiline-quotes = 'double'}
70-
mccabe = { max-complexity = 14 }
71-
isort = { known-first-party = ['pytest_examples'] }
7267
target-version = 'py37'
68+
exclude = ['cases_update']
69+
lint.extend-ignore = [
70+
'E721', # using type() instead of isinstance() - we use this in tests
71+
]
72+
lint.extend-select = ['Q', 'RUF100', 'C90', 'UP', 'I']
73+
lint.flake8-quotes = {inline-quotes = 'single', multiline-quotes = 'double'}
74+
lint.mccabe = { max-complexity = 14 }
75+
lint.isort = { known-first-party = ['pytest_examples'] }
76+
77+
[tool.ruff.format]
78+
quote-style = 'single'
7379

7480
[tool.coverage.run]
7581
source = ['pytest_examples']

pytest_examples/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from .eval_example import EvalExample
88
from .find_examples import CodeExample, find_examples
99

10-
__version__ = '0.0.11'
10+
__version__ = '0.0.12'
1111
__all__ = 'find_examples', 'CodeExample', 'EvalExample'
1212

1313

pytest_examples/run_code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def _insert_print_args(
202202

203203
comment_prefix = '#> '
204204
comment_prefix_re = re.compile(f'^ *{re.escape(comment_prefix)}', re.MULTILINE)
205-
triple_quotes_prefix_re = re.compile('^ *(?:"{3}|\'{3})', re.MULTILINE)
205+
triple_quotes_prefix_re = re.compile("^ *(?:\"{3}|'{3})", re.MULTILINE)
206206

207207

208208
def find_print_line(lines: list[str], line_no: int) -> int:

requirements/linting.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
black
2-
ruff
2+
ruff>=0.5.0
33
# last version that supports 3.7
44
pre-commit==2.21.0

requirements/linting.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.10
2+
# This file is autogenerated by pip-compile with Python 3.11
33
# by the following command:
44
#
5-
# pip-compile --output-file=requirements/linting.txt --resolver=backtracking requirements/linting.in
5+
# pip-compile --output-file=requirements/linting.txt requirements/linting.in
66
#
77
black==23.1.0
88
# via -r requirements/linting.in
@@ -32,10 +32,8 @@ pre-commit==2.21.0
3232
# via -r requirements/linting.in
3333
pyyaml==6.0
3434
# via pre-commit
35-
ruff==0.0.258
35+
ruff==0.5.0
3636
# via -r requirements/linting.in
37-
tomli==2.0.1
38-
# via black
3937
virtualenv==20.21.0
4038
# via pre-commit
4139

requirements/pyproject.txt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.10
2+
# This file is autogenerated by pip-compile with Python 3.11
33
# by the following command:
44
#
5-
# pip-compile --output-file=requirements/pyproject.txt --resolver=backtracking pyproject.toml
5+
# pip-compile --output-file=requirements/pyproject.txt pyproject.toml
66
#
77
attrs==22.2.0
88
# via pytest
99
black==23.1.0
1010
# via pytest-examples (pyproject.toml)
1111
click==8.1.3
1212
# via black
13-
exceptiongroup==1.1.1
14-
# via pytest
1513
iniconfig==2.0.0
1614
# via pytest
1715
mypy-extensions==1.0.0
@@ -28,7 +26,5 @@ pluggy==1.0.0
2826
# via pytest
2927
pytest==7.2.2
3028
# via pytest-examples (pyproject.toml)
31-
tomli==2.0.1
32-
# via
33-
# black
34-
# pytest
29+
ruff==0.5.0
30+
# via pytest-examples (pyproject.toml)

requirements/testing.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
pytest-pretty
22
coverage
3-
ruff
3+
ruff>=0.5.0

requirements/testing.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.10
2+
# This file is autogenerated by pip-compile with Python 3.11
33
# by the following command:
44
#
55
# pip-compile --output-file=requirements/testing.txt requirements/testing.in
66
#
77
coverage==7.2.2
88
# via -r requirements/testing.in
9-
exceptiongroup==1.1.1
10-
# via pytest
119
iniconfig==2.0.0
1210
# via pytest
1311
markdown-it-py==2.2.0
@@ -26,7 +24,5 @@ pytest-pretty==1.1.1
2624
# via -r requirements/testing.in
2725
rich==13.3.2
2826
# via pytest-pretty
29-
ruff==0.0.258
27+
ruff==0.5.0
3028
# via -r requirements/testing.in
31-
tomli==2.0.1
32-
# via pytest

tests/test_run_examples.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,17 @@ def test_find_run_examples(example: CodeExample, eval_example: EvalExample):
107107

108108
output = '\n'.join(result.outlines)
109109
output = re.sub(r'(=|_){3,}', r'\1\1\1', output)
110-
assert (
111-
'=== FAILURES ===\n'
112-
'___ test_find_run_examples[my_file.md:1-4] ___\n'
113-
'ruff failed:\n'
114-
' my_file.md:2:8: F401 [*] `sys` imported but unused\n'
115-
' my_file.md:3:7: F821 Undefined name `missing`\n'
116-
' Found 2 errors.\n'
117-
' [*] 1 potentially fixable with the --fix option.\n'
118-
'=== short test summary info ===\n'
119-
) in output
110+
for phrase in [
111+
'=== FAILURES ===\n',
112+
'___ test_find_run_examples[my_file.md:1-4] ___\n',
113+
'ruff failed:\n',
114+
' my_file.md:2:8: F401 [*] `sys` imported but unused\n',
115+
' my_file.md:3:7: F821 Undefined name `missing`\n',
116+
' Found 2 errors.\n',
117+
' [*] 1 fixable with the `--fix` option.\n',
118+
'=== short test summary info ===\n',
119+
]:
120+
assert phrase in output
120121

121122

122123
def test_black_ok(pytester: pytest.Pytester):

0 commit comments

Comments
 (0)