-
-
Notifications
You must be signed in to change notification settings - Fork 182
/
pyproject.toml
258 lines (232 loc) · 6.74 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
# SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
[build-system]
requires = ["setuptools >= 61", "wheel >= 0.37", "pybind11 >= 2.10.1"]
build-backend = "setuptools.build_meta"
[project]
name = "pikepdf"
version = "8.13.0"
description = "Read and write PDFs with Python, powered by qpdf"
readme = "README.md"
requires-python = ">=3.8"
keywords = ["PDF"]
authors = [{ name = "James R. Barlow", email = "james@purplerock.ca" }]
license = { text = "MPL-2.0" }
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
"Programming Language :: C++",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Multimedia :: Graphics",
"Topic :: Software Development :: Libraries",
]
dependencies = [
"Pillow>=10.0.1",
"Deprecated",
"lxml>=4.8; python_version >= '3.10'",
"lxml>=4.8,<5; python_version < '3.10'", # lxml doesn't make 5.0 wheels for python < 3.10
"packaging",
]
[project.urls]
documentation = "https://pikepdf.readthedocs.io/"
repository = "https://github.com/pikepdf/pikepdf"
changelog = "https://pikepdf.readthedocs.io/en/latest/releasenotes/index.html"
[project.optional-dependencies]
dev = ["pre-commit", "typer[all]"]
docs = [
"Sphinx>=3",
"sphinx-autoapi",
"sphinx-design",
"sphinx-issues",
"sphinx-rtd-theme",
"tomli; python_version < '3.11'",
]
mypy = ["lxml-stubs", "types-Pillow", "types-requests", "types-setuptools"]
test = [
"attrs>=20.2.0",
"coverage[toml]",
"hypothesis>=6.36",
"numpy>=1.21.0; platform_machine == 'x86_64' and platform_python_implementation == 'CPython'",
"psutil>=5.9; os_name != 'nt'",
"pybind11",
"pytest>=6.2.5",
"pytest-cov>=3.0.0",
"pytest-timeout>=2.1.0",
"pytest-xdist>=2.5.0",
"python-dateutil>=2.8.1",
"python-xmp-toolkit>=2.0.1; os_name != 'nt' and platform_machine == 'x86_64'",
"tomli; python_version < '3.11'",
]
[tool.setuptools.packages.find]
where = ["src"]
include = ["pikepdf", "pikepdf.*"]
namespaces = false
[tool.setuptools.package-data]
pikepdf = ["*.dll", "py.typed", "*.pyi", "**/*.pyi"]
[tool.black]
line-length = 88
target-version = ["py38", "py39", "py310", "py311"]
skip-string-normalization = true
include = '\.pyi?$'
exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
| docs
| misc
| \.egg-info
)/
'''
[tool.cibuildwheel]
test-command = "pytest -nauto {project}/tests"
test-extras = "test"
# Reminder:
# build.yml sets CIBW_BUILD to select what can be built
# this file sets skip to deselect what cannot be built
skip = [
"cp36-*", # too old
"cp37-*", # too old
"pp37-*", # too old
"pp38-*", # too old (no Pillow support)
"*-win32", # no 32-bit builds/not supported by Pillow anymore
"*musllinux*_aarch64", # haven't tried yet/needs Cirrus tweaks
"cp38-musllinux*", # too old - some dependendies don't have wheels
"pp*-manylinux*_aarch64", # not supported by Pillow yet
]
test-skip = "*_universal2:arm64"
build-frontend = "build"
[tool.cibuildwheel.environment]
QPDF_MIN_VERSION = "11.5.0"
QPDF_VERSION = "11.8.0"
QPDF_PATTERN = "https://github.com/qpdf/qpdf/releases/download/vVERSION/qpdf-VERSION.tar.gz"
[tool.cibuildwheel.linux]
before-all = [
"""yum install -y \
libjpeg-turbo-devel \
libxml2-devel \
libxslt-devel \
wget \
zlib-devel \
""",
"sh -c 'yum install -y libxmp || true'",
"bash build-scripts/posix-download-qpdf.bash $QPDF_VERSION",
"bash build-scripts/posix-build-wheel-deps.bash",
]
environment-pass = ["CI"]
manylinux-x86_64-image = "manylinux2014"
manylinux-pypy_x86_64-image = "manylinux2014"
musllinux-x86_64-image = "musllinux_1_2"
musllinux-aarch64-image = "musllinux_1_2"
[[tool.cibuildwheel.overrides]]
select = "*-musllinux*"
before-all = [
"""apk add \
cmake \
exempi-dev \
jpeg-dev \
make \
mupdf-tools \
py3-lxml \
py3-pillow \
py3-pybind11-dev \
py3-setuptools \
py3-wheel \
python3 \
python3-dev \
wget \
zlib-dev \
""",
"bash build-scripts/posix-download-qpdf.bash $QPDF_VERSION",
"bash build-scripts/posix-build-wheel-deps.bash",
]
[tool.cibuildwheel.macos]
before-all = [
"sh -c 'brew update || true'",
"sh -c 'brew install gnutls little-cms2 mupdf wget || true'",
"bash build-scripts/posix-download-qpdf.bash $QPDF_VERSION",
"bash build-scripts/posix-build-wheel-deps.bash",
] # Use 'brew whatever || true' workaround until https://github.com/actions/setup-python/issues/577 is fixed
before-build = [
'if [ "$(uname -m)" == "arm64" ]; then export MACOSX_DEPLOYMENT_TARGET="11.0"; fi',
] # Ensure each build is targeting 11.0 when we are on arm64. See docs/references/build.rst
[tool.cibuildwheel.windows]
[tool.mypy]
exclude = ["^_qpdf\\.py$"]
[[tool.mypy.overrides]]
module = ["deprecation"]
ignore_missing_imports = true
[tool.pytest.ini_options]
minversion = "6.0"
norecursedirs = ["lib", ".pc", ".git", "venv"]
testpaths = ["tests"]
addopts = "-n auto"
[tool.coverage.run]
concurrency = ["multiprocessing"]
omit = ["src/pikepdf/_qpdf.py"] # Remove in pikepdf 9
[tool.coverage.report]
# Regexes for lines to exclude from consideration
exclude_lines = [
# Have to re-enable the standard pragma
"pragma: no cover",
# Don't complain if tests don't hit defensive assertion code:
"raise AssertionError",
"raise NotImplementedError",
# Don't complain if non-runnable code isn't run:
"if 0:",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"if typing.TYPE_CHECKING:",
]
[tool.coverage.html]
directory = "coverage/pycov"
[tool.ruff]
src = ["src/pikepdf"]
target-version = "py38"
[tool.ruff.lint]
select = [
"D", # pydocstyle
"E", # pycodestyle
"W", # pycodestyle
"F", # pyflakes
"I001", # isort
"TID", # flake8-tidy-imports
"UP", # pyupgrade
"YTT", # flake8-2020
]
ignore = ["D105", "B028"]
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"
banned-module-level-imports = ["numpy"]
[tool.ruff.lint.isort]
known-first-party = ["pikepdf", "pikepdf._core"]
known-third-party = [
"PIL",
"conftest",
"hypothesis",
"lxml",
"psutil",
"pytest",
"setuptools",
]
required-imports = ["from __future__ import annotations"]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.per-file-ignores]
"tests/*test*.py" = ["D", "E501"]
"docs/*.py" = ["D", "E501", "E402", "F401"]
"bin/bump_version.py" = ["E501"]
"examples/*.py" = ["D103"]
# [tool.ruff.format]
# quote-style = "preserve" # 2023-12-28 - ruff feature not ready yet