forked from modular/modular
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
116 lines (109 loc) · 3.89 KB
/
pyproject.toml
File metadata and controls
116 lines (109 loc) · 3.89 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
[project]
name = "modular"
version = "0"
requires-python = ">= 3.9"
[tool.black]
include = '\.mojo$'
line-length = 80
preview = true
fast = true
force-exclude = '''
(
/(
third-party/llvm-project
| third-party/vllm-benchmarks
| \.derived
| venv
| utils/mblack
| KGEN/test/mojo-parser
| KGEN/test/mojo-isolated
| SDK/lib/API/python/max/serve/schemas
)/
)
'''
[tool.ruff]
line-length = 80 # Must match above
src = ["something-that-doesnt-exist"] # Stop ruff from assuming any root directory is a python module
extend-exclude = [
"**/lit.cfg.py", # Globals that aren't imported
"*.ipynb",
"*max/serve/schemas/openai.py", # Generated file
"third-party",
"bazel/internal/llvm-lit/lit.common.cfg.py", # Globals that aren't imported
"utils/mblack",
]
[tool.ruff.lint]
ignore = [
"ANN002", # TODO: Missing type annotation for *args
"ANN003", # TODO: Missing type annotation for **kwargs
"ANN201", # TODO: Missing return type annotation for public function
"ANN202", # TODO: Missing return type annotation for private function
"ANN204", # TODO: Missing return type annotation for special method
"ANN205", # TODO: Missing return type annotation for staticmethod
"ANN206", # TODO: Missing return type annotation for classmethod
"ANN401", # TODO: Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
"B008", # Do not perform function call in argument defaults
"B017", # Do not assert blind exception: `Exception`
"B028", # No explicit `stacklevel` keyword argument found
"D105", # undocumented-magic-method
"E402", # TODO: import top of file
"E712", # TODO: Unnecessary comparison to bool
"E722", # bare except
"E731", # TODO: Don't assign lambda
"E741", # TODO: Ambiguous variable name
"F403", # glob imports
"F405", # TODO: glob imports undefined
"F821", # TODO: Undefined names, means script is invalid
"F841", # TODO: unused variables
"RUF005", # Consider iterable unpacking instead of concatenation
"RUF009", # Do not perform function call in dataclass defaults
"RUF010", # Use explicit conversion flag
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"RUF015", # Prefer `next(iter(iterable))` over single element slice
"SIM101", # Duplicate isinstance
"SIM102", # Collapsible if
"SIM105", # Suppressible exception
"SIM108", # Use ternary operator
"SIM114", # Combine arms with or
"SIM115", # Use context manager for opening files
"SIM117", # Merge with statements
"SIM300", # YODA conditions
"SIM905", # Use a list literal instead of str.split
"UP007", # TODO: Enable when we drop 3.9
]
extend-select = [
"ANN", # Require function type annotations
"B", # Bugbear lints
"D", # Pydocstyle lints
"FURB", # Refurb lints for modernization
"I", # Import sorting lints
"RUF", # Ruff specific lints
"SIM", # Simplify lints
"T10", # Checks for the presence of debugger calls and imports.
"UP", # Type annotations should not use Union, Optional, etc
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"] # Ignore unused imports being re-exported
# Slow rollout of pydocstyle lint:
"!SDK/lib/API/python/max/{engine/api.py,driver/driver.py}" = ["D"]
# Ignore ANN001 (function argument missing type annotation) for auto-generated
# stubfiles
"*.pyi" = ["ANN001"]
# Disable lints which complain about weird unicode characters in files that include
# a large number of LLM test prompts.
"SDK/integration-test/pipelines/python/test_common/test_data.py" = ["RUF001", "RUF003"]
"CloudInfra/services/sonic/tester/__main__.py" = ["RUF001", "RUF003"]
[tool.pyright]
# TODO: Upgrade to strict mode
typeCheckingMode = "basic"
include = ["GenericML/tools/model/"]
exclude = [
"**/node_modules",
"**/__pycache__",
"GenericML/tools/model/tests",
"utils/mblack",
]
force-exclude = ["GenericML/tools/model/tests", "utils/mblack"]
reportMissingImports = false