forked from microsoft/onnxscript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
157 lines (141 loc) · 4.64 KB
/
pyproject.toml
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
[build-system]
requires = ["setuptools>=61.0.0"]
build-backend = "setuptools.build_meta"
[project]
name = "onnxscript"
dynamic = ["version"]
description = "Naturally author ONNX functions and models using a subset of Python"
authors = [{ name = "Microsoft Corporation", email = "onnx@microsoft.com" }]
readme = "README.md"
requires-python = ">=3.8"
license = { file = "LICENSE" }
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"Operating System :: POSIX",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: MIT License",
]
dependencies = ["numpy", "onnx>=1.14", "typing_extensions"]
[tool.setuptools.packages.find]
include = ["onnxscript*"]
# Tests are by default excluded: https://setuptools.pypa.io/en/latest/userguide/package_discovery.html
[tool.setuptools.package-data]
onnxscript = ["py.typed"]
onnx = ["py.typed"]
[tool.pytest.ini_options]
filterwarnings = ["ignore::UserWarning", "ignore::DeprecationWarning"]
addopts = "-rsfEX --tb=short --color=yes"
[tool.mypy]
follow_imports = "silent" # TODO: Remove when we fix all the mypy errors
strict_optional = true
warn_no_return = true
warn_unused_ignores = false # TODO: CI and local are inconsistent when this is true. Investigate.
warn_redundant_casts = true
warn_incomplete_stub = true
# TODO disallow_untyped_calls = true
check_untyped_defs = true
disallow_any_generics = false
# TODO disallow_incomplete_defs = true
# TODO disallow_subclassing_any = true
disallow_untyped_decorators = true
warn_unused_configs = true
show_column_numbers = true
[[tool.mypy.overrides]]
module = [
"onnx.*",
"onnxruntime.*",
"parameterized.*",
"torchgen.*",
]
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "tools.*"
disallow_untyped_defs = true
# Ignore errors in test
[[tool.mypy.overrides]]
module = [
"setup",
"onnxscript.tests.models.*",
"onnxscript.tests.onnx_backend_test_code.*",
]
ignore_errors = true
[tool.black]
target-version = ["py38", "py39", "py310", "py311"]
# Black's extend-exclude needs to be a regex string
extend-exclude = "/onnxscript/tests/models|/onnxscript/tests/onnx_backend_test_code"
line-length = 95
[tool.isort]
profile = "black"
extend_skip_glob = [
"onnxscript/tests/onnx_backend_test_code/*.py",
]
[tool.pylint.messages_control]
# This list is for vscode. Add new disables in pyproject_pylint.toml for lintrunner
# Exclude patterns should be modified in .lintrunner.toml
disable = [
"format",
"import-error",
"invalid-name", # TODO: Add naming guidance and enable this check.
"line-too-long",
"no-name-in-module",
"use-dict-literal", # Sometime it is preferable when we construct kwargs
]
[tool.pydocstyle]
convention = "google"
[tool.ruff]
target-version = "py38"
select = [
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"D", # pydocstyle
"E", # pycodestyle
"F", # Pyflakes
"G", # flake8-logging-format
"I", # isort
"ISC", # flake8-implicit-str-concat
"N", # pep8-naming
"NPY", # modern numpy
"PERF", # Perflint
"RUF", # Ruff-specific rules
"T10", # flake8-debugger
"TID252", # Disallow relative imports
"UP", # pyupgrade
"W", # pycodestyle
"YTT", # flake8-2020
]
ignore = [
"C408", # Sometimes it is preferable when we construct kwargs
"D1", # D1 is for missing docstrings, which is not yet enforced.
"D202", # D202 Too strict. "No blank lines allowed after function docstring"
"D205", # D205 Too strict. "1 blank line required between summary line and description"
"D212",
"D400",
"D401", # First line of docstring should be in imperative mood
"D415", # D415 Not yet enforced. "First line should end with a period, question mark, or exclamation point"
"E501", # Line length. Not enforced because black will handle formatting
"N802", # Nxx: ONNX Script function sometimes use upper case for names.
"N803",
"N806",
"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
"UP006", # keep-runtime-typing
"UP007", # keep-runtime-typing
]
line-length = 95
ignore-init-module-imports = true
[tool.ruff.per-file-ignores]
"__init__.py" = ["TID252"] # Allow relative imports in init files
[tool.ruff.flake8-tidy-imports]
# Disallow all relative imports.
ban-relative-imports = "all"
[tool.ruff.pydocstyle]
convention = "google"