onnxruntime
/
pyproject.toml
109 строк · 3.8 Кб
1[tool.black]
2line-length = 120
3# NOTE: Do not extend the exclude list. Edit .lintrunner.toml instead
4extend-exclude = "cmake|onnxruntime/core/flatbuffers/"
5target-version = ["py37", "py38", "py39", "py310", "py311"]
6
7[tool.isort]
8# NOTE: Do not extend the exclude list. Edit .lintrunner.toml instead
9profile = "black"
10line_length = 120
11extend_skip_glob = [
12"cmake/*",
13"orttraining/*",
14"onnxruntime/core/flatbuffers/*",
15]
16
17[tool.pydocstyle]
18convention = "google"
19
20[tool.pylint.BASIC]
21good-names = [
22"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n",
23"p", "q", "r", "s", "t", "u", "v", "w", "ex", "Run", "_", "x", "y", "z"
24]
25
26[tool.pylint.messages_control]
27disable = [
28"format",
29"line-too-long",
30"import-error",
31"no-name-in-module",
32"no-member",
33"too-many-arguments",
34"too-many-locals",
35"too-few-public-methods",
36"missing-docstring",
37"fixme",
38]
39
40[tool.pyright]
41exclude = ["onnxruntime/core/flatbuffers/*"]
42reportMissingImports = false
43
44[tool.ruff]
45# NOTE: Do not create an exclude list. Edit .lintrunner.toml instead
46target-version = "py38"
47
48[tool.ruff.lint]
49select = [
50"B", # flake8-bugbear
51"E", # pycodestyle
52"F", # Pyflakes
53"FURB", # refurb
54"G", # flake8-logging-format
55"ISC", # flake8-implicit-str-concat
56"N", # pep8-naming
57"NPY", # numpy
58"PERF", # Perflint
59"PIE", # flake8-pie
60"PLC", # pylint conventions
61"PLE", # pylint errors
62"PLW", # pylint warnings
63"PYI", # flake8-pyi
64"RUF", # Ruff-specific rules
65"SIM", # flake8-simplify
66"SLOT", # flake8-slots
67"T10", # flake8-debugger
68"UP", # pyupgrade
69"W", # pycodestyle
70"YTT", # flake8-2020
71]
72# NOTE: Refrain from growing the ignore list unless for exceptional cases.
73# Always include a comment to explain why.
74ignore = [
75"B028", # FIXME: Add stacklevel to warnings
76"E501", # Line length controlled by black
77"G004", # FIXME: Enable when the rule can be autofixed
78"N803", # Argument casing
79"N812", # Allow import torch.nn.functional as F
80"N813", # Allow importing camelcase names in lowercase
81"N999", # Module names
82"NPY002", # np.random.Generator may not always fit our use cases
83"PERF203", # "try-except-in-loop" only affects Python <3.11, and the improvement is minor; can have false positives
84"PERF401", # List comprehensions are not always readable
85"PYI041", # May create confusion
86"PYI024", # May create confusion
87"SIM102", # We don't perfer always combining if branches
88"SIM103", # Do not collapse if-else
89"SIM108", # We don't encourage ternary operators
90"SIM114", # Don't combine if branches for debugability
91"SIM116", # Don't use dict lookup to replace if-else
92]
93ignore-init-module-imports = true
94unfixable = [
95"F401", # Unused imports
96"SIM112", # Use upper case for env vars
97]
98
99[tool.ruff.lint.per-file-ignores]
100# NOTE: Refrain from growing the ignore list unless for exceptional cases.
101# Prefer inline ignores with `noqa: xxx`.
102# Eventually this list should become empty.
103"orttraining/orttraining/test/**" = ["N802"] # Function casing
104"tools/nuget/generate_nuspec_for_native_nuget.py" = ["ISC003"] # Too many errors to fix
105"onnxruntime/contrib_ops/cuda/sparse/sparse_attention_v1/sparse_attention_triton.py" = ["N806"] # use of Q, K and V in triton script
106"onnxruntime/contrib_ops/cuda/sparse/sparse_attention_v2/sparse_attention_v2_triton.py" = ["N806"] # use of Q, K and V in triton script
107"onnxruntime/test/python/quantization/test_op_gemm.py" = ["N806"] # use of A for a matrix
108"onnxruntime/test/python/quantization/op_test_utils.py" = ["N806", "PERF203", "RUF012"] # use of A for a matrix
109"orttraining/orttraining/python/training/ort_triton/kernel/_flash_attn.py" = ["N806", "PLW2901", "ISC001", "E731"] # Long triton code from other repo.
110