Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
146 lines (133 loc) · 3.27 KB
/
Copy pathpyproject.toml
File metadata and controls
146 lines (133 loc) · 3.27 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
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
[build-system]
requires = ["setuptools>=57", "wheel"]
build-backend = "setuptools.build_meta"
[tool.bandit]
target = ["test", "roboflow"]
tests = ["B201", "B301"]
[tool.ruff]
target-version = "py310"
line-length = 120
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"A",
"ANN",
"ARG",
"B",
"BLE",
"C",
"COM",
"CPY",
"D",
"DTZ",
"EM",
"ERA",
"FBT",
"FIX",
"FLY",
"FURB",
"ISC",
"N",
"PERF",
"PIE",
"PLC0415", # `import` should be at the top-level of a file
"PLR",
"PLW",
"PT",
"PTH",
"RET",
"RUF",
"S",
"SIM",
"SLF",
"T",
"TD",
"TRY",
"UP",
]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"yarn-error.log",
"yarn.lock",
"docs",
"tests/manual/debugme.py", # file is intentionally broken
]
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.per-file-ignores]
"__init__.py" = [
"E402", # Module level import not at top of file
"F401", # Imported but unused
]
"tests/manual/*.py" = [
"INP001", # Manual scripts don't need __init__.py
]
"roboflow/util/http.py" = [
"TID251", # Wraps the requests functions that the rest of the SDK can't call
]
[tool.ruff.lint.pyupgrade]
# Preserve types, even if a file imports `from __future__ import annotations`.
keep-runtime-typing = true
[tool.ruff.lint.flake8-tidy-imports]
banned-module-level-imports = [
"cv2",
"matplotlib",
"numpy",
]
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"requests.delete".msg = "Use roboflow.util.http.delete, which sends the SDK's User-Agent."
"requests.get".msg = "Use roboflow.util.http.get, which sends the SDK's User-Agent."
"requests.head".msg = "Use roboflow.util.http.head, which sends the SDK's User-Agent."
"requests.patch".msg = "Use roboflow.util.http.patch, which sends the SDK's User-Agent."
"requests.post".msg = "Use roboflow.util.http.post, which sends the SDK's User-Agent."
"requests.put".msg = "Use roboflow.util.http.put, which sends the SDK's User-Agent."
"requests.request".msg = "Use roboflow.util.http.request, which sends the SDK's User-Agent."
[tool.mypy]
python_version = "3.10"
exclude = ["^build/"]
# numpy's bundled stubs use PEP 695 `type` statements, which mypy rejects when
# checking against python_version 3.10. Skip following them so the type checker
# doesn't choke on numpy's own stub syntax.
[[tool.mypy.overrides]]
module = ["numpy", "numpy.*"]
follow_imports = "skip"
follow_imports_for_stubs = true
[[tool.mypy.overrides]]
module = [
"_datetime.*",
"filetype.*",
# IPython is an optional dependency
"IPython.display.*",
# ipywidgets is an optional dependency
"ipywidgets.*",
# pillow-heif is an optional dependency ([heic] extra)
"pillow_heif.*",
"requests_toolbelt.*",
"rfdetr.*",
"torch.*",
"ultralytics.*",
]
ignore_missing_imports = true