Repository navigation
Expand file tree
/
Copy pathruff.toml
More file actions
113 lines (111 loc) · 5.37 KB
/
Copy pathruff.toml
File metadata and controls
113 lines (111 loc) · 5.37 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
# SPDX-FileCopyrightText: 2025 Contributors to the OpenSTEF project <openstef@lfenergy.org>
#
# SPDX-License-Identifier: MPL-2.0
target-version = "py312"
line-length = 120
src = [
"examples",
"packages/*/src",
]
include = [
"examples/**/*.py",
"packages/**/*.py",
]
output-format = "concise"
format.preview = false
lint.select = [ "ALL" ]
lint.ignore = [
"COM812", # Conflicting rules (a), ruff itself suggest disabling them
"CPY001", # Reuse covers copyright checks
"D203", # Conflicting rules (a), ruff itself suggest disabling them
"D213", # Conflicting rules (a), ruff itself suggest disabling them
"EM101", # do not enforce message in variable when raising an exception
"FIX002", # TODO's are allowed when they are linked ot an issue (TD003 handles that part)
"PGH003", # Allow generic type ignores, since sometimes there are multiple unresolvable issues
"TC006", # Let's not force quoting the first param of typing.cast
"TRY003", # simplify exception messages
]
lint.per-file-ignores."./examples/benchmarks/custom/*" = [
"E402", # Imports not at top — notebook cells have natural ordering
"E501", # Long lines in markdown cells (API doc URLs)
"ERA001", # Jupytext YAML frontmatter looks like commented-out code
"T201", # Benchmarks may use print for demonstration
]
lint.per-file-ignores."./examples/benchmarks/liander2024/*" = [
"D100", # Module docstring is in a remove-cell for clean notebook rendering
"E402", # Imports not at top — os.environ must be set before imports
"E501", # Long lines in markdown cells (API doc URLs)
"ERA001", # Jupytext YAML frontmatter looks like commented-out code
"T201", # Benchmarks may use print for demonstration
]
lint.per-file-ignores."./examples/deployment/**/*.py" = [
"AIR311", # The example targets the installed Airflow 2.x TaskFlow API (airflow.decorators)
"D103", # Orchestrator ops / tasks / inline helpers are self-describing in examples
"D104", # Deployment package __init__ files are import markers, not documented surfaces
"DOC201", # Examples favour prose docstrings over explicit Returns sections
"TC001", # Keep imports inline (not under TYPE_CHECKING) for copy-paste readability
"TC002",
"TC003",
]
lint.per-file-ignores."./examples/deployment/tests/*.py" = [
"S101", # Tests use assert
]
lint.per-file-ignores."./examples/tutorials/*" = [
"D100", # Notebooks don't need module docstrings
"D103", # Inline helpers in notebooks don't need docstrings
"E402", # Imports not at top — notebook cells have natural ordering
"E501", # Long lines in notebooks — readability is cell-scoped
"ERA001", # Jupytext YAML frontmatter looks like commented-out code
"F821", # Cell-scoped names appear undefined to Ruff's module-level analysis
"INP001", # Not a namespace package — notebooks don't need __init__.py
"PLR2004", # Magic values in assertions are fine for notebook checks
"PT018", # Assertion style doesn't matter in notebooks
"PTH", # Tutorials may use os.path for simplicity
"S101", # Tutorials may use assert for runtime checks
"SLF001", # Private member access needed to demonstrate internals
"T201", # Tutorials may use print for demonstration
]
lint.per-file-ignores."./packages/*/src/*/__init__.py" = [
"RUF067", # Package __init__ modules set up a NullHandler logger, not only re-exports
]
lint.per-file-ignores."./packages/*/tests/*" = [
"ARG", # Unused function args -> fixtures nevertheless are functionally relevant...
"D", # All docstring rules
"DOC", # All docstring rules
"E501", # Line too long (test names can be descriptive)
"FBT", # Allow booleans as positional arguments in tests, e.g. via @pytest.mark.parametrize()
"PLR0913", # Pytests can have a lot of fixtures, ignore too many arguments
"PLR0917", # Pytests can have a lot of fixtures, ignore too many arguments
"PLR2004", # Magic value used in comparison
"RUF069", # Tests assert exact, deterministic float outputs (e.g. a rolling mean of known inputs)
"S101", # asserts allowed in tests...
"S311", # Standard pseudo-random generators
"SLF001", # Allow private access in tests
]
lint.per-file-ignores."./tools/*" = [
"T201", # tools are cli scripts and are allowed to use print
]
lint.per-file-ignores."./{docs,examples}/*" = [
"INP001", # example folders are not packages, so __init__.py is not needed
"T201", # examples are allowed to use print
]
lint.fixable = [ "ALL" ]
lint.flake8-annotations.allow-star-arg-any = true # *args and **kwargs are allowed to be Any
lint.flake8-annotations.suppress-dummy-args = true # do not type _ arguments/variables
lint.flake8-annotations.suppress-none-returning = true # do not require annotation if None is returned/there is no return
lint.flake8-bugbear.extend-immutable-calls = [
"openstef_core.types.Q",
] # Q is immutable, so adding it here to avoid false positives
lint.isort.known-first-party = [
"src",
"tests",
"examples",
] # Useful if ruff does not run from the actual root of the project and to import form tests
lint.pep8-naming.ignore-names = [ "X" ] # Allow X for SKLearn-like feature matrices
lint.pydocstyle.convention = "google"
lint.pylint.allow-dunder-method-names = [
"__get_pydantic_core_schema__",
"__pydantic_init_subclass__",
] # valid pydantic name
lint.pylint.max-args = 7 # the default of 5 is a bit limiting. 7 should be enough for nearly all cases
lint.preview = false