-
-
Notifications
You must be signed in to change notification settings - Fork 827
Expand file tree
/
Copy pathpyproject.toml
More file actions
213 lines (189 loc) · 7.05 KB
/
Copy pathpyproject.toml
File metadata and controls
213 lines (189 loc) · 7.05 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
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
[tool.codespell]
skip = ".git,*.pdf,*.svg"
# the way to make case sensitive skips of words etc
ignore-regex = "\bNd\b"
ignore-words-list = "MapPin"
# The coverage settings in this file only control `coverage report`. `coverage run` and
# `coverage combine` are controlled by the pyproject.toml files in each package's
# subdirectory.
#
# In each subdirectory's pyproject.toml, we use both of the following settings:
# * `source_pkgs`: detects the given packages no matter where they're imported from.
# * `source`: detects all files in the given directory, including files that are
# never imported by the tests.
#
# When running through `tox`, this will produce duplicate entries which must be merged
# with `coverage combine`.
[tool.coverage.run]
plugins = ["coverage_conditional_plugin"]
relative_files = true
[tool.coverage.report]
show_missing = true
skip_covered = true
skip_empty = true
precision = 1
exclude_lines = [
"pragma: no cover",
"@(abc\\.)?abstractmethod",
"if TYPE_CHECKING:",
"class .+?\\(Protocol.*\\):",
"@overload",
]
[tool.coverage.coverage_conditional_plugin.rules]
# Additional testbed rules are configured in the testbed module
no-cover-if-missing-setuptools_scm = "not is_installed('setuptools_scm')"
no-cover-if-missing-PIL = "not is_installed('PIL')"
no-cover-if-PIL-installed = "is_installed('PIL')"
no-cover-if-lt-py312 = "sys_version_info < (3, 12) and os_environ.get('COVERAGE_EXCLUDE_PYTHON_VERSION') != 'disable'"
no-cover-if-gte-py312 = "sys_version_info > (3, 12) and os_environ.get('COVERAGE_EXCLUDE_PYTHON_VERSION') != 'disable'"
no-cover-if-lt-py311 = "sys_version_info < (3, 11) and os_environ.get('COVERAGE_EXCLUDE_PYTHON_VERSION') != 'disable'"
no-cover-if-gte-py311 = "sys_version_info > (3, 11) and os_environ.get('COVERAGE_EXCLUDE_PYTHON_VERSION') != 'disable'"
[tool.ruff]
exclude = [
".template", # Ruff fails to run at all if allowed to lint the cookiecutter syntax
"core/src/toga/__init__.pyi"
]
[tool.ruff.lint]
# In addition to the default rules, these additional rules will be used:
extend-select = [
"E", # pycodestyle
"W", # pycodestyle
"F", # pyflakes
"UP", # pyupgrade
"B", # flake8-bugbear
"ASYNC", # flake8-async
"C4", # flake8-comprehensions
"I", # isort
# The SIM rules are *very* opinionated, and don't necessarily make for better code.
# They may be worth occasionally turning on just to see if something could actually
# use improvement.
# "SIM", # flake8-simplify
]
# Ignores needed to pass the Ruff 0.16 update.
ignore = [
"BLE001",
"DTZ001",
"DTZ005",
"DTZ006",
"DTZ011",
"DTZ012",
"RUF009",
# The SIM rules are *very* opinionated, and don't necessarily make for better code.
"SIM102", # collapsible-if makes code (and testing paths) harder to verify.
]
[tool.ruff.lint.per-file-ignores]
# PEP8 module naming conventions aren't appropriate
"examples/customwidget/helloworld/src/hello_world_widget/iOS_hello_world.py" = ["N999"]
"iOS/src/toga_iOS/__init__.py" = ["N999"]
"iOS/src/toga_iOS/hardware/__init__.py" = ["N999"]
"iOS/src/toga_iOS/resources/__init__.py" = ["N999"]
"iOS/src/toga_iOS/widgets/__init__.py" = ["N999"]
# Ignores needed to pass the Ruff 0.16 update.
"core/src/toga/sources/base.py" = ["PLC0105"]
"core/src/toga/window.py" = ["PLC0105"]
"core/tests/command/test_command.py" = ["PLR0124"]
"core/tests/command/test_group.py" = ["PLR0124"]
"core/tests/style/pack/test_aliases.py" = ["PT010"]
"core/tests/style/pack/test_deprecated_properties.py" = ["PT031"]
"core/src/toga/widgets/dateinput.py" = ["PLR1730"]
"core/src/toga/widgets/timeinput.py" = ["PLR1730"]
"core/tests/test_platform.py" = ["PT031"]
"cocoa/src/toga_cocoa/widgets/internal/refresh.py" = ["PLW0642"]
"examples/*" = ["RUF012"]
"iOS/tests_backend/widgets/scrollcontainer.py" = ["RUF018"]
"testbed/tests/widgets/test_optioncontainer.py" = ["PT031"]
"winforms/src/toga_winforms/libs/win32structures.py" = ["RUF012"]
[tool.ruff.lint.isort]
combine-as-imports = true
known-third-party = [
"android", # isort defaults to making this first-party because it can't be imported.
"textual", # We don't ever import textual, so Ruff doesn't know about it.
"travertino", # In this repo, but still a separate package
]
known-first-party = [
"testbed",
"toga",
"toga_android",
"toga_cocoa",
"toga_dummy",
"toga_gtk",
"toga_iOS",
"toga_textual",
"toga_web",
"toga_winforms",
]
[tool.rumdl]
flavor = "mkdocs"
include = ["**/*.md"]
exclude = ["changes/template.md", "comment.md", "CODE_OF_CONDUCT.md", "docs/en/SUMMARY.md"]
respect-gitignore = true
force-exclude = true
# Disable rules:
# MD014: Forces commands in codeblocks to show output
# MD042: Empty link - buggy, still flagging on valid MkDocs formatting
# MD052: Reference link not found - buggy, flagging on valis MkDocs links
disable = ["MD014", "MD042", "MD052"]
[tool.rumdl.per-file-ignores]
"changes/**/*.md" = ["MD041"]
"docs/en/reference/api/**/*.md" = ["MD041"]
"docs/en/snippets/**/*.md" = ["MD041"]
[tool.rumdl.MD007]
indent = 4
[tool.rumdl.MD013] # Line length
line_length = 999999 # Force reflow to paragraph content to remove linebreaks
reflow = true
reflow_mode = "normalize"
[tool.rumdl.MD026] # Remove punctuation at the end of headings
punctuation = ",;:"
[tool.rumdl.MD033] # No inline HTML
allowed_elements = ["nospell",] # pyspelling inline disable tag
[tool.rumdl.MD046]
style = "fenced"
[tool.towncrier]
directory = "changes"
package = "toga"
package_dir = "core/src"
filename = "docs/en/about/releases.md"
title_format = "## {version} ({project_date})"
issue_format = "[#{issue}](https://github.com/beeware/toga/issues/{issue})"
template = "changes/template.md"
type = [
{ directory = "feature", name = "Features", showcontent = true },
{ directory = "bugfix", name = "Bugfixes", showcontent = true },
{ directory = "removal", name = "Backward Incompatible Changes", showcontent = true },
{ directory = "doc", name = "Documentation", showcontent = true },
{ directory = "misc", name = "Misc", showcontent = false },
]
[tool.setuptools_scm]
# We're not doing anything Python-related at the root level of the repo, but if this
# declaration isn't here, tox commands run from the root directory raise a warning that
# pyproject.toml doesn't contain a setuptools_scm section.
[dependency-groups]
# Extras used by developers *of* Toga are pinned to specific versions to
# ensure environment consistency.
pre-commit = [
"pre-commit == 4.6.1",
]
setuptools-scm = [
"setuptools_scm == 10.2.1",
]
towncrier = [
"towncrier==25.8.0",
]
tox-uv = [
"tox-uv == 1.36.0",
]
dev = [
{include-group = "pre-commit"},
{include-group = "tox-uv"},
{include-group = "setuptools-scm"}
]
# Docs are always built on a specific Python version; see RTD and tox config files,
# and the docs contribution guide.
docs = [
"beeware-docs-tools @ git+https://github.com/beeware/beeware-docs-tools",
# "beeware-docs-tools @ file://../beeware-docs-tools",
"tabulate==0.10.0",
"mkdocs-redirects==1.2.3",
"mkdocs-exclude==1.0.2",
]