forked from ashleve/lightning-hydra-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
192 lines (176 loc) · 4.47 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
[project]
name = "lightning-hydra-template"
version = "0.1.0"
description = "PyTorch Lightning + Hydra. A very user-friendly template for ML experimentation."
readme = "README.md"
repository = "https://github.com/nathanpainchaud/lighting-hydra-template"
requires-python = ">=3.12,<4"
dependencies = [
"hydra-colorlog>=1.2.0,<2",
"hydra-core>=1.3.2,<2",
"hydra-optuna-sweeper>=1.2.0,<2",
"lightning>=2.5.0.post0,<2.6",
"rich>=13.9.4,<14",
"rootutils>=1.0.7,<2",
"torchmetrics>=1.6.1,<1.7",
]
[project.optional-dependencies]
wandb = [
"wandb>=0.19.3,<0.20",
]
# torch libraries are not included in the main dependencies because they can be platform-specific
# rather, we leave them as optional dependencies (even though they are required for the code to run)
# and leave it up to the user to indicate which version they want to install
# This solution is inspired by one of the recommended ways to install pytorch listed in uv's documentation:
# https://docs.astral.sh/uv/guides/integration/pytorch/#configuring-accelerators-with-optional-dependencies
# Each extra corresponds to a different platform, so it is up to project maintainers to decide which platforms
# they want to list here, i.e. support
cpu = [
"torch>=2.5.1,<2.6",
"torchvision>=0.20.1,<0.21",
]
cu118 = [
"torch>=2.5.1,<2.6",
"torchvision>=0.20.1,<0.21",
]
cu121 = [
"torch>=2.5.1,<2.6",
"torchvision>=0.20.1,<0.21",
]
cu124 = [
"torch>=2.5.1,<2.6",
"torchvision>=0.20.1,<0.21",
]
[dependency-groups]
dev = [
"pre-commit>=4.0.1,<5",
{include-group = "lint"},
{include-group = "test"},
]
lint = [
"docformatter>=1.7.5,<2",
"ruff>=0.9.1,<0.10",
]
test = [
"pytest>=8.3.4,<9",
"pytest-cov>=6.0.0,<7",
"sh>=2.2.1,<3",
]
[project.scripts]
template-train = "lightning_hydra_template.train:main"
template-eval = "lightning_hydra_template.eval:main"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.uv]
required-version = ">=0.5.14,<0.6"
# Refer to the note above about installing pytorch using optional dependencies,
# especially the link to uv's documentation, to understand this configuration
conflicts = [
[
{ extra = "cpu" },
{ extra = "cu118" },
{ extra = "cu121" },
{ extra = "cu124" },
],
]
[tool.uv.sources]
# Refer to the note above about installing pytorch using optional dependencies,
# especially the link to uv's documentation, to understand this configuration
torch = [
{ index = "pytorch-cpu", extra = "cpu" },
{ index = "pytorch-cu118", extra = "cu118" },
{ index = "pytorch-cu121", extra = "cu121" },
{ index = "pytorch-cu124", extra = "cu124" },
]
torchvision = [
{ index = "pytorch-cpu", extra = "cpu" },
{ index = "pytorch-cu118", extra = "cu118" },
{ index = "pytorch-cu121", extra = "cu121" },
{ index = "pytorch-cu124", extra = "cu124" },
]
[[tool.uv.index]]
# Refer to the note above about installing pytorch using optional dependencies,
# especially the link to uv's documentation, to understand this configuration
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true
[[tool.uv.index]]
name = "pytorch-cu118"
url = "https://download.pytorch.org/whl/cu118"
explicit = true
[[tool.uv.index]]
name = "pytorch-cu121"
url = "https://download.pytorch.org/whl/cu121"
explicit = true
[[tool.uv.index]]
name = "pytorch-cu124"
url = "https://download.pytorch.org/whl/cu124"
explicit = true
[tool.pytest.ini_options]
addopts = [
"--color=yes",
"--durations=0",
"--strict-markers",
"--doctest-modules",
]
filterwarnings = [
"ignore::DeprecationWarning",
"ignore::UserWarning",
]
log_cli = "True"
markers = [
"slow: slow tests",
]
minversion = "6.0"
testpaths = "tests/"
[tool.coverage.run]
branch = true
[tool.coverage.report]
exclude_lines = [
"pragma: nocover",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
]
[tool.ruff]
line-length = 120
[tool.ruff.lint]
select = [
# pycodestyle
"E",
"W",
# Pyflakes
"F",
# pydocstyle
"D",
# pyupgrade
"UP",
# flake8-bandit
"S",
# flake8-bugbear
"B",
# flake8-simplify
"SIM",
# isort
"I",
# pep8-naming
"N",
# Pylint (except Refactor (R))
"PLC",
"PLE",
"PLW",
]
ignore = [
# Allow use of assert
"S101",
# Do not require docstrings in __init__ and modules
"D100",
"D104",
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.docformatter]
recursive = true
wrap-summaries=120
wrap-descriptions=120