@@ -203,193 +203,102 @@ publish-clean-build = [
203203]
204204
205205[tool .ruff ]
206- target-version = " py39"
207- line-length = 88
208- indent-width = 4
209206exclude = [
210207 " .git" ,
211- " build" ,
212208 " __pycache__" ,
209+ " build" ,
213210 " tests/examples_arguments_syntax" ,
214211 " tests/examples_methods_syntax" ,
215212]
213+ indent-width = 4
214+ line-length = 88
215+ target-version = " py39"
216216
217217[tool .ruff .lint ]
218- # https://docs.astral.sh/ruff/preview/
219- preview = true
220-
221- # https://docs.astral.sh/ruff/settings/#lint_extend-safe-fixes
222- extend-safe-fixes =[
223- # unnecessary-comprehension-in-call
224- " C419" ,
225- # literal-membership
226- " PLR6201" ,
227- # from __future__ import annotations #
228- # ---------------------------------- #
229- " UP006" ,
230- " UP007" ,
231- " UP008" ,
232- " TCH" ,
233- # assign exception msg to variable #
234- # -------------------------------- #
235- " EM101" ,
236- " EM102" ,
237- # trailing-whitespace
238- " W291" ,
239- # blank line contains whitespace
240- " W293" ,
241- # unsorted-dunder-all
242- " RUF022" ,
243- # pydocstyle #
244- # ---------- #
245- # fits-on-one-line
246- " D200" ,
247- # escape-sequence-in-docstring
248- " D301" ,
249- # ends-in-period
250- " D400" ,
251- # missing-return-type-special-method
252- " ANN204" ,
253- # unnecessary-dict-comprehension-for-iterable
254- " C420" ,
218+ extend-safe-fixes = [ # https://docs.astral.sh/ruff/settings/#lint_extend-safe-fixes
219+ " ANN204" , # missing-return-type-special-method
220+ " C419" , # unnecessary-comprehension-in-call
221+ " C420" , # unnecessary-dict-comprehension-for-iterable
222+ " D200" , # fits-on-one-line
223+ " D301" , # escape-sequence-in-docstring
224+ " D400" , # ends-in-period
225+ " EM101" , # raw-string-in-exception
226+ " EM102" , # f-string-in-exception
227+ " PLR6201" , # literal-membership
228+ " TC" , # flake8-type-checking
229+ " UP006" , # non-pep585-annotation
230+ " UP007" , # non-pep604-annotation-union
231+ " UP008" , # super-call-with-parameters
232+ " W291" , # trailing-whitespace
233+ " W293" , # blank line contains whitespace
255234]
256-
257- # https://docs.astral.sh/ruff/preview/#using-rules-that-are-in-preview
258- extend-select =[
259- # refurb
260- " FURB" ,
261- # pylint (preview) autofix #
262- # ------------------------ #
263- # unnecessary-dunder-call
264- " PLC2801" ,
265- # unnecessary-dict-index-lookup
266- " PLR1733" ,
267- # unnecessary-list-index-lookup
268- " PLR1736" ,
269- # literal-membership
270- " PLR6201" ,
271- # unspecified-encoding
272- " PLW1514" ,
235+ extend-select = [ # https://docs.astral.sh/ruff/preview/#using-rules-that-are-in-preview
236+ " FURB" , # refurb
237+ " PLC2801" , # unnecessary-dunder-call
238+ " PLR1733" , # unnecessary-dict-index-lookup
239+ " PLR1736" , # unnecessary-list-index-lookup
240+ " PLR6201" , # literal-membership
241+ " PLW1514" , # unspecified-encoding
273242]
274- select = [
275- # flake8-bugbear
276- " B" ,
277- # flake8-comprehensions
278- " C4" ,
279- # pycodestyle-error
280- " E" ,
281- # flake8-errmsg
282- " EM" ,
283- # pyflakes
284- " F" ,
285- # flake8-future-annotations
286- " FA" ,
287- # flynt
288- " FLY" ,
289- # flake8-pie
290- " PIE" ,
291- # flake8-pytest-style
292- " PT" ,
293- # flake8-use-pathlib
294- " PTH" ,
295- # Ruff-specific rules
296- " RUF" ,
297- # flake8-simplify
298- " SIM" ,
299- # flake8-type-checking
300- " TCH" ,
301- # flake8-tidy-imports
302- " TID" ,
303- # pyupgrade
304- " UP" ,
305- # pycodestyle-warning
306- " W" ,
307- # pylint (stable) autofix #
308- # ----------------------- #
309- # iteration-over-set
310- " PLC0208" ,
311- # manual-from-import
312- " PLR0402" ,
313- # useless-return
314- " PLR1711" ,
315- # repeated-equality-comparison
316- " PLR1714" ,
317- # collapsible-else-if
318- " PLR5501" ,
319- # useless-else-on-loop
320- " PLW0120" ,
321- # subprocess-run-without-check
322- " PLW1510" ,
323- # nested-min-max
324- " PLW3301" ,
325- # pydocstyle #
326- # ---------- #
327- " D" ,
328- # multi-line-summary-second-line
329- " D213" ,
330- # numpy-specific-rules
331- " NPY" ,
332- # flake8-annotations
333- " ANN" ,
334- # unsorted-imports
335- " I001" ,
336- # complex-structure
337- " C901" ,
243+ ignore = [
244+ " ANN401" , # any-type
245+ " D100" , # undocumented-public-module
246+ " D101" , # undocumented-public-class
247+ " D102" , # undocumented-public-method
248+ " D103" , # undocumented-public-function
249+ " D104" , # undocumented-public-package
250+ " D105" , # undocumented-magic-method
251+ " D107" , # undocumented-public-init
252+ " D206" , # indent-with-spaces
253+ " D212" , # multi-line-summary-first-line ((D213) is the opposite of this)
254+ " D401" , # non-imperative-mood
255+ " D413" , # missing-blank-line-after-last-section
256+ " E501" , # line-too-long (https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules)
257+ " RUF012" , # mutable-class-default
258+ " RUF052" , # used-dummy-variable
259+ " SIM105" , # suppressible-exception (https://github.com/vega/altair/pull/3431#discussion_r1629808660)
260+ " W505" , # doc-line-too-long
338261]
339- ignore = [
340- # Whitespace before ':'
341- " E203" ,
342- # Too many leading '#' for block comment
343- " E266" ,
344- # Line too long
345- " E501" ,
346- # zip() without an explicit strict= parameter set.
347- # python>=3.10 only
348- " B905" ,
349- # mutable-class-default
350- " RUF012" ,
351- # used-dummy-variable
352- " RUF052" ,
353- # suppressible-exception
354- # https://github.com/vega/altair/pull/3431#discussion_r1629808660
355- " SIM105" ,
356- # pydocstyle/ https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules #
357- # ------------------------------------------------------------------------- #
358- # undocumented-public-module
359- " D100" ,
360- # undocumented-public-class
361- " D101" ,
362- # undocumented-public-method
363- " D102" ,
364- # undocumented-public-function
365- " D103" ,
366- # undocumented-public-package
367- " D104" ,
368- # undocumented-magic-method
369- " D105" ,
370- # undocumented-public-init
371- " D107" ,
372- # indent-with-spaces
373- " D206" ,
374- # multi-line-summary-first-line ((D213) is the opposite of this)
375- " D212" ,
376- # Imperative mood
377- " D401" ,
378- # Blank line after last section
379- " D413" ,
380- # doc-line-too-long
381- " W505" ,
382- # Any as annotation
383- " ANN401"
262+ mccabe.max-complexity = 10
263+ preview = true # https://docs.astral.sh/ruff/preview/
264+ pydocstyle.convention = " numpy" # https://docs.astral.sh/ruff/settings/#lintpydocstyle
265+ select = [
266+ " ANN" , # flake8-annotations
267+ " B" , # flake8-bugbear
268+ " C4" , # flake8-comprehensions
269+ " C901" , # complex-structure
270+ " D" , # pydocstyle
271+ " D213" , # multi-line-summary-second-line
272+ " E" , # pycodestyle-error
273+ " EM" , # flake8-errmsg
274+ " F" , # pyflakes
275+ " FA" , # flake8-future-annotations
276+ " FLY" , # flynt
277+ " I001" , # unsorted-imports
278+ " NPY" , # numpy-specific-rules
279+ " PIE" , # flake8-pie
280+ " PLC0208" , # iteration-over-set
281+ " PLR0402" , # manual-from-import
282+ " PLR1711" , # useless-return
283+ " PLR1714" , # repeated-equality-comparison
284+ " PLR5501" , # collapsible-else-if
285+ " PLW0120" , # useless-else-on-loop
286+ " PLW1510" , # subprocess-run-without-check
287+ " PLW3301" , # nested-min-max
288+ " PT" , # flake8-pytest-style
289+ " PTH" , # flake8-use-pathlib
290+ " RUF" , # Ruff-specific rules
291+ " SIM" , # flake8-simplify
292+ " TC" , # flake8-type-checking
293+ " TID" , # flake8-tidy-imports
294+ " UP" , # pyupgrade
295+ " W" , # pycodestyle-warning
384296]
385- # https://docs.astral.sh/ruff/settings/#lintpydocstyle
386- pydocstyle ={ convention =" numpy" }
387- mccabe ={ max-complexity =10 }
388297
389298[tool .ruff .lint .isort ]
390- classes = [" expr " , " datum " ]
299+ classes = [" datum " , " expr " ]
391300extra-standard-library = [" typing_extensions" ]
392- known-first-party = [
301+ known-first-party = [
393302 " altair_tiles" ,
394303 " sphinxext_altair" ,
395304 " vega_datasets" ,
@@ -400,37 +309,30 @@ split-on-trailing-comma = false
400309
401310[tool .ruff .lint .flake8-tidy-imports .banned-api ]
402311# https://docs.astral.sh/ruff/settings/#lint_flake8-tidy-imports_banned-api
403- "typing.Optional".msg = """
404- Use `Union[T, None]` instead.
405- `typing.Optional` is likely to be confused with `altair.typing.Optional`, \
406- which have a similar but different semantic meaning.
407- See https://github.com/vega/altair/pull/3449
408- """
409312"narwhals.dependencies".msg = """
410313Import `dependencies` from `narwhals.stable.v1` instead.
411314"""
315+ "narwhals.dtypes".msg = """
316+ Import `dtypes` from `narwhals.stable.v1` instead.
317+ """
412318"narwhals.typing".msg = """
413319Import `typing` from `narwhals.stable.v1` instead.
414320"""
415- "narwhals.dtypes".msg = """
416- Import `dtypes` from `narwhals.stable.v1` instead.
321+ "typing.Optional".msg = """
322+ Use `Union[T, None]` instead.
323+ `typing.Optional` is likely to be confused with `altair.typing.Optional`, \
324+ which have a similar but different semantic meaning.
325+ See https://github.com/vega/altair/pull/3449
417326"""
418327
419328[tool .ruff .lint .per-file-ignores ]
420- # Only enforce type annotation rules on public api
421- "!altair/vegalite/v5/api.py" = [" ANN" ]
422- # Allow complex if/elif branching during tests
423- "tests/**/*.py" = [" C901" ]
424-
329+ "!altair/vegalite/v5/api.py" = [" ANN" ] # Only enforce annotation rules on public api
330+ "tests/**/*.py" = [" C901" ] # Allow complex if/elif branching during tests
425331
426332[tool .ruff .format ]
427- quote-style = " double"
428- indent-style = " space"
429- skip-magic-trailing-comma = false
430- line-ending = " lf"
431- # https://docs.astral.sh/ruff/formatter/#docstring-formatting
432- docstring-code-format = true
333+ docstring-code-format = true # https://docs.astral.sh/ruff/formatter/#docstring-formatting
433334docstring-code-line-length = 88
335+ line-ending = " lf"
434336
435337[tool .pytest .ini_options ]
436338# Pytest does not need to search these folders for test functions.
0 commit comments