Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
167 lines (151 loc) · 4.07 KB
/
Copy pathpyproject.toml
File metadata and controls
167 lines (151 loc) · 4.07 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
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.
[project]
name = "kratos-operator"
version = "0.0.0"
description = "Charmed Ory Kratos operator"
readme = "README.md"
license = {file = "LICENSE"}
requires-python = ">=3.10"
dependencies = [
"bcrypt==5.0.0",
"cosl==1.11.3",
"ops==3.10.0",
"dacite",
"Jinja2==3.1.6",
"jsonschema==4.26.0",
"lightkube==0.22.0",
"lightkube-models==1.37.0.8",
"pydantic[email]~=2.14.0",
"pyyaml==6.0.4",
"requests",
"yarl",
]
[dependency-groups]
fmt = [
"isort",
"ruff",
]
lint = [
"codespell",
"isort",
"ruff",
"tomli",
]
unit = [
"coverage[toml]",
"ops[testing]",
"pytest",
"pytest-mock",
]
integration = [
"jubilant",
"pytest",
"requests",
"tenacity",
]
dev = [
"pre-commit",
"mypy",
"types-PyYAML",
"types-requests",
{ include-group = "fmt" },
{ include-group = "lint" },
{ include-group = "unit" },
{ include-group = "integration" },
]
[tool.uv]
package = false
# Testing tools configuration
[tool.coverage.run]
branch = true
[tool.coverage.report]
show_missing = true
[tool.pytest.ini_options]
minversion = "6.0"
log_cli_level = "INFO"
pythonpath = ["src", "lib", "tests"]
filterwarnings = [
"error",
# The kratos_registration_webhook charm-lib tests still use Harness.
# Harness is deprecated in favour of Scenario; this is the intentional
# signal, ignored narrowly until those tests are migrated.
"ignore:Harness is deprecated:PendingDeprecationWarning",
# The vendored data_platform_libs lib (lib/charms/data_platform_libs/v0/
# data_interfaces.py, LIBPATCH 58) calls the deprecated ops
# JujuVersion.from_environ(); the fix belongs upstream in canonical/data-platform-libs.
"ignore:JujuVersion.from_environ:DeprecationWarning",
# Integration tests hit the deployed charm over HTTPS with self-signed certs and
# `verify=False`; urllib3 emits InsecureRequestWarning by design. Verifying the cert
# would require plumbing the CA out of the test model, which is out of scope here.
"ignore::urllib3.exceptions.InsecureRequestWarning",
]
# Linting and formatting tools configuration
[tool.codespell]
# https://github.com/codespell-project/codespell
skip = ".git,.tox,build,lib,venv,.venv,.mypy_cache,icon.svg,__pycache__,CHANGELOG.md"
[tool.isort]
# Profiles: https://pycqa.github.io/isort/docs/configuration/profiles.html
line_length = 99
profile = "black"
[tool.ruff]
# Default settings: https://docs.astral.sh/ruff/configuration/
# Settings: https://docs.astral.sh/ruff/settings/
line-length = 99
include = ["pyproject.toml", "src/**/*.py", "tests/**/*.py", "lib/charms/kratos/**/*.py"]
extend-exclude = ["__pycache__", "*.egg_info", "tests/unit/capture_events.py"]
target-version = "py312"
preview = true
[tool.ruff.lint]
# Rules: https://docs.astral.sh/ruff/rules/
select = ["E", "W", "F", "C", "N", "D", "CPY"]
ignore = [
"D100",
"D101",
"D102",
"D103",
"D105",
"D107",
"D203",
"D204",
"D213",
"D215",
"D400",
"D404",
"D406",
"D407",
"D408",
"D409",
"D413",
"E501",
"N818"
]
per-file-ignores = {"tests/*" = ["D100","D101","D102","D103","D104"]}
[tool.ruff.lint.flake8-copyright]
author = "Canonical Ltd."
[tool.ruff.lint.mccabe]
max-complexity = 15 # accommodate holistic handler needs
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.mypy]
pretty = true
mypy_path = "./src:./lib/:./tests"
# Exclude non-kratos libraries
exclude = 'lib/charms/((?!kratos/).)'
follow_imports = "silent"
warn_redundant_casts = true
warn_unused_configs = true
show_traceback = true
show_error_codes = true
namespace_packages = true
explicit_package_bases = true
check_untyped_defs = true
allow_redefinition = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
# Ignore libraries that do not have type hint nor stubs
[[tool.mypy.overrides]]
module = ["ops.*", "pytest.*", "pytest_operator.*", "urllib3.*", "jinja2.*", "lightkube.*", "pytest_mock.*"]
ignore_missing_imports = true
[tool.pyright]
extraPaths = ["src", "lib"]