-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpyproject.toml
More file actions
183 lines (176 loc) · 5.7 KB
/
pyproject.toml
File metadata and controls
183 lines (176 loc) · 5.7 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
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
[build-system]
build-backend = "hatchling.build"
requires = [ "hatchling" ]
[project]
name = "imread-benchmark"
version = "0.2.0"
requires-python = ">=3.11"
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
dependencies = [
"numpy",
"pandas",
"py-cpuinfo",
"tqdm",
"typer>=0.12",
]
# Two groups, not thirteen. Real conflicts only exist between these two:
# tensorflow vs torch — numpy/protobuf pin fights
# Everything else (opencv, skimage, imageio, kornia-rs, simplejpeg, turbojpeg,
# imagecodecs, pyvips, jpeg4py, torch, torchvision, Pillow) coexists in one venv.
#
# Pillow-SIMD WAS a third group (incompatible with mainstream Pillow). Dropped
# 2026-04 — see docs/gcp_benchmarks.md "Why no Pillow-SIMD?" for rationale.
optional-dependencies.mainstream = [
"imagecodecs",
"imageio",
"jpeg4py; sys_platform=='linux'",
"kornia-rs",
"opencv-python-headless",
"pillow",
"pyturbojpeg<2",
"pyvips",
# Bundled libvips wheels (Linux x86/arm + macOS x86/arm + Windows). Lets
# pyvips run in CFFI API mode without `apt install libvips-dev` /
# `brew install vips`, killing ~150 packages of GLib/GTK closure on the VM.
"pyvips-binary>=8.18",
"scikit-image",
"simplejpeg",
"torch",
"torchvision",
]
optional-dependencies.plot = [ "matplotlib>=3.8", "seaborn>=0.13" ]
optional-dependencies.tensorflow = [ "tensorflow" ]
scripts.imread-benchmark = "imread_benchmark.cli:app"
entry-points."imread_benchmark.decoders".imagecodecs = "imread_benchmark.decoders.imagecodecs_decoder:ImageCodecsDecoder"
entry-points."imread_benchmark.decoders".imageio = "imread_benchmark.decoders.imageio_decoder:ImageIODecoder"
entry-points."imread_benchmark.decoders".jpeg4py = "imread_benchmark.decoders.jpeg4py_decoder:Jpeg4pyDecoder"
entry-points."imread_benchmark.decoders".kornia = "imread_benchmark.decoders.kornia_decoder:KorniaDecoder"
# Decoder registry. Adding a new decoder = adding one line here. The runtime
# REGISTRY is built by iterating these entry points — no central import list,
# no manual dict maintenance, plays well with out-of-tree decoder plugins.
entry-points."imread_benchmark.decoders".opencv = "imread_benchmark.decoders.opencv_decoder:OpenCVDecoder"
entry-points."imread_benchmark.decoders".pillow = "imread_benchmark.decoders.pillow_decoder:PillowDecoder"
entry-points."imread_benchmark.decoders".pyvips = "imread_benchmark.decoders.pyvips_decoder:PyVipsDecoder"
entry-points."imread_benchmark.decoders".simplejpeg = "imread_benchmark.decoders.simplejpeg_decoder:SimpleJpegDecoder"
entry-points."imread_benchmark.decoders".skimage = "imread_benchmark.decoders.skimage_decoder:SkimageDecoder"
entry-points."imread_benchmark.decoders".tensorflow = "imread_benchmark.decoders.tensorflow_decoder:TensorFlowDecoder"
entry-points."imread_benchmark.decoders".torchvision = "imread_benchmark.decoders.torchvision_decoder:TorchvisionDecoder"
entry-points."imread_benchmark.decoders".turbojpeg = "imread_benchmark.decoders.turbojpeg_decoder:TurboJPEGDecoder"
[dependency-groups]
dev = [
"pillow",
"pre-commit>=3.5",
"pytest>=8",
]
[tool.hatch]
build.targets.wheel.packages = [ "imread_benchmark" ]
[tool.uv]
sources.torch = { index = "pytorch-cpu" }
sources.torchvision = { index = "pytorch-cpu" }
index = [
# CPU-only PyTorch wheels — avoids ~3 GB of CUDA libs we never use.
# `explicit = true` means this index is only consulted for packages
# explicitly assigned in [tool.uv.sources] below.
{ name = "pytorch-cpu", url = "https://download.pytorch.org/whl/cpu", explicit = true },
]
[tool.ruff]
target-version = "py311"
line-length = 120
indent-width = 4
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
"venvs",
]
format.indent-style = "space"
format.quote-style = "double"
format.line-ending = "auto"
format.skip-magic-trailing-comma = false
lint.select = [ "ALL" ]
lint.ignore = [
"ANN001",
"ANN201",
"ANN202",
"ANN401",
"B027",
"BLE001",
"D100",
"D101",
"D102",
"D103",
"D104",
"D105",
"D107",
"D203",
"D205",
"D212",
"EM101",
"EM102",
"FBT003",
"G004",
"N812",
"PLC0415",
"PLR2004",
"PLW0603",
"T201",
"TC002",
"TC003",
"TRY003",
]
lint.explicit-preview-rules = true
# CLI dispatch code: typer's idiomatic patterns (Option-as-default,
# bool flags, subprocess calls into trusted worker modules) trip rules
# that are otherwise useful elsewhere. Scope locally to this one file.
lint.per-file-ignores."imread_benchmark/cli.py" = [
"B008", # typer.Option(...) in defaults is the documented pattern
"FBT001", # --skip-setup is a typer flag, must be a bool param
"PLR0913", # `run` collects every CLI flag; splitting hurts UX, not complexity
"S603", # subprocess into our own worker scripts with controlled argv
"S607", # we require `uv` on PATH; absolute path would defeat the install docs
]
lint.per-file-ignores."tests/**" = [ "ARG", "NPY002", "S101" ]
lint.fixable = [ "ALL" ]
lint.unfixable = []
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.mypy]
python_version = "3.11"
ignore_missing_imports = true
follow_imports = "silent"
warn_redundant_casts = true
warn_unused_ignores = true
disallow_any_generics = true
check_untyped_defs = true
no_implicit_reexport = true
disallow_untyped_defs = true
[tool.pytest]
ini_options.testpaths = [ "tests" ]