-
Notifications
You must be signed in to change notification settings - Fork 1
/
pyproject.toml
230 lines (216 loc) · 6.06 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
[tool.ruff]
line-length = 110
extend-exclude = [
"tests/xonsh-data",
"tests/data",
"ply_parser/tests/data",
"pegen",
"benchmarks",
"tasks/bench_utils.py",
"peg_parser/parser/untokenizer.py",
"ply_parser/tests/line-items",
"ply_parser/ply/save_table.py",
"ply_parser/ply/yacc.py",
]
[tool.ruff.lint]
extend-select = [
"B",
"I",
"UP",
"C90", # mccaabe complexity
"N", # pep8 naming
"YTT", # flake8-2020 sys.version
# "ANN", # flake8 annotations
"A", # flake8-builtins
"C4", # flake8-comprehensions
"FA", # flake8-future-annotations
"PIE", # flake8-pie
"PT", # pytest
"SIM", # simplify
"TCH", # type checking
"PL", # pylint
"PERF", # performance
# "FURB", # modernize
"RUF", # ruff
]
extend-safe-fixes = ["FA", "TCH", "PT"]
# ruff ignore file "xonsh_parser/ply/yacc.py"
[tool.ruff.lint.per-file-ignores]
"tests/*" = [
"ANN", # requiring annotations
"PL", # pylint
"PT023", # [*] Use `@pytest.mark.xfail()` over `@pytest.mark.xfail`
"PT001", # [*] Use `@pytest.mark.parametrize` instead of `@pytest.mark.parametrize`
"PT006", # need tuple
"PT007", # Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple`"
"RUF001", # similar chars
"E402", # module level import not at top of file
]
"peg_parser/parser.py" = [
"A", # flake8-builtins
"C90", # mccaabe complexity
"PLR0", # Too many arguments
"RUF005", # concatenation
"F841", # [*] Local variable `strstart` is assigned to but never used
]
"tests/test_subproc_macros.py" = ["PT014"]
"tasks/generator.py" = ["N802", "PLR0913", "PLR2004", "C901"]
"*/subheader.py" = [
"C901",
"PLR0915", # too many statements
"PLR0912", # Too many branches"
"PLR0911", # Too many return statements
"PLR0913", # Too many arguments
]
"*/tokenize.py" = [
"A001", # Variable `any` is shadowing a Python builtin
"F405", #
"F821", # Undefined name `strstart`
"F841", # [*] Local variable `strstart` is assigned to but never used
"B904", # Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
"PLR", # pylint
"C901", # too complex
"N818", # exception naming
]
"*/token.py" = [
"N802", # function name should be lowercase
]
"ply_parser/*.py" = [
"PLR0913", # too many arguments
"N8", # pep8 naming
"UP", # pyupgrade
"PLR", # pylint
"C901", # too complex
"SIM", # simplification
"PIE", # flake8-pie
"RUF",
"PERF", # performance
"E721",
"E741",
"C408", # Unnecessary `dict` call (rewrite as a literal)
"A001",
"A002",
]
"ply_parser/tests/*.py" = [
"C4",
"PT011",
"B017",
"F821",
"B021",
"A002", # builtin shadowing
"B007", # Loop control variable `rule` not used within loop body
"E402", # module level import not at top of file
]
"ply_parser/ply/*.py" = [
"B007", # Loop control variable `rule` not used within loop body
"PLW", # pylint warning
"B904",
"E741", # Ambiguous variable name: `l`
"E731",
"A0",
"C419",
"C408",
]
"ply_parser/parsers/*.py" = [
"C419", # unnecessary comprehension
"E741", # Ambiguous variable name: `l`
"C408", # Unnecessary `dict` call (rewrite as a literal)
"C416",
"A001",
"A002",
"PLW2901",
]
"ply_parser/xast.py" = ["F401"]
[tool.pytest.ini_options]
log_file = "pytest.log"
log_file_level = "DEBUG"
log_file_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
# --benchmark-columns=mean,stddev,median,iqr,ops,rounds,iterations
#addopts = "--benchmark-skip"
[tool.uv.workspace]
members = ["xonsh_tokenizer", "rs-ply"]
[tool.uv.sources]
xonsh_tokenizer = { workspace = true }
rs-ply = { workspace = true }
[dependency-groups]
test = [
"pytest",
"pytest-cov",
"pytest-subtests>=0.12.1",
"pytest-testmon>=2.1.1",
"pytest-instafail>=0.5.0",
"pytest-benchmark[histogram]>=4.0.0",
"xonsh>=0.12.0",
"tree-sitter",
"tree-sitter-python @ git+https://github.com/tree-sitter/tree-sitter-python",
"xonsh-rd-parser @ git+https://github.com/jnoortheen/xonsh-rd-parser",
"maturin-import-hook>=0.1.0",
"ruamel.yaml",
]
dev = [
"flask>=3.0.3",
"flask-wtf>=1.2.1",
"ipython>=8.18.1",
"setuptools>=69.5.1",
"xonsh-tokenizer",
"rs-ply",
"pip",
"psutil",
]
docs = ["mkdocs-material", "mkdocstrings[python]"]
profile = [
"asv>=0.5.1",
"virtualenv>=20.21.0",
"pympler>=1.0.1",
"guppy3>=3.1.2",
"memray",
"pytest-memray",
]
[build-system]
requires = ["setuptools>=64", "wheel", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
#version_file = "peg_parser/_version.py"
[project]
name = "xonsh-parser"
authors = [{ name = "xonsh-parser", email = "[email protected]" }]
description = "Xonsh parser using PLY"
readme = "README.md"
dynamic = ["version"]
classifiers = ["Programming Language :: Python :: 3 :: Only"]
requires-python = ">=3.10"
dependencies = ["mypy-extensions>=1.0.0"]
[tool.setuptools.package-dir]
peg_parser = "peg_parser"
pegen = "pegen"
[project.urls]
Documentation = "https://jnoortheen.github.io/xonsh-parser/"
Source = "https://github.com/jnoortheen/xonsh-parser"
[tool.mypy]
# mypy ignore file "xonsh_parser/ply/yacc.py"
packages = "peg_parser"
exclude = ['tests', 'pegen\/build.py', 'pegen\/grammar_parser.py']
check_untyped_defs = true
ignore_missing_imports = true
follow_imports = 'skip'
strict = true
warn_unused_configs = true
warn_redundant_casts = true
warn_unreachable = true
show_error_codes = true
show_column_numbers = true
show_error_context = true
show_error_code_links = true
error_summary = true
pretty = true
disable_error_code = ["unused-ignore"]
[[tool.mypy.overrides]]
module = "peg_parser.parser"
allow_redefinition = true
local_partial_types = true
warn_unreachable = false
disable_error_code = [
"func-returns-value", # 61
"arg-type", # 331 errors
]
#strict = false