-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
pyproject.toml
322 lines (285 loc) · 7.8 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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
[build-system]
requires = [
"setuptools == 74.1.1",
"wheel == 0.44.0",
"cython == 3.0.11",
"delocate == 0.11.0 ; platform_system=='Windows'",
]
build-backend = "setuptools.build_meta"
[project]
name = "libzim"
version = "3.6.0"
requires-python = ">=3.9,<3.14"
description = "A python-facing API for creating and interacting with ZIM files"
authors = [
{name = "openZIM", email = "[email protected]"},
]
readme = "README.md"
license = {text = "GPL-3.0-or-later"}
classifiers = [
"Development Status :: 5 - Production/Stable",
"Topic :: Utilities",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: System :: Archiving",
"Topic :: System :: Archiving :: Compression",
"Topic :: System :: Archiving :: Mirroring",
"Topic :: System :: Archiving :: Backup",
"Intended Audience :: Developers",
"Programming Language :: Cython",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Typing :: Stubs Only",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Operating System :: MacOS",
"Operating System :: POSIX",
]
[project.urls]
Homepage = "https://github.com/openzim/python-libzim"
Donate = "https://www.kiwix.org/en/support-us/"
[project.optional-dependencies]
scripts = [
"invoke==2.2.0",
]
lint = [
"black==24.10.0",
"ruff==0.6.9",
"libzim",
"libzim[build]",
]
check = [
"pyright==1.1.384",
"libzim",
"libzim[build]",
"libzim[test]",
"types-setuptools",
]
test = [
"pytest==8.3.3",
"coverage==7.6.2",
# for cython coverage plugin
"libzim[build]",
]
build = [
"setuptools == 75.1.0",
"wheel == 0.44.0",
"cython == 3.0.11",
"delocate == 0.11.0 ; platform_system=='Windows'",
]
dev = [
"pre-commit==4.0.1",
"ipython==8.28.0",
"types-setuptools",
"libzim[scripts]",
"libzim[lint]",
"libzim[test]",
"libzim[check]",
"libzim[build]",
]
[tool.setuptools]
include-package-data = true
zip-safe = false
packages = [ "libzim" ]
[tool.setuptools.package-data]
libzim = [
"py.typed",
"*.pyi",
"libzim.9.dylib",
"libzim.so.9",
"zim-9.dll",
"icuuc74.dll",
"icutu74.dll",
"icuio74.dll",
"icuin74.dll",
"icudt74.dll",
]
[tool.cibuildwheel]
build = "*"
# disabling PyPy due to 2 failing tests
skip = "pp* *win32*"
test-requires = ["pytest"]
test-command = "py.test {project}/tests/"
manylinux-x86_64-image = "manylinux_2_28"
manylinux-aarch64-image = "manylinux_2_28"
manylinux-pypy_x86_64-image = "manylinux_2_28"
manylinux-pypy_aarch64-image = "manylinux_2_28"
[tool.cibuildwheel.windows]
before-build = "pip install setuptools cython delocate"
repair-wheel-command = "python.exe setup.py repair_win_wheel --destdir={dest_dir} --wheel={wheel}"
[tool.cibuildwheel.linux]
archs = ["x86_64", "aarch64"]
[tool.cibuildwheel.macos]
archs = ["x86_64", "arm64"]
# macOS arm64 is cross-compiled and can not be tested.
# cibuildwheel skips it already. *_arm64 this removes the warning
# skipping tests on cp <=3.9 as the wheels we produce are on unexpected combinations
# because those python versions were released before our building host version
# > requires changing wheel names
test-skip = "*_arm64 cp39*"
[tool.hatch.build]
exclude = [
"/.github",
]
[tool.hatch.build.targets.wheel]
packages = ["libzim"]
[tool.hatch.envs.default]
features = ["dev"]
[tool.hatch.envs.default.scripts]
download-libzim = "inv download-libzim"
build-ext = "inv build-ext"
clean = "inv clean"
[tool.hatch.envs.test]
features = ["scripts", "test"]
[tool.hatch.envs.test.env-vars]
PROFILE = "1"
[[tool.hatch.envs.test.matrix]]
python = ["3.9", "3.10", "3.11", "3.12", "3.13"]
[tool.hatch.envs.test.scripts]
run = "inv test --args '{args}'"
run-cov = "inv test-cov --args '{args}'"
report-cov = "inv report-cov"
coverage = "inv coverage --args '{args}'"
html = "inv coverage --html --args '{args}'"
[tool.hatch.envs.lint]
template = "lint"
skip-install = false
features = ["scripts", "lint"]
[tool.hatch.envs.lint.scripts]
black = "inv lint-black --args '{args}'"
ruff = "inv lint-ruff --args '{args}'"
all = "inv lintall --args '{args}'"
fix-black = "inv fix-black --args '{args}'"
fix-ruff = "inv fix-ruff --args '{args}'"
fixall = "inv fixall --args '{args}'"
[tool.hatch.envs.check]
features = ["scripts", "check"]
[tool.hatch.envs.check.scripts]
pyright = "inv check-pyright --args '{args}'"
all = "inv checkall --args '{args}'"
[tool.black]
line-length = 88
target-version = ['py312']
[tool.ruff]
target-version = "py312"
line-length = 88
src = ["src"]
[tool.ruff.lint]
select = [
"A", # flake8-builtins
# "ANN", # flake8-annotations
"ARG", # flake8-unused-arguments
# "ASYNC", # flake8-async
"B", # flake8-bugbear
# "BLE", # flake8-blind-except
"C4", # flake8-comprehensions
"C90", # mccabe
# "COM", # flake8-commas
# "D", # pydocstyle
# "DJ", # flake8-django
"DTZ", # flake8-datetimez
"E", # pycodestyle (default)
"EM", # flake8-errmsg
# "ERA", # eradicate
# "EXE", # flake8-executable
"F", # Pyflakes (default)
# "FA", # flake8-future-annotations
"FBT", # flake8-boolean-trap
# "FLY", # flynt
# "G", # flake8-logging-format
"I", # isort
"ICN", # flake8-import-conventions
# "INP", # flake8-no-pep420
# "INT", # flake8-gettext
"ISC", # flake8-implicit-str-concat
"N", # pep8-naming
# "NPY", # NumPy-specific rules
# "PD", # pandas-vet
# "PGH", # pygrep-hooks
# "PIE", # flake8-pie
# "PL", # Pylint
"PLC", # Pylint: Convention
"PLE", # Pylint: Error
"PLR", # Pylint: Refactor
"PLW", # Pylint: Warning
# "PT", # flake8-pytest-style
# "PTH", # flake8-use-pathlib
# "PYI", # flake8-pyi
"Q", # flake8-quotes
# "RET", # flake8-return
# "RSE", # flake8-raise
"RUF", # Ruff-specific rules
"S", # flake8-bandit
# "SIM", # flake8-simplify
# "SLF", # flake8-self
"T10", # flake8-debugger
"T20", # flake8-print
# "TCH", # flake8-type-checking
# "TD", # flake8-todos
"TID", # flake8-tidy-imports
# "TRY", # tryceratops
"UP", # pyupgrade
"W", # pycodestyle
"YTT", # flake8-2020
]
ignore = [
# Allow non-abstract empty methods in abstract base classes
"B027",
# Remove flake8-errmsg since we consider they bloat the code and provide limited value
"EM",
# Allow boolean positional values in function calls, like `dict.get(... True)`
"FBT003",
# Ignore checks for possible passwords
"S105", "S106", "S107",
# Ignore warnings on subprocess.run / popen
"S603",
# Ignore complexity
"C901", "PLR0911", "PLR0912", "PLR0913", "PLR0915",
]
unfixable = [
# Don't touch unused imports
"F401",
]
[tool.ruff.lint.isort]
known-first-party = ["libzim"]
[tool.ruff.lint.flake8-bugbear]
# add exceptions to B008 for fastapi.
extend-immutable-calls = ["fastapi.Depends", "fastapi.Query"]
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"
[tool.ruff.lint.per-file-ignores]
# Tests can use magic values, assertions, and relative imports, and print
"tests/**/*" = ["PLR2004", "S101", "TID252", "T201", "ARG001", "ARG002", "N803"]
"setup.py" = ["T201"]
"libzim/*.pyi" = ["FBT001"]
[tool.pytest.ini_options]
minversion = "7.3"
testpaths = ["tests"]
pythonpath = ["."]
[tool.coverage]
plugins = "Cython.Coverage"
[tool.coverage.paths]
libzim = ["libzim"]
tests = ["tests"]
[tool.coverage.run]
source_pkgs = ["libzim"]
branch = true
parallel = true
omit = [
"libzim/__about__.py",
]
[tool.coverage.report]
exclude_lines = [
"no cov",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
]
[tool.pyright]
include = ["libzim", "tests", "tasks.py"]
exclude = [".env/**", ".venv/**"]
pythonVersion = "3.13"
typeCheckingMode="basic"
disableBytesTypePromotions = true