-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathpyproject.toml
More file actions
194 lines (178 loc) · 4.33 KB
/
pyproject.toml
File metadata and controls
194 lines (178 loc) · 4.33 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
[project]
name = "charmtech-charmlibs-monorepo"
requires-python = '>=3.10'
version = "0.0.0-dev0"
[dependency-groups]
fast-lint = [
"codespell==2.3.0",
"ruff==0.11.0",
]
[tool.uv]
package=false
[tool.coverage.run]
dynamic_context = "test_function"
branch = true
[tool.coverage.report]
show_missing = true
exclude_also = [
"if typing.TYPE_CHECKING:",
"@typing.overload",
"class .*\\(typing.Protocol\\):",
"\"\"\"",
]
# Linting tools configuration
[tool.ruff]
line-length = 99
target-version = "py310"
exclude = [
# These are the default values of ruff's exclude
# they're duplicated here instead of using extend-exclude
# so that libraries can use extend-exclude.
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"dist",
"node_modules",
"venv",
# These are the custom excludes specified by this repo.
"__pycache__",
"*.egg_info",
"htmlcov",
".docs/.sphinx",
".docs/conf.py",
".template/\\{\\{ cookiecutter.project_slug \\}\\}",
]
# Ruff formatter configuration
[tool.ruff.format]
preview = true
quote-style = "single"
[tool.ruff.lint]
preview = true
select = [
# flake8-builtins
"A",
# flake8-bugbear
"B",
# pyflakes-docstrings
"D",
# conventional names
"C",
# flake8-copyright
"CPY",
# Pycodestyle (error)
"E",
# Pyflakes
"F",
# flake8-logging-format
"G",
# isort
"I001",
# pep8-naming
"N",
# Perflint
"PERF",
# Ruff specific
"RUF",
# flake8-bandit
"S",
# flake8-simplify
"SIM",
# flake8-type-checking
"TC",
# pyupgrade
"UP",
# Pycodestyle (warning)
"W",
# flake8-2020
"YTT",
]
ignore = [
# mccabe
"C90",
# Missing docstring in magic method
"D105",
# Missing docstring in `__init__`
"D107",
# Use of `assert` detected
"S101",
# `subprocess` module is possibly insecure
"S404",
# subprocess-without-shell-equals-true
# S602 complains if shell is True, which is considered worse due to potential shell exploits
# difficult to avoid without noqa, which then becomes meaningless boilerplate every time
"S603",
# start-process-with-partial-path
# wants an absolute path to the executable as the first argument
# seems impractical, so also results in noqa boilerplate
"S607",
# 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",
]
[tool.ruff.lint.per-file-ignores]
"./**/tests/*" = [
# All documentation linting.
"D",
# Hard-coded password string.
"S105",
# Hard-coded password function argument.
"S106",
# "Useless" expression.
"B018",
# Redefinition of unused (we import fixtures)
"F811",
# Setting a permissive mask on a file or directory
"S103",
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.codespell]
check-hidden = true
quiet-level = 3 # disable warnings about (1) wrong encoding + (2) binary files
ignore-regex = "(?:[A-Za-z0-9+/]|\\\\n){100,}" # ignore long base64 strings (including Python \n)
ignore-words-list = [ # temporary until we add a per-library solution
"aNULL"
]
skip = [
".docs",
".git",
".mypy_cache",
".pytest_cache",
".report",
".ruff_cache",
".tox",
".venv*",
".vscode",
"build",
]
[tool.pyright]
pythonPlatform = "All"
typeCheckingMode = "strict"
reportPrivateUsage = false # things that are effectively public still need to be private to users
reportUnnecessaryTypeIgnoreComment = "error" # unnecessary ignores should be removed
stubPath = "" # silence warning: https://github.com/microsoft/pyright/issues/777
[tool.pytest.ini_options]
addopts = ["--strict-markers"]
markers = [
"pebble: functional tests that require a running Pebble to interact with",
"sudo: functional tests that require superuser privileges",
"k8s_only: integration tests that should only run with a K8s Juju cloud",
"machine_only: integration tests that should only run with a machine Juju cloud",
]