Skip to content

Commit 83131c1

Browse files
Josverldpgeorge
authored andcommitted
pyproject.toml: Update ruff configuration to target Python 3.8.
As per 4c9ce82 the tests now target Python 3.8 syntax and features, so update the ruff configuration to match. Changes in this commit: - Update to Python 3.8 syntax. - Ignore import not at top of module warnings. - Exclude common SDK folders. - Exclude cpydiff test with intentional error. Also see: micropython/micropython-lib#1059 Signed-off-by: Jos Verlinde <[email protected]>
1 parent 2fbd72a commit 83131c1

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

pyproject.toml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,17 @@ ACKNOWLEDGEMENTS,\
2222

2323
[tool.ruff]
2424
# Exclude third-party code from linting and formatting
25-
extend-exclude = ["lib"]
25+
extend-exclude = [
26+
"lib",
27+
"esp-idf",
28+
"pico-sdk",
29+
"emsdk",
30+
"tests/cpydiff/syntax_assign_expr.py" # intentionally incorrect CPython code
31+
]
2632
# Include Python source files that don't end with .py
2733
extend-include = ["tools/cc1"]
2834
line-length = 99
29-
target-version = "py37"
35+
target-version = "py38"
3036

3137
[tool.ruff.lint]
3238
exclude = [ # Ruff finds Python SyntaxError in these files
@@ -44,7 +50,7 @@ exclude = [ # Ruff finds Python SyntaxError in these files
4450
"tests/micropython/viper_args.py",
4551
]
4652
extend-select = ["C9", "PLC"]
47-
ignore = [
53+
extend-ignore = [
4854
"E401",
4955
"E402",
5056
"E722",
@@ -54,6 +60,7 @@ ignore = [
5460
"F403",
5561
"F405",
5662
"PLC0206",
63+
"PLC0415", # conditional imports are common in MicroPython
5764
]
5865
mccabe.max-complexity = 40
5966

@@ -64,6 +71,8 @@ mccabe.max-complexity = 40
6471
# manifest.py files are evaluated with some global names pre-defined
6572
"**/manifest.py" = ["F821"]
6673
"ports/**/boards/**/manifest_*.py" = ["F821"]
74+
# Uses assignment expressions.
75+
"tests/cpydiff/syntax_assign_expr.py" = ["F821"]
6776

6877
[tool.ruff.format]
6978
# Exclude third-party code, and exclude the following tests:

0 commit comments

Comments
 (0)