-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathpyproject.toml
More file actions
142 lines (128 loc) · 3.93 KB
/
pyproject.toml
File metadata and controls
142 lines (128 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# SPDX-FileCopyrightText: ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
[project]
dynamic = ["version"]
name = "onnxoptimizer"
description = "ONNX Optimizer"
license = "Apache-2.0"
authors = [
{name = 'ONNX Optimizer Authors', email = "onnx-technical-discuss@lists.lfai.foundation"},
]
readme = "README.md"
keywords = [
"deep-learning",
"ONNX",
]
dependencies = [
"onnx",
]
requires-python = ">= 3.10"
[project.urls]
Homepage = 'https://github.com/onnx/optimizer'
[project.scripts]
onnxoptimizer = "onnxoptimizer:main"
[build-system]
requires = [
"setuptools>=68",
"wheel",
"cmake>=3.22",
"protobuf>=4.25.1"
]
build-backend = "setuptools.build_meta"
[tool.pytest.ini_options]
addopts = "-n auto"
testpaths = [
"onnxoptimizer/test/"
]
[tool.mypy]
# follow-imports = silent # TODO remove this
mypy_path = "stubs:third_party/onnx/third_party/pybind11"
strict_optional = true
warn_return_any = true
warn_no_return = true
# TODO warn_unused_ignores = true
warn_redundant_casts = true
warn_incomplete_stub = true
# TODO disallow_untyped_calls = true
check_untyped_defs = true
disallow_any_generics = true
no_implicit_optional = true
# TODO disallow_incomplete_defs = true
# TODO disallow_subclassing_any = true
disallow_untyped_decorators = true
warn_unused_configs = true
[[tool.mypy.overrides]]
module = "onnxoptimizer.*"
disallow_untyped_defs = true
[[tool.mypy.overrides]]
module = "onnx_opt_cpp2py_export"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "onnx.*"
disallow_untyped_defs = true
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "tools.*"
disallow_untyped_defs = true
# Ignore errors in setup.py
[[tool.mypy.overrides]]
module = "setup"
ignore_errors = true
[tool.ruff]
line-length = 95
target-version = "py39"
[tool.ruff.lint]
select = [
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"E", # pycodestyle
"F", # Pyflakes
"G", # flake8-logging-format
"I", # isort
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"N", # pep8-naming
"NPY", # modern numpy
"PERF", # Perflint
"PIE", # flake8-pie
"PYI", # flake8-pyi
"RUF", # Ruff-specific rules
"SIM", # flake8-simplify
"SLOT", # flake8-slot
"T10", # flake8-debugger
"TID", # Disallow relative imports
"TRY", # flake8-try-except-raise
"UP", # pyupgrade
"W", # pycodestyle
"YTT", # flake8-2020
]
ignore = [
"B9", # Opinionated bugbear rules
"C408", # Sometimes it is preferable when we construct kwargs
"D1", # D1 is for missing docstrings, which is not yet enforced.
"D401", # First line of docstring should be in imperative mood
"E1", "E2", "E3", # Pycodestyle formatting rules that conflicts with the formatter
"E501", # Line length. Not enforced because black will handle formatting
"SIM103", # "Return the condition directly" obscures logic sometimes
"N999", # Invalid module name
"NPY002", # We may not always need a generator
"PERF203", # try-except in loops sometimes necessary
"PERF401", # List comprehension is not always readable
"PYI041", # int | float is more clear
"RUF022", # We don't need to sort __all__ for elements to be grouped
"RUF031", # Parentheses for tuple in subscripts is more readable
"RUF052", # Variables with `_` prefix may not be dummy variables in all cases
"SIM102", # Collapsible if statements are not always more readable
"SIM108", # We don't always encourage ternary operators
"SIM114", # Don't always combine if branches for debuggability
"SIM116", # Don't use dict lookup to replace if-else
"TRY003", # Messages can be constructed in the exception
]
[tool.ruff.lint.extend-per-file-ignores]
"third_party/*" = ["ALL"]
"*_pb2.py" = ["ALL"]
"build/*" = ["ALL"]
".setuptools-cmake-build*/*" = ["ALL"]
"setup.py" = ["N801"] # setuptools command classes must be lowercase
"onnxoptimizer/test/*" = ["N806"] # Test files use uppercase var names for ONNX conventions