forked from canonical/operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
275 lines (247 loc) · 6.83 KB
/
pyproject.toml
File metadata and controls
275 lines (247 loc) · 6.83 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
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
[project]
name = "ops"
description = "The Python library behind great charms"
readme = "README.md"
requires-python = ">=3.10"
authors = [
{name="The Charm Tech team at Canonical Ltd."},
]
license = "Apache-2.0"
license-files = ["LICENSE.txt"]
classifiers = [
"Programming Language :: Python :: 3",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
]
dependencies = [
"PyYAML==6.*",
"websocket-client==1.*",
# Wide version range to preempt conflicts when charms pin a version.
"opentelemetry-api~=1.0",
]
dynamic = ["version"]
[project.optional-dependencies]
testing = [
"ops-scenario==8.5.0.dev0",
]
tracing = [
"ops-tracing==3.5.0.dev0",
]
# Empty for now, because Harness is bundled with the base install, but allow
# specifying the extra to ease transition later.
harness = []
[dependency-groups]
lint = [
"ruff==0.11.2",
"codespell==2.4.1",
"ops[testing,tracing]",
"pyright~=1.1",
"typing_extensions~=4.2",
]
unit = [
"ops[testing,tracing]",
"pytest~=8.4",
"jsonpatch~=1.33",
"pydantic~=2.10",
]
xdist = [
"pytest-xdist~=3.6",
]
coverage = [
"coverage[toml]~=7.0",
]
benchmark = [
"pytest-benchmark~=5.0",
]
integration = [
"ops[testing,tracing]",
"pytest~=8.4",
"jubilant~=1.5",
"jubilant-backports",
"minio~=7.2",
"httpx~=0.28",
]
release = [
"packaging~=24.0",
"pygithub~=2.6",
"rich~=14.1",
]
[project.urls]
"Homepage" = "https://documentation.ubuntu.com/ops/latest/"
"Repository" = "https://github.com/canonical/operator"
"Issues" = "https://github.com/canonical/operator/issues"
"Documentation" = "https://documentation.ubuntu.com/ops/latest/"
"Changelog" = "https://github.com/canonical/operator/blob/main/CHANGES.md"
[build-system]
requires = [
"setuptools>=60",
]
build-backend = "setuptools.build_meta"
[tool.uv.workspace]
members = ["tracing", "testing"]
[tool.uv.sources]
ops = { workspace = true }
ops-scenario = { workspace = true }
ops-tracing = { workspace = true }
[tool.setuptools.packages.find]
include = ["ops", "ops._private", "ops.lib"]
[tool.setuptools.dynamic]
version = {attr = "ops.version.version"}
# Testing tools configuration
[tool.coverage.run]
branch = true
[tool.coverage.report]
show_missing = true
# Formatting tools configuration
[tool.autopep8]
max-line-length = 99
ignore = ["W503"]
recursive = true
jobs = -1
aggressive = 3
# Linting tools configuration
[tool.ruff]
line-length = 99
exclude = ["examples"]
target-version = "py310"
extend-exclude = ["docs/conf.py", "docs/.sphinx/"]
# Ruff formatter configuration
[tool.ruff.format]
quote-style = "single"
[tool.ruff.lint]
select = [
# Pyflakes
"F",
# Pycodestyle
"E",
"W",
# isort
"I001",
# pep8-naming
"N",
# flake8-builtins
"A",
# flake8-copyright
"CPY",
# pyupgrade
"UP",
# flake8-2020
"YTT",
# flake8-bandit
"S",
# flake8-bugbear
"B",
# flake8-simplify
"SIM",
# Ruff specific
"RUF",
# Perflint
"PERF",
# pyflakes-docstrings
"D",
# flake8-future-annotations
"FA",
# flake8-type-checking
"TC",
]
ignore = [
# Move application import into a type-checking block
"TC001",
# Move third-party import into a type-checking block
"TC002",
# Move standard library import into a type-checking block
"TC003",
# Use of `assert` detected
"S101",
# Do not `assert False`
"B011",
# `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure
"S403",
# `subprocess` module is possibly insecure
"S404",
# No explicit `stacklevel` keyword argument found
"B028",
# Return condition directly, prefer readability.
"SIM103",
# Use contextlib.suppress() instead of try/except: pass
"SIM105",
# Use a single `with` statement with multiple contexts instead of nested `with` statements
"SIM117",
# Missing docstring in magic method
"D105",
# Missing docstring in `__init__`
"D107",
# Manual list comprehension.
"PERF401",
# Manual dict comprehension.
"PERF403",
# Convert {} from `TypedDict` functional to class syntax
# Note that since we have some `TypedDict`s that cannot use the class
# syntax, we're currently choosing to be consistent in syntax even though
# some can be moved to the class syntax.
"UP013",
## Likely worth doing, but later.
# `subprocess` call: check for execution of untrusted input
"S603",
]
exclude = ["tracing/ops_tracing/vendor/*"]
[tool.ruff.lint.per-file-ignores]
"test/*" = [
# All documentation linting.
"D",
# Hard-coded password string.
"S105",
# Hard-coded password function argument.
"S106",
# "Useless" expression.
"B018"
]
"testing/tests/*" = [
# All documentation linting.
"D",
]
"ops/_private/timeconv.py" = [
"RUF001", # String contains ambiguous `µ` (MICRO SIGN). Did you mean `μ` (GREEK SMALL LETTER MU)?
"RUF002", # Docstring contains ambiguous `µ` (MICRO SIGN). Did you mean `μ` (GREEK SMALL LETTER MU)?
]
"test/test_helpers.py" = [
"S605", # Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
"S607", # Starting a process with a partial executable path
]
"docs/custom_conf.py" = [
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"E266", # Too many leading `#` before block comment
"I001", # Import block is un-sorted or un-formatted
"RUF003", # Comment contains ambiguous unicode characters (EN DASH, RIGHT SINGLE QUOTATION MARK)
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"UP031", # Use format specifiers instead of percent format
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.flake8-builtins]
builtins-ignorelist = ["id", "min", "map", "range", "type", "TimeoutError", "ConnectionError", "Warning", "input", "format"]
[tool.pyright]
include = ["ops/*.py", "ops/_private/*.py", "test/*.py", "test/charms/*/src/*.py", "testing/src/*.py"]
exclude = ["tracing/*"]
extraPaths = ["testing", "tracing"]
pythonVersion = "3.10" # check no python > 3.10 features are used
pythonPlatform = "All"
typeCheckingMode = "strict"
reportIncompatibleMethodOverride = false
reportImportCycles = false
reportMissingModuleSource = false
reportPrivateUsage = false
reportUnnecessaryIsInstance = false
reportUnnecessaryComparison = false
reportUnnecessaryTypeIgnoreComment = "error"
disableBytesTypePromotions = true
stubPath = ""
[tool.codespell]
skip = './docs/_build,.venv,venv,build,examples'
quiet-level = 3