-
Notifications
You must be signed in to change notification settings - Fork 90
/
pyproject.toml
409 lines (364 loc) · 10 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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "normcap"
version = "0.5.9"
description = "OCR-powered screen-capture tool to capture information instead of images."
keywords = ["screenshot", "ocr", "capture", "clipboard"]
readme = "README.md"
requires-python = ">=3.9,<=3.12"
license = "GPL-3.0-or-later"
authors = [{ name = "dynobo", email = "[email protected]" }]
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Utilities",
"Topic :: Multimedia :: Graphics :: Capture :: Screen Capture",
"Intended Audience :: End Users/Desktop",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
]
dependencies = [
"shiboken6==6.7.1",
"PySide6-Essentials==6.7.1",
"jeepney==0.8.0",
]
[project.optional-dependencies]
build = ["babel", "toml"]
[project.urls]
Homepage = "https://dynobo.github.io/normcap/"
Issues = "https://github.com/dynobo/normcap/issues"
"Source Code" = "https://github.com/dynobo/normcap"
FAQs = "https://dynobo.github.io/normcap/#faqs"
Changelog = "https://github.com/dynobo/normcap/blob/main/CHANGELOG"
[project.scripts]
normcap = "normcap.app:run"
[tool.hatch.build]
exclude = ["assets", "*.po"]
artifacts = ["*.mo"]
[dependency-groups]
dev = [
"babel>=2.12.1",
"briefcase==0.3.16", # pinned because building relies on it!
"coverage[toml]>=6.5",
"coveralls>=3.3.1",
"mdformat-gfm>=0.3.6",
"mdformat-simple-breaks>=0.0.1",
"mdformat-mkdocs>=2.0.1",
"mdformat-frontmatter>=2.0.1",
"mkdocs-material==9.5.19", # pinned because docs rely on it!
"mkdocs-glightbox>=0.3.5",
"mypy>=1.3.0",
"pip-audit>=2.5.5",
"pre-commit>=3.0.2",
"pydeps>=1.11.0",
"pytest-cov>=4.0.0",
"pytest-instafail>=0.5.0",
"pytest-qt>=4.2.0",
"pytest-xvfb>=3.0.0",
"pytest>=7.2.1",
"retry2>=0.9.5",
"rope>=1.7.0",
"ruff>=0.0.239",
"tbump>=6.9.0",
"toml>=0.10.2",
"types-retry>=0.9.9.4",
"types-toml>=0.10.8.1",
"typing-extensions>=4.4.0",
"poethepoet>=0.29.0",
]
analysis = ["radon>=5.1.0", "viztracer>=0.15.3", "vulture>=2.4"]
[tool.poe.tasks]
locales-compile = "python bundle/l10n.py"
locales-update = "python bundle/l10n.py --update-all"
locales-create = "python bundle/l10n.py --create-new"
security = "pip-audit"
version = "tbump"
docs-serve = "mkdocs serve"
docs-build = "mkdocs build"
test = [
{ cmd = "pytest" },
{ cmd = "coverage lcov" },
]
quick-test = [
{ cmd = "pytest -m 'not gui'" },
{ cmd = "coverage lcov" },
]
check = [
{ cmd = "ruff check" },
{ cmd = "ruff format --check --diff" },
{ cmd = "mdformat --align-semantic-breaks-in-lists --end-of-line keep" },
{ cmd = "mypy" },
]
format = [
{ cmd = "ruff check --fix-only" },
{ cmd = "ruff format" },
{ ref = "locales-compile"},
{ cmd = "mdformat --align-semantic-breaks-in-lists --end-of-line keep" },
]
chart = [
{ cmd = "pydeps normcap --max-bacon=2 -o=pydeps.png -T=png" },
{ cmd = "pydeps normcap --max-bacon=1 -o=pydeps_internal.png -T=png" },
]
bundle = [
{ ref = "locales-compile" },
{ cmd = "python bundle/build.py" },
]
bundle-dev = [
{ ref = "locales-compile" },
{ cmd = "python bundle/build.py --dev" },
]
pre-commit = [
"format",
"check",
"quick-test",
"chart"
]
cicd-check = [
"format",
"check",
"security",
"test",
]
inspect-trace = "viztracer --open --log_gc --ignore_c_function -- normcap/app.py"
inspect-trace-view = "vizviewer {args:result.json}"
inspect-unused = "vulture {args:} normcap tests bundle"
inspect_metrics = [
{ cmd = "echo 'For metrics description see: https://radon.readthedocs.io/en/latest/intro.html'" },
{ cmd = "echo '------[ Cyclomatic Complexity ]-------'" },
{ cmd = "radon cc ." },
{ cmd = "echo '------[ Maintainability Index ]-------'" },
{ cmd = "radon mi ." },
]
[tool.ruff]
target-version = "py39"
line-length = 88
exclude = [".venv"]
[tool.ruff.lint]
select = [
"F", # Pyflakes
"E", # pycodestyle
"I", # Isort
"D", # pydocstyle
"W", # warning
"UP", # pyupgrad
"N", # pep8-naming
"C90", # mccabe
"TRY", # tryceratops (exception handling)
"ANN", # flake8-annotations
"S", # flake8-bandits
"C4", # flake8-comprehensions
"B", # flake8-bugbear
"A", # flake8-builtins
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"T20", # flake8-print
"PYI", # flake8-pyi
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RET", # flake8-return
"SIM", # flake8-simplify
"PTH", # flake8-use-pathlib
"G", # flake8-logging-format
"PL", # pylint
"RUF", # meta rules (unused noqa)
"PL", # meta rules (unused noqa)
"PERF", # perflint
]
ignore = [
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D107", # Missing docstring in __init__
"ANN101", # Missing type annotation for `self` in method
"TRY003", # Avoid specifying long messages outside the exception class
"ISC001", # Rule conflicts with ruff's formatter
]
[tool.ruff.lint.per-file-ignores]
"tests/**/*" = ["PLR2004", "PLR0913", "S101", "TID252", "ANN", "D"]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.isort]
known-first-party = ["normcap"]
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"
[tool.mypy]
files = ["normcap/**/*.py", "tests/**/*.py", "bundle/**/*.py"]
follow_imports = "skip"
ignore_missing_imports = true
[tool.pytest.ini_options]
testpaths = ["tests"]
qt_api = "pyside6"
xvfb_width = 1920
xvfb_height = 1080
addopts = [
"-vv",
"--durations=5",
"--showlocals",
"--instafail",
"--cov",
"--cov-report=xml",
"--cov-report=html",
]
markers = ["gui: tests which require a graphical interface to run"]
[tool.coverage.run]
source = ["normcap"]
branch = true
parallel = true
omit = []
[tool.mdformat]
wrap = 88
number = true
end_of_line = "keep"
[tool.pydeps]
no_show = true
cluster = true
max_cluster_size = 1
[tool.briefcase]
project_name = "NormCap"
bundle = "eu.dynobo"
version = "0.5.9"
url = "https://github.com/dynobo/normcap"
license = "GPLv3"
author = 'dynobo'
author_email = "[email protected]"
[tool.briefcase.app.normcap]
formal_name = "NormCap"
description = "OCR-powered screen-capture tool to capture information instead of images"
sources = ["normcap"]
icon = "bundle/imgs/normcap"
installer_icon = "bundle/imgs/normcap_install"
installer_background = "bundle/imgs/normcap_install_bg"
requires = ["PySide6-Essentials==6.7.1", "shiboken6==6.7.1", "jeepney==0.8.0"]
cleanup_paths = [
# Globs
"**/[pP]y[sS]ide6/*[qQ]t*[oO]pen[gG][lL]*",
"**/*.debug",
"**/*[lL]abs*",
"**/*[qQ]t[xX]ml*",
"**/*[qQ]t*[dD]esigner*",
"**/*[qQ]t*[hH]elp*",
"**/*[qQ]t*[pP]df*",
"**/*[qQ]t*[pP]rint[sS]upport*",
"**/*[qQ]t*[sS]ql*",
"**/*[qQ]t*[sS]tate[mM]achine*",
"**/*[qQ]t*[tT]est*",
"**/*[qQ]t*[lL]anguage[sS]erver*",
"**/*[qQ]t*[wW]eb[sS]ockets*",
"**/*[qQ]uick*",
"**/*[sS]cene*",
"**/*[uU]i[tT]ools*",
"**/*[vV]irtual[kK]eyboard*",
"**/*QtQml*",
"**/bin/pyside6-*",
"**/PySide6/[aA]ssistant*",
"**/PySide6/[dD]esigner*",
"**/PySide6/[lL]inguist*",
# Folders
"**/__pycache__",
"**/examples",
"**/libexec",
"**/plugins/designer",
"**/plugins/printsupport",
"**/plugins/qmltooling",
"**/plugins/sqldrivers",
"**/Qt/qml/QtQml",
"**/Qt/translations",
"**/tests",
"**/typesystems",
# Files
"**/PySide6/lrelease",
"**/PySide6/lupdate",
# Windows specific files
"**/NormCap.exe.metagen",
"**/NormCap.pdb",
]
[tool.briefcase.app.normcap.macOS]
requires = ["std-nslog==1.0.0"]
[tool.briefcase.app.normcap.linux.appimage]
template = "https://github.com/beeware/briefcase-linux-appimage-template"
template_branch = "v0.3.16"
manylinux = "manylinux_2_28"
manylinux_image_tag = "latest"
system_requires = [
"wget",
"tesseract",
# wl-clipboard deps
"wayland-devel",
"wayland-protocols-devel",
"meson",
# xcb-utils-cursor deps
"libxcb-devel",
"libxkbcommon-x11",
"epel-release", # for xcb-util-cursor
]
dockerfile_extra_content = """
USER root
RUN dnf config-manager --add-repo https://download.opensuse.org/repositories/home:Alexander_Pozdnyakov:tesseract5/CentOS_8/home:Alexander_Pozdnyakov:tesseract5.repo
RUN dnf config-manager --set-enabled home_Alexander_Pozdnyakov_tesseract5
RUN dnf upgrade -y
RUN wget "https://pkgs.dyn.su/el8/base/x86_64/raven-release.el8.noarch.rpm"
RUN rpm -ivh raven-release*.rpm
RUN dnf update -y
RUN dnf install -y \
qt6-qtwayland \
xclip \
xcb-util-cursor \
xcb-util-wm \
xcb-util-keysyms \
xsel
RUN git clone https://github.com/bugaevc/wl-clipboard.git
RUN cd wl-clipboard \
&& git checkout tags/v2.2.1 -b v2.2.1-branch \
&& meson setup build \
&& cd build \
&& ninja \
&& meson install
ENV LD_LIBRARY_PATH "$LD_LIBRARY_PATH:/app/NormCap.AppDir/usr/app_packages/shiboken6"
USER brutus
"""
[tool.briefcase.app.normcap.windows]
use_full_install_path = false
[tool.tbump.version]
current = "0.5.9"
regex = '''
(?P<major>\d+)
\.
(?P<minor>\d+)
\.
(?P<patch>\d+)
(\-
(?P<extra>.+)
)?
'''
[tool.tbump.git]
message_template = "build(release): bump to {new_version}"
tag_template = "v{new_version}"
[[tool.tbump.file]]
# Project version and Briefcase version
src = "pyproject.toml"
search = 'version = "{current_version}"'
[[tool.tbump.file]]
src = "normcap/__init__.py"
search = '__version__ = "{current_version}"'
[[tool.tbump.file]]
src = "docs/index.md"
[[tool.tbump.file]]
src = "README.md"
search = 'NormCap-{current_version}-'
[[tool.tbump.file]]
src = "README.md"
search = 'download/v{current_version}/'
[[tool.tbump.before_commit]]
name = "check changelog"
cmd = "grep -q {new_version} CHANGELOG"