-
Notifications
You must be signed in to change notification settings - Fork 42
/
pyproject.toml
176 lines (161 loc) · 5.63 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
# Copyright The Lightning AI team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
[metadata]
name = "litdata"
author = "Lightning-AI et al."
url = "https://github.com/Lightning-AI/lit-data"
[build-system]
requires = [
"setuptools",
"wheel",
]
[tool.docformatter]
recursive = true
# this need to be shorter as some docstings are r"""...
wrap-summaries = 119
wrap-descriptions = 120
blank = true
[tool.codespell]
# Todo: enable also python files in a next step
#skip = '*.py'
quiet-level = 3
# comma separated list of words; waiting for:
# https://github.com/codespell-project/codespell/issues/2839#issuecomment-1731601603
# also adding links until they ignored by its: nature
# https://github.com/codespell-project/codespell/issues/2243#issuecomment-1732019960
ignore-words-list = "cancelation"
[tool.ruff]
line-length = 120
target-version = "py38"
# Exclude a variety of commonly ignored directories.
exclude = [
".git",
"docs",
"src/litdata/utilities/_pytree.py",
]
# Enable Pyflakes `E` and `F` codes by default.
lint.select = [
"E", "W", # see: https://pypi.org/project/pycodestyle
"F", # see: https://pypi.org/project/pyflakes
"S", # see: https://pypi.org/project/flake8-bandit
"RUF018", # see: https://docs.astral.sh/ruff/rules/assignment-in-assert
"UP", # see: pyupgrade
]
lint.extend-select = [
"D",
"I", # see: isort
"C4", # see: https://pypi.org/project/flake8-comprehensions
"SIM", # see: https://pypi.org/project/flake8-simplify
"RET", # see: https://pypi.org/project/flake8-return
"PT", # see: https://pypi.org/project/flake8-pytest-style
"NPY201", # see: https://docs.astral.sh/ruff/rules/numpy2-deprecation
"RUF100", # yesqa
]
lint.ignore = [
"E731", # Do not assign a lambda expression, use a def
"S101", # todo: Use of `assert` detected
]
lint.ignore-init-module-imports = true
# Unlike Flake8, default to a complexity level of 10.
lint.mccabe.max-complexity = 10
# Use Google-style docstrings.
lint.pydocstyle.convention = "google"
[tool.ruff.lint.per-file-ignores]
"setup.py" = ["D100", "SIM115"]
"examples/**" = [
"D100", "D101", "D102", "D103", "D104", "D105", "D107", # Missing docstring in public module, class, method, function, package
"D205", # todo: 1 blank line required between summary line and description
"D401", "D404", # First line should be in imperative mood; try rephrasing
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
]
"src/**" = [
"D100", # Missing docstring in public module
"D101", # todo: Missing docstring in public class
"D102", # todo: Missing docstring in public method
"D103", # todo: Missing docstring in public function
"D104", # Missing docstring in public package
"D105", # todo: Missing docstring in magic method
"D107", # todo: Missing docstring in __init__
"D205", # todo: 1 blank line required between summary line and description
"D401", "D404", # todo: First line should be in imperative mood; try rephrasing
"S602", # todo: `subprocess` call with `shell=True` identified, security issue
"S605", # todo: Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
"S607", # todo: Starting a process with a partial executable path
"S310", # todo: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
]
"tests/**" = [
"D100", "D101", "D102", "D103", "D104", "D105", "D107", # Missing docstring in public module, class, method, function, package
"D401", "D404", # First line should be in imperative mood; try rephrasing
"S105", "S106", # todo: Possible hardcoded password: ...
]
[tool.mypy]
files = [
"src",
]
# This section is for folders with "-" as they are not valid python modules
exclude = [
"src/litdata/utilities/_pytree.py",
]
install_types = "True"
non_interactive = "True"
disallow_untyped_defs = "True"
ignore_missing_imports = "True"
show_error_codes = "True"
warn_redundant_casts = "True"
warn_unused_configs = "True"
warn_unused_ignores = "True"
allow_redefinition = "True"
# disable this rule as the Trainer attributes are defined in the connectors, not in its __init__
disable_error_code = "attr-defined"
# style choices
warn_no_return = "False"
# Ignore mypy errors for these files
# TODO: the goal is for this to be empty
[[tool.mypy.overrides]]
# the list can be generated with:
# mypy --no-error-summary 2>&1 | tr ':' ' ' | awk '{print $1}' | sort | uniq | sed 's/\.py//g; s|src/||g; s|\/|\.|g' | xargs -I {} echo '"{}",'
module = [
]
ignore_errors = "True"
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"warnings",
"pass",
"rank_zero_warn",
"raise NotImplementedError",
]
[tool.pytest.ini_options]
norecursedirs = [
".git",
".github",
"dist",
"build",
"docs",
]
addopts = [
"--strict-markers",
"--doctest-modules",
"--color=yes",
"--disable-pytest-warnings",
"--ignore=legacy/checkpoints",
]
markers = [
"cloud: Run the cloud tests for example",
]
filterwarnings = [
"error::FutureWarning",
]
xfail_strict = true
junit_duration_report = "call"