pytorch
/
pyproject.toml
161 строка · 3.8 Кб
1[build-system]
2requires = [
3"setuptools",
4"wheel",
5"astunparse",
6"numpy",
7"ninja",
8"pyyaml",
9"cmake",
10"typing-extensions",
11"requests",
12]
13# Use legacy backend to import local packages in setup.py
14build-backend = "setuptools.build_meta:__legacy__"
15
16
17[tool.black]
18# Uncomment if pyproject.toml worked fine to ensure consistency with flake8
19# line-length = 120
20target-version = ["py38", "py39", "py310", "py311"]
21
22
23[tool.ruff]
24target-version = "py38"
25line-length = 120
26
27[tool.ruff.lint]
28# NOTE: Synchoronize the ignores with .flake8
29ignore = [
30# these ignores are from flake8-bugbear; please fix!
31"B007", "B008", "B017",
32"B018", # Useless expression
33"B019",
34"B023",
35"B028", # No explicit `stacklevel` keyword argument found
36"B904", # Migrate from TRY200
37"E402",
38"C408", # C408 ignored because we like the dict keyword argument syntax
39"E501", # E501 is not flexible enough, we're using B950 instead
40"E721",
41"E731", # Assign lambda expression
42"E741",
43"EXE001",
44"F405",
45"F841",
46# these ignores are from flake8-logging-format; please fix!
47"G101",
48# these ignores are from ruff NPY; please fix!
49"NPY002",
50# these ignores are from ruff PERF; please fix!
51"PERF203",
52"PERF401",
53"PERF403",
54# these ignores are from PYI; please fix!
55"PYI019",
56"PYI024",
57"PYI036",
58"PYI041",
59"PYI056",
60"SIM102", "SIM103", "SIM112", # flake8-simplify code styles
61"SIM113", # please fix
62"SIM105", # these ignores are from flake8-simplify. please fix or ignore with commented reason
63"SIM108",
64"SIM110",
65"SIM114", # Combine `if` branches using logical `or` operator
66"SIM115",
67"SIM116", # Disable Use a dictionary instead of consecutive `if` statements
68"SIM117",
69"SIM118",
70"UP006", # keep-runtime-typing
71"UP007", # keep-runtime-typing
72]
73select = [
74"B",
75"C4",
76"G",
77"E",
78"EXE",
79"F",
80"SIM1",
81"W",
82# Not included in flake8
83"LOG",
84"NPY",
85"PERF",
86"PGH004",
87"PIE794",
88"PIE800",
89"PIE804",
90"PIE807",
91"PIE810",
92"PLC0131", # type bivariance
93"PLC0132", # type param mismatch
94"PLC0205", # string as __slots__
95"PLE",
96"PLR0133", # constant comparison
97"PLR0206", # property with params
98"PLR1722", # use sys exit
99"PLW0129", # assert on string literal
100"PLW0406", # import self
101"PLW0711", # binary op exception
102"PLW1509", # preexec_fn not safe with threads
103"PLW3301", # nested min max
104"PT006", # TODO: enable more PT rules
105"PT022",
106"PT023",
107"PT024",
108"PT025",
109"PT026",
110"PYI",
111"RUF008", # mutable dataclass default
112"RUF015", # access first ele in constant time
113"RUF016", # type error non-integer index
114"RUF017",
115"TRY200", # TODO: migrate from deprecated alias
116"TRY302",
117"UP",
118]
119
120[tool.ruff.lint.per-file-ignores]
121"__init__.py" = [
122"F401",
123]
124"functorch/notebooks/**" = [
125"F401",
126]
127"test/typing/reveal/**" = [
128"F821",
129]
130"test/torch_np/numpy_tests/**" = [
131"F821",
132]
133"test/jit/**" = [
134"PLR0133", # tests require this for JIT
135"PYI",
136"RUF015",
137"UP", # We don't want to modify the jit test as they test specify syntax
138]
139"test/test_jit.py" = [
140"PLR0133", # tests require this for JIT
141"PYI",
142"RUF015",
143"UP", # We don't want to modify the jit test as they test specify syntax
144]
145# autogenerated #TODO figure out why file level noqa is ignored
146"torch/_inductor/fx_passes/serialized_patterns/**" = ["F401", "F501"]
147"torch/onnx/**" = [
148"UP037", # ONNX does runtime type checking
149]
150
151"torchgen/api/types/__init__.py" = [
152"F401",
153"F403",
154]
155"torchgen/executorch/api/types/__init__.py" = [
156"F401",
157"F403",
158]
159"torch/utils/collect_env.py" = [
160"UP", # collect_env.py needs to work with older versions of Python
161]
162