forked from kornia/kornia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
272 lines (246 loc) · 7.44 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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools>=61.2"]
[project]
name = "kornia"
description = "Open Source Differentiable Computer Vision Library for PyTorch"
keywords = ["computer vision", "deep learning", "pytorch"]
license = { text = "Apache-2.0" }
authors = [
{ name = "Edgar Riba", email = "edgar@kornia.org" },
]
requires-python = ">=3.9"
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Environment :: GPU",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Information Technology",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Image Processing",
"Topic :: Software Development :: Libraries",
]
dynamic = ["dependencies", "optional-dependencies", "readme", "version"]
[project.urls]
"Bug Tracker" = "https://github.com/kornia/kornia/issues"
Documentation = "https://kornia.readthedocs.io/en/latest"
Download = "https://github.com/kornia/kornia"
Issues = "https://github.com/kornia/kornia/issues"
Homepage = "https://kornia.github.io/"
"Source Code" = "https://github.com/kornia/kornia"
[tool.setuptools]
zip-safe = true
license-files = ["LICENSE"]
include-package-data = false
[tool.setuptools.dynamic]
dependencies = { file = ["requirements/requirements.txt"] }
version = { attr = "kornia.__version__" }
readme = { file = ["README.md"], content-type = "text/markdown" }
[tool.setuptools.dynamic.optional-dependencies]
dev = { file = "requirements/requirements-dev.txt" }
docs = { file = ["requirements/requirements-docs.txt"] }
x = { file = ["requirements/requirements-x.txt"] }
[tool.setuptools.packages.find]
exclude = ["docs*", "test*", "examples*"]
namespaces = false
[tool.setuptools.package-data]
kornia = ["py.typed"]
[tool.distutils.bdist_wheel]
universal = true
[tool.ruff]
target-version = "py39"
line-length = 120
[tool.ruff.format]
skip-magic-trailing-comma = false
[tool.ruff.lint]
select = [
"AIR", # Airflow
"ASYNC", # flake8-async
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C4", # flake8-comprehensions
"C90", # McCabe cyclomatic complexity
# "CPY", # Copyright-related rules
"DTZ", # flake8-datetimez
"E", # pycodestyle
"F", # Pyflakes
"FLY", # flynt
"I", # isort
"ICN", # flake8-import-conventions
"INT", # flake8-gettext
"NPY", # NumPy-specific rules
"PL", # Pylint
"PYI", # flake8-pyi
"RSE", # flake8-raise
"RUF", # Ruff-specific rules
"S", # flake8-bandit
"SLOT", # flake8-slots
"T10", # flake8-debugger
"TID", # flake8-tidy-imports
"UP", # pyupgrade
"W", # pycodestyle
"YTT", # flake8-2020
# "A", # flake8-builtins
# "ANN", # flake8-annotations
# "ARG", # flake8-unused-arguments
# "COM", # flake8-commas
"D", # pydocstyle
# "DJ", # flake8-django
# "EM", # flake8-errmsg
# "ERA", # eradicate
# "EXE", # flake8-executable
# "FA", # flake8-future-annotations
# "FBT", # flake8-boolean-trap
# "FIX", # flake8-fixme
# "G", # flake8-logging-format
# "INP", # flake8-no-pep420
# "ISC", # flake8-implicit-str-concat
# "N", # pep8-naming
# "PD", # pandas-vet
# "PERF", # Perflint
# "PGH", # pygrep-hooks
# "PIE", # flake8-pie
# "PT", # flake8-pytest-style
# "PTH", # flake8-use-pathlib
# "Q", # flake8-quotes
# "RET", # flake8-return
# "SIM", # flake8-simplify
# "SLF", # flake8-self
# "T20", # flake8-print
# "TCH", # flake8-type-checking
# "TD", # flake8-todos
# "TRY", # tryceratops
]
ignore = [
"PLR0915", # Allow condition check in list comprehension
"PLW2901", # Allow overwritten values on loops
"UP007", # Prefer Optional[], Union[] over | due to torch jit scripting
"UP006", # Prefer List[], over list due to torch jit scripting
"UP035", # Ignore deprecated typing because of jit scripting
'D100', # Allow Undocumented public module
'D101', # TODO: Undocumented public class
'D102', # TODO: Undocumented public method
'D103', # TODO: Undocumented public function
'D104', # TODO: Undocumented public package
'D105', # Allow Undocumented magic method
'D107', # TODO: Undocumented public init
'D417', # TODO: Undocumented params
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.isort]
forced-separate = ["testing", "tests"]
known-first-party = ["kornia"]
split-on-trailing-comma = true
[tool.ruff.lint.mccabe]
max-complexity = 20
[tool.ruff.lint.pylint]
allow-magic-value-types = ["bytes", "float", "int", "str"]
max-args = 30 # Recommended: 5
max-branches = 21 # Recommended: 12
max-returns = 13 # Recommended: 6
max-statements = 64 # Recommended: 50
[tool.ruff.lint.per-file-ignores]
"*/__init__.py" = ["F401", "F403"] # Allow unused imports and star imports
"benchmarks/*" = [
"BLE",
"RUF005",
"RUF012",
"S101",
"S311",
"D",
] # allow assert, random, ignore BLE, mutable class attr
"docs/*" = [
"PLR0912",
"PLR0915",
"S101",
"D",
] # allow assert, ignore max branches and statements
"docs/generate_examples.py" = ["C901"] # Allow too complex function
"kornia/__init__.py" = ["I001"] # Allow unsorted imports
"kornia/feature/dedode/*" = [
"C408",
"F401",
"F841",
"FLY002",
"PLR1714",
] # allow DINOv2 things
"testing/*" = [
"S101", # allow assert
"D", # Don't enforce documentation rules
]
"tests/*" = [
"BLE",
"RUF005",
"RUF012",
"S101",
"S311",
"B017", # Check for Exception since KORNIA_CHECK raises it
"D", # Don't enforce documentation rules
] # allow assert, random, ignore BLE, mutable class attr
[tool.pytest.ini_options]
addopts = "--color=yes"
markers = [
"grad: mark a test as gradcheck test",
"jit: mark a test as torchscript test",
"nn: mark a test as module test",
"slow: mark test as slow to run",
]
[tool.coverage.run]
branch = true
source = ['kornia/']
omit = ['*/__main__.py', '*/setup.py']
[tool.coverage.report]
show_missing = true
skip_covered = true
fail_under = 84
exclude_lines = [
# Based into the covdefaults plugin config
# a more strict default pragma
'\# pragma: no cover\b',
# allow defensive code
'^\s*raise AssertionError\b',
'^\s*raise NotImplementedError\b',
'^\s*return NotImplemented\b',
'^\s*raise$',
# typing-related code
'^\s*if (False|TYPE_CHECKING):',
': \.\.\.(\s*#.*)?$',
'^ +\.\.\.$',
# ----------------------------
"def __repr__",
"if __name__ == .__main__.:",
"if 0:",
"if self.debug:",
]
partial_branches = [
# a more strict default pragma
'\# pragma: no cover\b',
]
[tool.mypy]
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
files = ["kornia/"]
ignore_missing_imports = true
no_implicit_optional = true
pretty = true
show_error_codes = true
warn_redundant_casts = true
warn_unused_ignores = true
[[tool.mypy.overrides]]
module = "kornia.feature.dedode.transformer.*"
ignore_errors = true
[tool.pydocstyle]
match = '.*\.py'