@@ -51,6 +51,8 @@ docs = [
51
51
" sphinxcontrib_github_alt" ,
52
52
" traitlets" ,
53
53
]
54
+ lint = [" black>=22.6.0" , " mdformat>0.7" , " ruff>=0.0.156" ]
55
+ typing = [" mypy>=0.990" ]
54
56
55
57
[project .scripts ]
56
58
jupyter = " jupyter_core.command:main"
@@ -81,6 +83,26 @@ dependencies = ["coverage", "pytest-cov"]
81
83
test = " python -m pytest -vv --cov jupyter_core --cov-branch --cov-report term-missing:skip-covered {args}"
82
84
nowarn = " test -W default {args}"
83
85
86
+ [tool .hatch .envs .typing ]
87
+ features = [" test" , " typing" ]
88
+ dependencies = [" mypy>=0.990" ]
89
+ [tool .hatch .envs .typing .scripts ]
90
+ test = " mypy --install-types --non-interactive {args:.}"
91
+
92
+ [tool .hatch .envs .lint ]
93
+ features = [" lint" ]
94
+ [tool .hatch .envs .lint .scripts ]
95
+ style = [
96
+ " ruff {args:.}" ,
97
+ " black --check --diff {args:.}" ,
98
+ " mdformat --check {args:*.md}"
99
+ ]
100
+ fmt = [
101
+ " black {args:.}" ,
102
+ " ruff --fix {args:.}" ,
103
+ " mdformat {args:*.md}"
104
+ ]
105
+
84
106
[tool .mypy ]
85
107
check_untyped_defs = true
86
108
disallow_any_generics = true
@@ -97,6 +119,9 @@ warn_unused_configs = true
97
119
warn_redundant_casts = true
98
120
warn_return_any = true
99
121
warn_unused_ignores = true
122
+ exclude = [
123
+ " jupyter_core/tests/.*/profile_default/.*_config.py"
124
+ ]
100
125
101
126
[tool .pytest .ini_options ]
102
127
addopts = " -raXs --durations 10 --color=yes --doctest-modules --ignore-glob=jupyter_core/tests/dotipython*"
@@ -123,3 +148,64 @@ exclude_lines = [
123
148
" class .*\b Protocol\\ ):" ,
124
149
" @(abc\\ .)?abstractmethod" ,
125
150
]
151
+
152
+ [tool .black ]
153
+ line-length = 100
154
+ skip-string-normalization = true
155
+ target-version = [" py38" ]
156
+
157
+ [tool .ruff ]
158
+ target-version = " py38"
159
+ line-length = 100
160
+ select = [
161
+ " A" , " B" , " C" , " E" , " F" , " FBT" , " I" , " N" , " Q" , " RUF" , " S" , " T" ,
162
+ " UP" , " W" , " YTT" ,
163
+ ]
164
+ ignore = [
165
+ # Allow non-abstract empty methods in abstract base classes
166
+ " B027" ,
167
+ # Ignore McCabe complexity
168
+ " C901" ,
169
+ # Allow boolean positional values in function calls, like `dict.get(... True)`
170
+ " FBT003" ,
171
+ # Use of `assert` detected
172
+ " S101" ,
173
+ # Line too long
174
+ " E501" ,
175
+ # Relative imports are banned
176
+ " I252" ,
177
+ # Boolean ... in function definition
178
+ " FBT001" , " FBT002" ,
179
+ # Module level import not at top of file
180
+ " E402" ,
181
+ # A001/A002/A003 .. is shadowing a python builtin
182
+ " A001" , " A002" , " A003" ,
183
+ # Possible hardcoded password
184
+ " S105" , " S106" ,
185
+ # Q000 Single quotes found but double quotes preferred
186
+ " Q000" ,
187
+ # N806 Variable `B` in function should be lowercase
188
+ " N806" ,
189
+ # T201 `print` found
190
+ " T201" ,
191
+ # N802 Function name `CreateWellKnownSid` should be lowercase
192
+ " N802" , " N803"
193
+ ]
194
+ unfixable = [
195
+ # Don't touch print statements
196
+ " T201" ,
197
+ # Don't touch noqa lines
198
+ " RUF100" ,
199
+ ]
200
+
201
+ [tool .ruff .per-file-ignores ]
202
+ # B011 Do not call assert False since python -O removes these calls
203
+ # F841 local variable 'foo' is assigned to but never used
204
+ # C408 Unnecessary `dict` call
205
+ # E402 Module level import not at top of file
206
+ # T201 `print` found
207
+ # B007 Loop control variable `i` not used within the loop body.
208
+ # N802 Function name `assertIn` should be lowercase
209
+ "tests/*" = [" B011" , " F841" , " C408" , " E402" , " T201" , " B007" , " N802" ]
210
+ # F821 Undefined name `get_config`
211
+ "jupyter_core/tests/**/profile_default/*_config.py" = [" F821" ]
0 commit comments