-
Notifications
You must be signed in to change notification settings - Fork 283
Expand file tree
/
Copy pathpyproject.toml
More file actions
165 lines (152 loc) · 6.25 KB
/
pyproject.toml
File metadata and controls
165 lines (152 loc) · 6.25 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
[project]
name = "monty-workspace"
version = "0"
requires-python = ">=3.10"
[tool.uv.workspace]
members = ["crates/monty-python"]
[dependency-groups]
dev = [
"basedpyright>=1.34.0",
"maturin>=1.9.4,<2.0",
"mypy>=1.19.1",
"ruff>=0.14.7",
"duckdb>=1.0.0",
"httpx>=0.28.1",
"playwright>=1.58.0",
"beautifulsoup4>=4.14.3",
"logfire>=4.25.0",
"devtools>=0.12.2",
"pydantic-ai-slim[anthropic,openai]>=1.63.0",
]
# https://beta.ruff.rs/docs/configuration/
[tool.ruff]
line-length = 120
include = [
"scripts/**/*.py",
"crates/**/*.py",
"crates/**/*.pyi",
]
# Exclude files with intentional syntax errors or special formatting requirements
extend-exclude = [
"crates/monty/test_cases/nonlocal__error_module_level.py",
"crates/monty/test_cases/traceback__nonlocal_module_scope.py",
# These files test specific quote styles in error messages and must not be reformatted
"crates/monty/test_cases/type__float_repr_newline.py",
"crates/monty/test_cases/type__float_repr_both_quotes.py",
]
[tool.ruff.lint]
extend-select = [
"Q", # https://docs.astral.sh/ruff/rules/#flake8-quotes-q
"RUF100", # https://docs.astral.sh/ruff/rules/unused-noqa/
"I", # https://docs.astral.sh/ruff/rules/#isort-i
"FA", # https://docs.astral.sh/ruff/rules/#flake8-future-annotations-fa
]
flake8-quotes = { inline-quotes = "single", multiline-quotes = "double" }
mccabe = { max-complexity = 14 }
[tool.ruff.lint.isort]
combine-as-imports = true
known-first-party = ["pydantic_monty"]
[tool.ruff.lint.per-file-ignores]
"crates/monty/test_cases/*.py" = [
"E722", # bare except - needed for testing try/except with bare except clauses
"E711", # Comparison to `None` should be `cond is None`
"E712", # Comparison to True/False - needed for testing boolean behavior
"E714", # Test for object identity should be `is not`
"E721", # Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks
"E731", # Do not assign a lambda expression, use a def - needed for testing lambda expressions
"F541", # f-string without any placeholders
"F632", # ignore replace `is` with `==` - we have lots of these tests
"F701", # break outside loop - needed for testing break error handling
"F702", # continue not properly in loop - needed for testing continue error handling
"F704", # await outside function - needed for testing top-level async/await
"F811", # Redefinition of unused variable
"F821", # traceback undefined call test intentionally uses undefined name
"F841", # unused variable - needed for testing exception variable cleanup
"F401", # Intentionally imports unknown typing constructs to test silent ignore behavior
"F403", # star import test intentionally uses `from sys import *`
"E402", # Typing test file has multiple import sections to test different import patterns
"E401", # Multiple imports on one line - needed for testing `import a, b` syntax
"I001", # Import block unsorted - needed for testing `import a, b` syntax
]
"crates/monty-typeshed/vendor/typeshed/stdlib/**/*.pyi" = [
"F403", # unable to detect undefined names
"F821", # Undefined name
]
"crates/monty-type-checking/tests/good_types.py" = [
"F704", # await outside function - needed for testing top-level async/await
]
[tool.ruff.format]
docstring-code-format = true
quote-style = "single"
[tool.pyright]
pythonVersion = "3.14"
typeCheckingMode = "strict"
reportUnnecessaryTypeIgnoreComment = true
include = ["scripts", "crates/monty/test_cases", "crates/monty-python", "crates/monty-type-checking", "examples"]
exclude = [
"crates/monty-type-checking/tests/bad_types.py",
"crates/monty-type-checking/tests/reveal_types.py",
# break/continue outside loop tests intentionally test error handling
"crates/monty/test_cases/loop__break_outside_error.py",
"crates/monty/test_cases/loop__continue_outside_error.py",
"crates/monty/test_cases/loop__break_in_function_error.py",
"crates/monty/test_cases/loop__continue_in_function_error.py",
"crates/monty/test_cases/loop__break_in_if_error.py",
"crates/monty/test_cases/loop__continue_in_if_error.py",
"scripts/startup_performance.py",
"examples/web_scraper/example_code.py",
]
venv = ".venv"
# we include tests cases in type checking then switch off all rules that break
# so the files don't show as errors in the IDE
[[tool.pyright.executionEnvironments]]
root = "crates/monty/test_cases"
reportUnusedExpression = false
reportOperatorIssue = false
reportGeneralTypeIssues = false
reportMissingImports = false
reportUnknownMemberType = false
reportUnnecessaryComparison = false
reportUnnecessaryIsInstance = false
reportUnknownArgumentType = false
reportUnknownVariableType = false
reportUnhashable = false
reportCallIssue = false
reportUnknownParameterType = false
reportMissingParameterType = false
reportUnknownLambdaType = false
reportArgumentType = false
# iter mode tests use external functions defined in the test runner
reportUndefinedVariable = false
# loop variable persistence tests have "possibly unbound" variables
reportPossiblyUnboundVariable = false
# exception variable cleanup tests intentionally access unbound variables
reportUnboundVariable = false
# attribute error tests intentionally access/assign non-existent attributes
reportAttributeAccessIssue = false
# unused variables and imports are fine in test cases
reportUnusedVariable = false
reportUnusedImport = false
reportDuplicateImport = false
reportAssignmentType = false
reportFunctionMemberAccess = false
# ~bool is deprecated in Python 3.16 but valid in 3.14
reportDeprecated = false
# star import test intentionally uses `from sys import *`
reportWildcardImportFromLibrary = false
# some test cases intentionally exercise invalid index assignment/runtime error paths
reportIndexIssue = false
[[tool.pyright.executionEnvironments]]
root = "crates/monty-type-checking"
reportUnnecessaryIsInstance = false
[tool.codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
ignore-words-list = 'crate,NotIn,ser,IST'
skip = [
"Cargo.lock",
"crates/monty-js/package-lock.json",
"crates/monty-typeshed/vendor/typeshed/stdlib/*",
"crates/monty/src/types/str.rs",
]
[tool.inline-snapshot]
format-command="ruff format --stdin-filename {filename}"