-
Notifications
You must be signed in to change notification settings - Fork 119
/
pyproject.toml
225 lines (199 loc) · 5.9 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
[project]
name = "ops"
description = "The Python library behind great charms"
readme = "README.md"
requires-python = ">=3.8"
authors = [
{name="The Charm Tech team at Canonical Ltd.", email="[email protected]"},
]
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
"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.*",
]
dynamic = ["version"]
[project.optional-dependencies]
docs = [
"canonical-sphinx-extensions",
"furo",
"linkify-it-py",
"myst-parser",
"pyspelling",
"sphinx ~= 8.0.0",
"sphinx-autobuild",
"sphinx-copybutton",
"sphinx-design",
"sphinx-notfound-page",
"sphinx-tabs",
"sphinxcontrib-jquery",
"sphinxext-opengraph",
"ops-scenario>=7.0.5,<8",
]
testing = [
"ops-scenario>=7.0.5,<8",
]
# Empty for now, because Harness is bundled with the base install, but allow
# specifying the extra to ease transition later.
harness = []
[project.urls]
"Homepage" = "https://juju.is/docs/sdk"
"Repository" = "https://github.com/canonical/operator"
"Issues" = "https://github.com/canonical/operator/issues"
"Documentation" = "https://ops.readthedocs.io"
"Changelog" = "https://github.com/canonical/operator/blob/main/CHANGES.md"
[build-system]
requires = [
"setuptools>=60",
]
build-backend = "setuptools.build_meta"
[tool.setuptools.packages.find]
include = ["ops"]
[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
target-version = "py38"
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",
]
ignore = [
# 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 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",
]
[tool.ruff.lint.pyupgrade]
# Preserve types, even if a file imports `from __future__ import annotations`.
# Since we target py 3.8, we want to keep using List[str] and Optional[str]
keep-runtime-typing = true
[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"
]
"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"]
pythonVersion = "3.8" # check no python > 3.8 features are used
pythonPlatform = "All"
typeCheckingMode = "strict"
reportIncompatibleMethodOverride = false
reportImportCycles = false
reportMissingModuleSource = false
reportPrivateUsage = false
reportUnnecessaryIsInstance = false
reportUnnecessaryComparison = false
reportUnnecessaryTypeIgnoreComment = "error"
disableBytesTypePromotions = false
stubPath = ""
[tool.codespell]
skip = './docs/_build,.venv,venv,build'
quiet-level = 3