Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
230 lines (213 loc) · 8.12 KB
/
Copy pathpyproject.toml
File metadata and controls
230 lines (213 loc) · 8.12 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
[project]
name = "sbctl"
description = "CLI for managing SimplyBlock cluster"
readme = "README.md"
requires-python = ">=3.11"
authors = [{ name = "Hamdy", email = "hamdy@simplyblock.io" }]
dynamic = ["version"]
dependencies = [
"foundationdb==7.3.63",
"hvac",
"pykmip>=0.11",
"requests>=2.33.0",
"prettytable>=3.10.0",
"docker",
"psutil",
"py-cpuinfo",
"flask",
"kubernetes==35.0.0",
"PyYAML",
"urllib3>=2.8.0",
"graypy==2.1.0",
"boto3",
"jinja2",
"prometheus-client",
"ec2-metadata",
"flask-swagger-ui",
"sentry-sdk[flask]>=1.40",
"flask-openapi3",
"jsonschema",
"fastapi",
"sse-starlette",
"uvicorn",
"prometheus_api_client",
"paramiko",
"pydantic-settings",
"botocore",
"tenacity",
"prometheus_fastapi_instrumentator",
]
[project.urls]
Homepage = "https://www.simplyblock.io/"
# `sbcli-dev` is the value SIMPLY_BLOCK_COMMAND_NAME currently carries
# (simplyblock_core/env_var), and services shell out to it via
# constants.SIMPLY_BLOCK_CLI_NAME. setup.py derived the name from env_var at
# build time; PEP 621 requires static entry points, so both are declared.
[project.scripts]
sbctl = "simplyblock_cli.cli:main"
sbcli-dev = "simplyblock_cli.cli:main"
simplyblock-service = "simplyblock_core.services.__main__:main"
simplyblock-task-runner = "simplyblock_core.services.task_runners:main"
# Storage-array plugins of the multi-attach array LUN mode
# (simplyblock_core.array); the name is the value of Cluster.array_plugin.
[project.entry-points."simplyblock.array_plugins"]
aws-ebs = "simplyblock_core.array.aws_ebs:AwsEbsPlugin"
pure-flasharray = "simplyblock_core.array.san:PureFlashArrayPlugin"
netapp-ontap = "simplyblock_core.array.san:NetAppOntapPlugin"
dell-powerstore = "simplyblock_core.array.san:DellPowerStorePlugin"
dell-powermax = "simplyblock_core.array.san:DellPowerMaxPlugin"
dell-powerflex = "simplyblock_core.array.san:DellPowerFlexPlugin"
hpe-wsapi = "simplyblock_core.array.san:HpeWsapiPlugin"
hpe-nimble = "simplyblock_core.array.san:HpeNimblePlugin"
ibm-flashsystem = "simplyblock_core.array.san:IbmFlashSystemPlugin"
hitachi-vsp = "simplyblock_core.array.san:HitachiVspPlugin"
huawei-dorado = "simplyblock_core.array.san:HuaweiDoradoPlugin"
infinidat-infinibox = "simplyblock_core.array.san:InfinidatInfiniBoxPlugin"
[dependency-groups]
test = [
"mock",
"cryptography", # tests/integration/kms/conftest.py: throwaway PyKMIP test cert
"httpx", # fastapi.testclient
"pytest>=9.0.3",
"pytest-randomly", # per-run seed + per-test reseed; see tests/AGENTS.md
"pytest-timeout",
"requests",
"testcontainers>=4.0",
]
types = [
"mypy",
"kubernetes-typed",
"types-docker",
"types-boto3",
"types-urllib3",
]
generate = [
"jinja2",
"PyYAML",
"jsonschema",
]
[build-system]
requires = ["setuptools>=77"]
build-backend = "setuptools.build_meta"
# The version lives in simplyblock_core/env_var, which release.yml rewrites and
# constants.py reads at runtime for `sbctl --version`. _version.py is the single
# reader; it is import-safe at build time because it uses only the stdlib.
#
# `__dist_version__`, not `__version__`, on purpose: setuptools validates this
# attr as PEP 440, which the raw human-authored version (e.g. a hotfix-on-beta
# string like `26.4.0-beta6.1`) is not guaranteed to be. See _version.py.
[tool.setuptools.dynamic]
version = { attr = "simplyblock_core._version.__dist_version__" }
[tool.setuptools.packages.find]
include = ["simplyblock_core*", "simplyblock_web*", "simplyblock_cli*"]
# Scripts, templates, dashboards and env_var are resolved at runtime relative to
# __file__, so they have to travel inside the packages. Without this setuptools
# ships only *.py and the omission is silent.
[tool.setuptools.package-data]
"*" = ["*"]
[tool.uv]
constraint-dependencies = [
"cryptography>=50.0.0",
"starlette>=1.3.1",
"python-dotenv>=1.2.2",
"werkzeug>=3.1.9",
"oauthlib>=4.0.1",
]
[tool.ruff]
required-version = ">=0.17"
extend-exclude = ['simplyblock_cli/cli.py']
[tool.ruff.lint]
extend-select = ["TID251"]
ignore = [
"BLE001",
"FA100",
"FLY002",
"LOG015",
"PLC0206",
"PLR0402",
"PLR1704",
"PLR1722",
"PLR1730",
"PLW0602",
"PLW1508",
"PLW1510",
"RUF015",
"RUF059",
"RUF100",
"S110",
"S112",
"SIM101",
"SIM102",
"SIM103",
"SIM113",
"SIM114",
"SIM115",
"SIM117",
"SIM118",
"SIM210",
"TRY002",
"TRY004",
"TRY201",
"TRY203",
"TRY401",
"UP007",
"UP022",
"UP031",
]
[tool.ruff.lint.per-file-ignores]
"e2e/**" = ["C401", "C408", "C414"]
[tool.ruff.lint.flake8-tidy-imports.banned-api]
# Applies everywhere (no per-file-ignore): unlike random.seed below, a stray
# md5 call is a liability in production code and e2e/scripts alike, not just
# tests. The one existing production use of random.seed silences this
# call-by-call with `# noqa: TID251` instead of a path-wide ignore, so a
# second banned symbol doesn't have to inherit that scope.
#
# Mirrors the `.grype.yaml` ignore for CVE-2026-119170: that entry is a
# temporary exception for existing sha1/sha256 use (upstream hasn't shipped
# the FIPS fix yet); this rule is the permanent guard against ever adding a
# new md5 call that the same regression would silently mishandle under FIPS.
# Keep both in sync -- if CVE-2026-119170 is ever fixed upstream and the
# grype ignore is dropped, this ban can stay (or be relaxed to require
# usedforsecurity=False, which banned-api cannot express).
"hashlib.md5".msg = "md5 is banned -- CVE-2026-119170 (see .grype.yaml) means the pinned CPython's FIPS enforcement for it is currently broken. Switch to hashlib.sha256 (and, if comparing against an external tool's output, that tool's sha256 equivalent -- banned-api forbids the symbol outright, so usedforsecurity=False does not clear this rule)."
# Seeding the global RNG breaks seed replay for every later test —
# pytest-randomly seeds it per test. See tests/AGENTS.md § Randomness and
# seeds. Production code may still seed it deliberately (e.g. a
# reproducible load-test run); the one such call site silences this with
# `# noqa: TID251` rather than a path-wide ignore.
"random.seed".msg = "Seeding the global RNG breaks seed replay for every later test — pytest-randomly seeds it per test. See tests/AGENTS.md § Randomness and seeds."
[tool.ruff.lint.flake8-comprehensions]
allow-dict-calls-with-keyword-arguments = true
[tool.mypy]
check_untyped_defs = true
follow_untyped_imports = true
enable_error_code = ["deprecated"]
[tool.pytest.ini_options]
pythonpath = "."
testpaths = ['simplyblock_core/test', 'tests']
norecursedirs = ['tests/perf']
# Order randomization stays off for now: tests/conftest.py documents inter-test
# coupling (TTL caches, the DBController singleton, the port-block gate) that
# shuffling would surface all at once. Enabling it is its own change.
addopts = "-p randomly --randomly-dont-reorganize"
markers = [
"slow: long-running integration tests (e.g. live migration); excluded from the default integration run, opt in with -m slow",
"two_node_sim: the two-node HA simulator (tests/integration/two_node_sim); tox -e two-node-sim-full",
"two_node_sim_fast: the simulator's fast tier, required on every PR; tox -e two-node-sim",
]
# Per-test time BUDGET, not a safety net. The previous 900s ceiling was larger
# than every stall it was meant to catch — a 300s hot-spin in cluster activation
# and a 15s one in the restart-abort path both sailed under it, and the tier took
# ~45min without a single timeout firing. A tight default makes a stall fail
# where it happens, with a stack dump naming the line.
#
# A test that legitimately needs longer overrides it with @pytest.mark.timeout(N)
# and a comment saying why; the migration tier sets its own default in
# tests/integration/migration/conftest.py. See tests/AGENTS.md § Test timeouts.
#
# "signal" (SIGALRM, main thread) fails just the offending test and lets the rest
# of the session continue; "thread" would hard-exit the whole process.
# timeout_func_only stays at its default (false) so a stall in a fixture counts too.
timeout = 30
timeout_method = "signal"