forked from opendatahub-io/notebooks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
235 lines (217 loc) · 8.8 KB
/
pyproject.toml
File metadata and controls
235 lines (217 loc) · 8.8 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
# https://docs.astral.sh/uv/concepts/projects/config/
[project]
name = "notebooks"
version = "3.4"
description = "Open Data Hub / OpenShift AI Notebook / Workbench images, and tests for the same in Python."
readme = "README.md"
requires-python = ">=3.14,<3.15"
# https://docs.astral.sh/uv/concepts/projects/dependencies/#managing-dependencies
dependencies = []
[dependency-groups]
dev = [
"prek",
"pyright",
"ruff",
#
"pytest",
"pytest-cov",
"allure-pytest",
"pytest-subtests",
#
"pyfakefs",
# Python 3.14 changed the internal typing._eval_type() function signature - it now includes a new prefer_fwd_module parameter
# and so pydantic 2.10+ is required to work with from __future__ import annotations on Python 3.14
"pydantic>=2.10.0",
"requests",
#
"pyyaml",
"ruamel-yaml",
"structlog",
#
"testcontainers",
"docker",
"podman",
"kubernetes",
"openshift-python-wrapper",
# Transitive via openshift-python-wrapper → fastmcp;
"authlib>=1.6.11",
"typer",
# certifi provides CA bundle needed on macOS where Python's bundled OpenSSL
# does not read from the system Keychain, causing CERTIFICATE_VERIFY_FAILED
"certifi",
# keyring provides OS-level secret storage for OAuth tokens (macOS Keychain,
# GNOME Keyring, KWallet) used by scripts/cve/jira_auth.py
"keyring",
# pygments provides syntax highlighting for pretty-printed JSON in log output
"pygments",
# rich powers the local live progress table in ci/check-image-availability.py
"rich>=14.3.2",
]
[tool.uv]
required-version = "==0.11.8"
# Supply-chain hardening: only resolve package versions published ≥3 days ago.
# See https://docs.astral.sh/uv/concepts/resolution/#time-restricted-reproducible-resolutions
exclude-newer = "3 days"
package = true
environments = [
"sys_platform == 'darwin'",
"sys_platform == 'linux'",
]
# Assert the lockfile is installable on our two target platforms.
# uv lock will fail if any dependency can't be resolved for these.
required-environments = [
"sys_platform == 'linux' and platform_machine == 'x86_64'",
"sys_platform == 'darwin' and platform_machine == 'arm64'",
]
# Reject source distributions — require pre-built wheels for all deps.
# Catches packages that need system libraries to build from source
# (e.g. gssapi needing libkrb5-dev) before they reach CI.
no-build = true
# Workaround for https://github.com/astral-sh/uv/issues/12607 —
# no-build blocks local source trees too
no-binary-package = [
# exempt our own packages
"notebooks",
"copr-rebuild",
# sdist-only deps (pure Python, no system library requirements)
"openshift-python-wrapper", "pyhelper-utils", "python-simple-logger", "timeout-sampler",
]
# koji hard-depends on requests-gssapi, but we only use unauthenticated
# XML-RPC calls (koji.ClientSession) — no GSSAPI auth needed.
# gssapi has no Linux wheels and needs libkrb5-dev to build from source.
exclude-dependencies = ["requests-gssapi"]
[tool.uv.workspace]
members = ["base-images/copr"]
# https://github.com/astral-sh/uv/issues/3957#issuecomment-2659350181
[build-system]
requires = ["uv-build>=0.11.8,<0.12"]
build-backend = "uv_build"
# https://docs.astral.sh/uv/concepts/build-backend/#modules
[tool.uv.build-backend]
module-name = ["ntb"]
module-root = ""
# https://coverage.readthedocs.io/en/latest/config.html
[tool.coverage.run]
source = ["ntb", "ci", "scripts"]
branch = true
omit = ["tests/*", "*/__pycache__/*"]
[tool.coverage.report]
show_missing = true
skip_empty = true
# inspired from https://github.com/red-hat-data-services/ods-ci/blob/master/pyproject.toml
# https://microsoft.github.io/pyright/#/configuration
[tool.pyright]
typeCheckingMode = "off"
reportMissingImports = "error"
reportUnboundVariable = "error"
reportGeneralTypeIssues = "error"
reportUnnecessaryTypeIgnoreComment = "error"
reportPossiblyUnboundVariable = "warning"
reportOptionalMemberAccess = "none"
reportOptionalSubscript = "none"
include = ["ci/", "tests/", "base-images/"]
ignore = [ ]
pythonVersion = "3.14"
pythonPlatform = "Linux"
# https://docs.astral.sh/ruff/configuration
[tool.ruff]
include = ["pyproject.toml", "ci/**/*.py", "ntb/**/*.py", "tests/**/*.py", "base-images/**/*.py", "jupyter/**/*.ipynb"]
exclude = [ ]
target-version = "py314"
line-length = 120
# https://docs.astral.sh/ruff/rules
[tool.ruff.lint]
preview = true
select = [
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"COM", # flake8-commas
"E", "W", # pycodestyle errors/warnings
"F", # Pyflakes
"FA", # flake8-future-annotations
"FLY", # flynt
"G", # flake8-logging-format
"I", # isort
"INP", # flake8-no-pep420
"INT", # flake8-gettext
"ISC", # flake8-implicit-str-concat
"N", # pep8-naming
"NPY002", # numpy-legacy-random
"PERF", # Perflint
"PGH", # pygrep-hooks
"PIE", # misc lints
"PL", # pylint
"PYI", # flake8-pyi
"Q", # flake8-quotes
"RET", # flake8-return
"RUF", # Ruff-specific
"S102", # flake8-bandit: exec-builtin
"T10", # flake8-debugger
"TCH", # type-checking imports
"TID", # flake8-tidy-imports
"UP", # pyupgrade
"YTT", # flake8-2020
]
ignore = [
# intentionally disabled
"E203", # space before : (needed for how black formats slicing)
"ISC001", # single-line-implicit-string-concatenation (ruff format wants this disabled)
"G004", # Logging statement uses f-string (convenient, and we don't care about performance too much)
# various limits and unimportant warnings
"E501", # Line too long
"E741", # Ambiguous variable name: `l`
"PLR0904", # Too many public methods (56 > 20)
"PLR0912", # Too many branches
"PLR0913", # Too many arguments in function definition (6 > 5)
"PLR0915", # Too many statements
"PLR0917", # Too many positional arguments (10/5)
"PLR0917", # Too many positional arguments (7/5)
"PLR0911", # Too many return statements (9 > 6)
"PLR0914", # Too many local variables (19/15)
"PLR2004", # Magic value used in comparison
# "W503", # not yet implemented; line break before binary operator
# "W504", # not yet implemented; line break after binary operator
"PLR1702", # Too many nested blocks (7 > 5)
# TODO
"B006", # Do not use mutable data structures for argument defaults
"COM812", # Trailing comma missing
"INP001", # File `ods_ci/tests/Resources/Page/ODH/JupyterHub/jupyter-helper.py` is part of an implicit namespace package. Add an `__init__.py`.
"N806", # Variable `outputText` in function should be lowercase
"N813", # Camelcase `ElementTree` imported as lowercase `et`
"N816", # Variable `rotatingHandler` in global scope should not be mixedCase
"N999", # Invalid module name: 'createPolarionTestRun'
"PERF401", # Use a list comprehension to create a transformed list
"PLC1901", # `filter_value != ""` can be simplified to `filter_value` as an empty string is falsey
"PLR6201", # Use a `set` literal when testing for membership
"PLR6301", # Method `_render_template` could be a function, class method, or static method
"PLW1514", # `codecs.open` in text mode without explicit `encoding` argument
"PLW2901", # `for` loop variable `tag_it` overwritten by assignment target
"RET501", # Do not explicitly `return None` in function if it is the only possible return value
"RET504", # Unnecessary assignment to `names` before `return` statement
"RET505", # Unnecessary `else` after `return` statement
"UP015", # Unnecessary open mode parameters
"UP031", # format specifiers instead of percent format
"UP032", # Use f-string instead of `format` call
"RET507", # Unnecessary `else` after `continue` statement
"RET508", # Unnecessary `elif` after `break` statement
]
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
# Don't suggest moving types used in Pydantic models into `if TYPE_CHECKING` import blocks
# https://docs.astral.sh/ruff/settings/#lint_flake8-type-checking_runtime-evaluated-base-classes
flake8-type-checking.runtime-evaluated-base-classes = ["pydantic.BaseModel"]
# https://docs.astral.sh/ruff/settings/#lint_pep8-naming_classmethod-decorators
pep8-naming.classmethod-decorators = ["pydantic.validator"]
[tool.ruff.lint.per-file-ignores]
# Inner functions are serialized and executed inside containers, so imports must be local.
"tests/containers/workbenches/gpu_library_loading_test.py" = ["PLC0415"]
# Ignore many stylistic and formatting rules for notebooks, but keep Pylint rules like PLW0128
"jupyter/**/*.ipynb" = ["E", "F", "W", "Q", "I", "PLR0402", "PLC0414", "RUF100", "PLW0108"]
# https://docs.astral.sh/ruff/formatter
[tool.ruff.format]
line-ending = "lf"
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
docstring-code-format = true
docstring-code-line-length = "dynamic"