Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
179 lines (156 loc) · 6.48 KB
/
Copy pathpyproject.toml
File metadata and controls
179 lines (156 loc) · 6.48 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
[build-system]
build-backend = "scikit_build_core.build"
requires = ["scikit-build-core>=0.11.2", "setuptools-scm>=8"]
[project]
name = "PyPatchMatch"
description = "This library implements the PatchMatch based inpainting algorithm."
license = "MIT"
license-files = ["LICENSE"]
authors = [
{ name = "The InvokeAI Project", email = "lincoln.stein@gmail.com" },
{ name = "Jiayuan Mao", email = "maojiayuan@gmail.com" },
{ name = "Kyle Schouviller", email = "kyle0654@hotmail.com" },
{ name = "Matthias Wild", email = "mauwii@outlook.de" },
{ name = "Younesse ANDAM", email = "younesse.andam@gmail.com" },
]
requires-python = ">=3.11"
keywords = ["inpainting", "patchmatch", "image-processing", "opencv"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: C++",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
"Topic :: Multimedia :: Graphics",
"Topic :: Scientific/Engineering :: Image Processing",
"Typing :: Typed",
]
dependencies = ["numpy>=1.23.2", "pillow>=9.2.0"]
dynamic = ["version", "readme"]
[project.urls]
"Source Code" = "https://github.com/mauwii/PyPatchMatch"
Issues = "https://github.com/mauwii/PyPatchMatch/issues"
"Release Notes" = "https://github.com/mauwii/PyPatchMatch/releases"
[dependency-groups]
coverage = ["gcovr"]
# numpy and pillow for mypy, which runs without the project (--only-group dev)
dev = [{ include-group = "test" }, "mypy", "numpy", "pillow", "pre-commit", "ruff"]
test = ["hypothesis", "pytest", "pytest-cov"]
[tool.scikit-build]
minimum-version = "build-system.requires"
build-dir = "build/{wheel_tag}"
# The library is loaded via ctypes and does not use the CPython ABI,
# so one wheel per platform serves every Python version.
wheel.py-api = "py3"
wheel.packages = ["patchmatch"]
wheel.exclude = ["patchmatch/csrc/**"]
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
metadata.readme.provider = "scikit_build_core.metadata.fancy_pypi_readme"
# The release wheels are built from the sdist, so it has to contain the tests
# and their input images; _version.py is generated and therefore git-ignored.
sdist.include = [
"examples/images/camera_aged.png",
"examples/images/camera_damaged.png",
"examples/images/camera_damaged_mask.png",
"examples/images/chelsea.png",
"examples/images/forest.bmp",
"examples/images/forest_pruned.bmp",
"patchmatch/_version.py",
]
sdist.exclude = [".*", "examples", "gui", "sonar-project.properties", "uv.lock"]
# Without a matching wheel, pip builds the sdist, which needs a C++ compiler, CMake and
# OpenCV. If that fails, build a wheel without the native library instead of failing
# the installation; patchmatch_available is then False, as with 1.x. Builds from the
# source tree still fail, and cibuildwheel rejects the pure wheel of a failed build.
[[tool.scikit-build.overrides]]
if.from-sdist = true
if.failed = true
wheel.cmake = false
[tool.hatch.metadata.hooks.fancy-pypi-readme]
content-type = "text/markdown"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
path = "README.md"
# PyPI does not resolve relative image paths
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
pattern = '!\[([^\]]*)\]\((?!https?:)([^)]+)\)'
replacement = ''
[tool.setuptools_scm]
version_file = "patchmatch/_version.py"
# used when building without git metadata, e.g. from a GitHub source archive
fallback_version = "0.0.0"
[tool.cibuildwheel]
# The wheels are Python-version independent (py3-none-<platform>), so each platform
# is built and tested once; the CI workflow covers the newest Python version.
build = "cp311-*"
skip = "*-musllinux_*"
# OpenCV is built once per job in before-all, only for the runner's native arch
archs = ["native"]
# uv installs the build and test environments, so that UV_EXCLUDE_NEWER of wheels.yml
# applies to them
build-frontend = "build[uv]"
test-groups = ["test"]
test-command = "pytest {project}/tests --no-cov"
before-all = "python {project}/scripts/build_opencv.py"
environment = { OpenCV_ROOT = "/tmp/opencv" }
[tool.cibuildwheel.linux]
before-all = "/opt/python/cp312-cp312/bin/python {project}/scripts/build_opencv.py"
environment-pass = ["UV_EXCLUDE_NEWER"]
# The hardening of distribution compilers, which the gcc-toolset of manylinux lacks;
# before-all builds OpenCV with it too.
[tool.cibuildwheel.linux.environment]
OpenCV_ROOT = "/tmp/opencv"
CXXFLAGS = "-fstack-protector-strong -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3"
LDFLAGS = "-Wl,-z,relro,-z,now"
[tool.cibuildwheel.macos]
environment = { OpenCV_ROOT = "/tmp/opencv", MACOSX_DEPLOYMENT_TARGET = "11.0" }
[tool.cibuildwheel.windows]
environment = { OpenCV_ROOT = "C:/opencv" }
[tool.uv]
# the cooldown of dependabot.yml for uv lock --upgrade
exclude-newer = "7 days"
# Rebuild the package whenever the native sources or the git version change.
cache-keys = [
{ file = "CMakeLists.txt" },
{ file = "patchmatch/csrc/*" },
{ file = "pyproject.toml" },
{ git = { commit = true, tags = true } },
]
[tool.ruff]
extend-exclude = ["patchmatch/csrc"]
line-length = 88
[tool.ruff.lint]
select = ["B", "C4", "E", "F", "I", "RUF", "SIM", "UP", "W"]
ignore = ["E501"] # line length is enforced by ruff-format
[tool.coverage.run]
patch = ["subprocess"]
[tool.coverage.report]
fail_under = 95
[tool.mypy]
files = ["examples", "patchmatch", "scripts", "tests"]
strict = true
[[tool.mypy.overrides]]
# generated at build time, missing in a fresh checkout
module = ["patchmatch._version"]
ignore_missing_imports = true
[[tool.mypy.overrides]]
# the tests check the typed API; their own helpers need no annotations
module = ["test_e2e", "test_patch_match", "test_properties"]
disallow_untyped_calls = false
disallow_untyped_defs = false
warn_return_any = false
[tool.pytest.ini_options]
addopts = ["--cov-branch", "--cov-report=term:skip-covered", "--cov=patchmatch"]
# shows which test hangs before the job timeout kills the run
faulthandler_timeout = 300
filterwarnings = ["error"]
markers = ["e2e: end-to-end tests of the user workflows (deselect with -m 'not e2e')"]
minversion = "9.0"
python_files = ["test_*.py"]
strict = true
testpaths = ["tests"]