Skip to content

Commit ede445d

Browse files
authored
fix package config (#526)
* fix package config * apply
1 parent 493fd24 commit ede445d

File tree

2 files changed

+135
-120
lines changed

2 files changed

+135
-120
lines changed

.pre-commit-config.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,13 @@ repos:
7171
files: \.(json|yml|yaml|toml)
7272
# https://prettier.io/docs/en/options.html#print-width
7373
args: ["--print-width=120"]
74+
75+
- repo: https://github.com/tox-dev/pyproject-fmt
76+
rev: v2.5.0
77+
hooks:
78+
- id: pyproject-fmt
79+
additional_dependencies: [tox]
80+
- repo: https://github.com/abravalheri/validate-pyproject
81+
rev: v0.23
82+
hooks:
83+
- id: validate-pyproject

pyproject.toml

+125-120
Original file line numberDiff line numberDiff line change
@@ -12,117 +12,160 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
[metadata]
16-
name = "litdata"
17-
author = "Lightning-AI et al."
18-
url = "https://github.com/Lightning-AI/lit-data"
19-
2015
[build-system]
2116
requires = [
22-
"setuptools",
23-
"wheel",
17+
"setuptools",
18+
"wheel",
2419
]
2520

26-
[tool.docformatter]
27-
recursive = true
28-
# this need to be shorter as some docstings are r"""...
29-
wrap-summaries = 119
30-
wrap-descriptions = 120
31-
blank = true
32-
33-
[tool.codespell]
34-
# Todo: enable also python files in a next step
35-
#skip = '*.py'
36-
quiet-level = 3
37-
# comma separated list of words; waiting for:
38-
# https://github.com/codespell-project/codespell/issues/2839#issuecomment-1731601603
39-
# also adding links until they ignored by its: nature
40-
# https://github.com/codespell-project/codespell/issues/2243#issuecomment-1732019960
41-
ignore-words-list = "cancelation"
42-
43-
4421
[tool.ruff]
45-
line-length = 120
4622
target-version = "py38"
23+
line-length = 120
4724
# Exclude a variety of commonly ignored directories.
4825
exclude = [
49-
".git",
50-
"docs",
51-
"src/litdata/utilities/_pytree.py",
26+
".git",
27+
"docs",
28+
"src/litdata/utilities/_pytree.py",
5229
]
5330
# Enable Pyflakes `E` and `F` codes by default.
5431
lint.select = [
55-
"E", "W", # see: https://pypi.org/project/pycodestyle
56-
"F", # see: https://pypi.org/project/pyflakes
57-
"S", # see: https://pypi.org/project/flake8-bandit
58-
"RUF018", # see: https://docs.astral.sh/ruff/rules/assignment-in-assert
59-
"UP", # see: pyupgrade
32+
"E",
33+
"F", # see: https://pypi.org/project/pyflakes
34+
"RUF018", # see: https://docs.astral.sh/ruff/rules/assignment-in-assert
35+
"S", # see: https://pypi.org/project/flake8-bandit
36+
"UP", # see: pyupgrade
37+
"W", # see: https://pypi.org/project/pycodestyle
6038
]
6139
lint.extend-select = [
62-
"D",
63-
"I", # see: isort
64-
"C4", # see: https://pypi.org/project/flake8-comprehensions
65-
"SIM", # see: https://pypi.org/project/flake8-simplify
66-
"RET", # see: https://pypi.org/project/flake8-return
67-
"PT", # see: https://pypi.org/project/flake8-pytest-style
68-
"NPY201", # see: https://docs.astral.sh/ruff/rules/numpy2-deprecation
69-
"RUF100", # yesqa
40+
"C4", # see: https://pypi.org/project/flake8-comprehensions
41+
"D",
42+
"I", # see: isort
43+
"NPY201", # see: https://docs.astral.sh/ruff/rules/numpy2-deprecation
44+
"PT", # see: https://pypi.org/project/flake8-pytest-style
45+
"RET", # see: https://pypi.org/project/flake8-return
46+
"RUF100", # yesqa
47+
"SIM", # see: https://pypi.org/project/flake8-simplify
7048
]
7149
lint.ignore = [
72-
"E731", # Do not assign a lambda expression, use a def
73-
"S101", # todo: Use of `assert` detected
50+
"E731", # Do not assign a lambda expression, use a def
51+
"S101", # todo: Use of `assert` detected
52+
]
53+
lint.per-file-ignores."examples/**" = [
54+
"D100",
55+
"D101",
56+
"D102",
57+
"D103",
58+
"D104",
59+
"D105",
60+
"D107", # Missing docstring in public module, class, method, function, package
61+
"D205", # todo: 1 blank line required between summary line and description
62+
"D401",
63+
"D404", # First line should be in imperative mood; try rephrasing
64+
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
65+
]
66+
lint.per-file-ignores."setup.py" = [ "D100", "SIM115" ]
67+
lint.per-file-ignores."src/**" = [
68+
"D100", # Missing docstring in public module
69+
"D101", # todo: Missing docstring in public class
70+
"D102", # todo: Missing docstring in public method
71+
"D103", # todo: Missing docstring in public function
72+
"D104", # Missing docstring in public package
73+
"D105", # todo: Missing docstring in magic method
74+
"D107", # todo: Missing docstring in __init__
75+
"D205", # todo: 1 blank line required between summary line and description
76+
"D401",
77+
"D404", # todo: First line should be in imperative mood; try rephrasing
78+
"S310", # todo: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
79+
"S602", # todo: `subprocess` call with `shell=True` identified, security issue
80+
"S605", # todo: Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
81+
"S607", # todo: Starting a process with a partial executable path
82+
]
83+
lint.per-file-ignores."tests/**" = [
84+
"D100",
85+
"D101",
86+
"D102",
87+
"D103",
88+
"D104",
89+
"D105",
90+
"D107", # Missing docstring in public module, class, method, function, package
91+
"D401",
92+
"D404", # First line should be in imperative mood; try rephrasing
93+
"S105",
94+
"S106", # todo: Possible hardcoded password: ...
7495
]
7596
# Unlike Flake8, default to a complexity level of 10.
7697
lint.mccabe.max-complexity = 10
7798
# Use Google-style docstrings.
7899
lint.pydocstyle.convention = "google"
79100

80-
[tool.ruff.lint.per-file-ignores]
81-
"setup.py" = ["D100", "SIM115"]
82-
"examples/**" = [
83-
"D100", "D101", "D102", "D103", "D104", "D105", "D107", # Missing docstring in public module, class, method, function, package
84-
"D205", # todo: 1 blank line required between summary line and description
85-
"D401", "D404", # First line should be in imperative mood; try rephrasing
86-
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
87-
]
88-
"src/**" = [
89-
"D100", # Missing docstring in public module
90-
"D101", # todo: Missing docstring in public class
91-
"D102", # todo: Missing docstring in public method
92-
"D103", # todo: Missing docstring in public function
93-
"D104", # Missing docstring in public package
94-
"D105", # todo: Missing docstring in magic method
95-
"D107", # todo: Missing docstring in __init__
96-
"D205", # todo: 1 blank line required between summary line and description
97-
"D401", "D404", # todo: First line should be in imperative mood; try rephrasing
98-
"S602", # todo: `subprocess` call with `shell=True` identified, security issue
99-
"S605", # todo: Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
100-
"S607", # todo: Starting a process with a partial executable path
101-
"S310", # todo: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
102-
]
103-
"tests/**" = [
104-
"D100", "D101", "D102", "D103", "D104", "D105", "D107", # Missing docstring in public module, class, method, function, package
105-
"D401", "D404", # First line should be in imperative mood; try rephrasing
106-
"S105", "S106", # todo: Possible hardcoded password: ...
107-
]
101+
[tool.codespell]
102+
# Todo: enable also python files in a next step
103+
#skip = '*.py'
104+
quiet-level = 3
105+
# comma separated list of words; waiting for:
106+
# https://github.com/codespell-project/codespell/issues/2839#issuecomment-1731601603
107+
# also adding links until they ignored by its: nature
108+
# https://github.com/codespell-project/codespell/issues/2243#issuecomment-1732019960
109+
ignore-words-list = "cancelation"
110+
111+
[tool.docformatter]
112+
recursive = true
113+
# this need to be shorter as some docstings are r"""...
114+
wrap-summaries = 119
115+
wrap-descriptions = 120
116+
blank = true
108117

118+
[tool.pytest.ini_options]
119+
testpaths = [
120+
"tests",
121+
]
122+
norecursedirs = [
123+
".git",
124+
".github",
125+
"dist",
126+
"build",
127+
"docs",
128+
]
129+
addopts = [
130+
"--strict-markers",
131+
"--doctest-modules",
132+
"--color=yes",
133+
"--disable-pytest-warnings",
134+
"--ignore=legacy/checkpoints",
135+
]
136+
markers = [
137+
"cloud: Run the cloud tests for example",
138+
]
139+
filterwarnings = [
140+
"error::FutureWarning",
141+
]
142+
xfail_strict = true
143+
junit_duration_report = "call"
109144

145+
[tool.coverage.report]
146+
exclude_lines = [
147+
"pragma: no cover",
148+
"warnings",
149+
"pass",
150+
"rank_zero_warn",
151+
"raise NotImplementedError",
152+
]
110153

111154
[tool.mypy]
112155
files = [
113-
"src",
156+
"src",
114157
]
115158
# This section is for folders with "-" as they are not valid python modules
116159
exclude = [
117-
"src/litdata/utilities/_pytree.py",
118-
"src/litdata/streaming/item_loader.py",
119-
"src/litdata/utilities/breakpoint.py",
120-
"src/litdata/utilities/subsample.py",
121-
"src/litdata/streaming/sampler.py",
122-
"src/litdata/streaming/shuffle.py",
123-
"src/litdata/imports.py",
124-
"src/litdata/imports.py",
125-
"src/litdata/processing/data_processor.py",
160+
"src/litdata/utilities/_pytree.py",
161+
"src/litdata/streaming/item_loader.py",
162+
"src/litdata/utilities/breakpoint.py",
163+
"src/litdata/utilities/subsample.py",
164+
"src/litdata/streaming/sampler.py",
165+
"src/litdata/streaming/shuffle.py",
166+
"src/litdata/imports.py",
167+
"src/litdata/imports.py",
168+
"src/litdata/processing/data_processor.py",
126169
]
127170
install_types = "True"
128171
non_interactive = "True"
@@ -146,41 +189,3 @@ warn_no_return = "False"
146189
module = [
147190
]
148191
ignore_errors = "True"
149-
150-
151-
[tool.coverage.report]
152-
exclude_lines = [
153-
"pragma: no cover",
154-
"warnings",
155-
"pass",
156-
"rank_zero_warn",
157-
"raise NotImplementedError",
158-
]
159-
160-
161-
[tool.pytest.ini_options]
162-
testpaths = [
163-
"tests",
164-
]
165-
norecursedirs = [
166-
".git",
167-
".github",
168-
"dist",
169-
"build",
170-
"docs",
171-
]
172-
addopts = [
173-
"--strict-markers",
174-
"--doctest-modules",
175-
"--color=yes",
176-
"--disable-pytest-warnings",
177-
"--ignore=legacy/checkpoints",
178-
]
179-
markers = [
180-
"cloud: Run the cloud tests for example",
181-
]
182-
filterwarnings = [
183-
"error::FutureWarning",
184-
]
185-
xfail_strict = true
186-
junit_duration_report = "call"

0 commit comments

Comments
 (0)