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 236 237 238 239 240 241 242
|
[tool.poetry]
name = "knot-resolver"
version = "6.2.0"
description = "Knot Resolver Manager - a Python program that automatically manages the other components of the resolver"
license = "GPL-3.0-or-later"
authors = [
"Aleš Mrázek <ales.mrazek@nic.cz>",
"Václav Šraier <vaclav.sraier@nic.cz>"
]
maintainers = [
"Aleš Mrázek <ales.mrazek@nic.cz>"
]
readme = "README.md"
homepage = "https://www.knot-resolver.cz"
repository = "https://gitlab.nic.cz/knot/knot-resolver"
documentation = "https://www.knot-resolver.cz/documentation"
packages = [
{include = "knot_resolver", from = "python"}
]
exclude = ["**/*.in", "**/meson.build"]
# See currently open issue about building C extensions here:
# https://github.com/python-poetry/poetry/issues/2740
[tool.poetry.build]
script = "build_c_extensions.py"
generate-setup-file = true
[tool.poetry.dependencies]
python = "^3.8"
aiohttp = "*"
jinja2 = "*"
pyyaml = "*"
supervisor = "*"
typing-extensions = "*"
prometheus-client = { version = "*", optional = true }
watchdog = { version = "*", optional = true }
[tool.poetry.extras]
prometheus = ["prometheus-client"]
watchdog = ["watchdog"]
[tool.poetry.group.build.dependencies]
poetry-core = ">=1.9.1"
setuptools = ">=75.3.2"
[tool.poetry.group.dev.dependencies]
poetry = "^1.8.5"
pyparsing = "^3.1.4"
poethepoet = "^0.24.4"
debugpy = "^1.8.18"
[tool.poetry.group.test.dependencies]
pytest = "^8.3.5"
pytest-cov = "^4.1.0"
pytest-asyncio = "^0.23.8"
toml = "^0.10.2"
[tool.poetry.group.lint.dependencies]
ruff = "^0.6.9"
mypy = "^1.14.1"
types-pyyaml = "^6.0.12.20241230"
[tool.poetry.group.docs.dependencies]
sphinx = "^5.3.0"
sphinx-rtd-theme = "^2.0.0"
breathe = "^4.35.0"
[tool.poetry.scripts]
kresctl = 'knot_resolver.client.main:main'
knot-resolver = 'knot_resolver.manager.main:main'
[tool.poe.tasks]
# Tasks to configure, build and run
configure = { cmd = "scripts/poe-tasks/configure", help = "(Re)configure Meson build directory." }
run = { cmd = "scripts/poe-tasks/run", help = "Run Knot Resolver." }
run-debug = { cmd = "scripts/poe-tasks/run-debug", help = "Debug Knot Resolver with debugpy." }
kresctl = { cmd = "scripts/poe-tasks/kresctl", help="Run kresctl utility" }
docs = { cmd = "scripts/poe-tasks/docs", help = "Build Knot Resolver's HTML documentation." }
# Tasks to generate files
gen-constantspy = { cmd = "scripts/poe-tasks/gen-constantspy", help = "Generate 'constants.py' module using Meson configured options." }
gen-schema = { cmd = "scripts/poe-tasks/gen-schema", help = "Generate a JSON schema of Knot Resolver's declarative configuration."}
gen-setuppy = { cmd = "scripts/poe-tasks/gen-setuppy", help = "Generate 'setup.py' file for backwards compatibility." }
# Tasks to fix, check and test
fix-format = { cmd = "scripts/poe-tasks/fix-format", help = "Check and fix code formatting using Ruff." }
check-code = { cmd = "scripts/poe-tasks/check-code", help = "Check code format, run static code analysis (Ruff) and typing checker (Mypy)." }
check-files = { cmd = "scripts/poe-tasks/check-files", help = "Check that all dependencies are properly installed and generated files are not behind project." }
test-unit = { cmd = "scripts/poe-tasks/test-unit", help = "Run pytest unit tests." }
test-examples = { cmd = "scripts/poe-tasks/test-examples", help = "Validate all configuration examples using 'kresctl validate' utility." }
test-migrate = { cmd = "scripts/poe-tasks/test-migrate", help = "Migrate testing configuration using 'kresctl migrate' utility and validate it." }
# Other tasks
clean = { cmd = "scripts/poe-tasks/clean", help="Cleanup build directories and files." }
[tool.ruff]
line-length = 120
target-version = "py38"
exclude = ["setup.py"]
[tool.ruff.lint]
select = ["ALL"]
ignore = [
# * candidate for remove in the future
# Annotations
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
# Arguments
"ARG001", # Unused function argument
"ARG002", # Unused method argument
"ARG004", # Unused static method argument
"B009", # *Replace `getattr` with attribute access
"BLE001", # *Do not catch blind exception
"C408", # *Unnecessary `tuple` call (rewrite as a literal)
"C417", # *Unnecessary `map` usage (rewrite using a `list` comprehension)
"COM812", # Trailing comma missing
# docstring
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method (__int__, __str__, ...)
"D106", # Missing docstring in public nested class
"D107", # Missing docstring in `__init__`
# docstring: lines
"D202", # *No blank lines allowed after function docstring
# docstring: incompatible
"D203", # No blank lines allowed before class docstring; incompatible with D211
"D212", # Multi-line docstring summary should start at the first line; incompatible with D213
# exceptions
"EM101", # *Exception must not use a string literal, assign to variable first
"EM102", # *Exception must not use an f-string literal, assign to variable first
"TRY003", # Avoid specifying long messages outside the exception class
"TRY004", # *Prefer `TypeError` exception for invalid type
"TRY301", # *Abstract `raise` to an inner function
"TRY400", # *Use `logging.exception` instead of `logging.error`
"ERA001", # *Found commented-out code
"FA100", # (remove in py3.10) Add `from __future__ import annotations` to simplify typing
# FIXME and TODO
"FIX001",
"FIX002", # Missing issue link on the line following this TODO
"TD001",
"TD002",
"TD004",
# boolean
"FBT001", # Boolean-typed positional argument in function definition
"FBT002", # Boolean default positional argument in function definition
"FBT003", # Boolean positional value in function call
# logging
"G004", # *Logging statement uses f-string
"G201", # *Logging `.exception(...)` should be used instead of `.error(..., exc_info=True)`
"ISC001", # *Single-line implicit string concatenation
"PERF203", # `try`-`except` within a loop incurs performance overhead
"PLR2004", # *Magic value used in comparison
"PLW0603", # Using the global statement to update `_value` is discouraged
# path
"PTH104", # `os.rename()` should be replaced by `Path.rename()`
"PTH108", # `os.unlink()` should be replaced by `Path.unlink()`
"PTH109", # `os.getcwd()` should be replaced by `Path.cwd()`
"PTH112", # `os.path.isdir()` should be replaced by `Path.is_dir()`
"PTH116", # `os.stat()` should be replaced by `Path.stat()`, `Path.owner()`, or `Path.group()`
"PTH118", # `os.path.join()` should be replaced by `Path` with `/` operator
"PTH120", # `os.path.dirname()` should be replaced by `Path.parent`
"PTH123", # `open()` should be replaced by `Path.open()`
"PTH201", # *Do not pass the current directory explicitly to `Path`
"RSE102", # *Unnecessary parentheses on raised exception
"RUF005", # *Consider `[sys.executable, *sys.argv]` instead of concatenation
"RUF010", # *Use explicit conversion flag
"RUF012", # *Mutable class attributes should be annotated with `typing.ClassVar`
"S101", # Use of `assert` detected
"S105", # Possible hardcoded password assigned
"S310", # Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
"S606", # Starting a process without a shell
"S701", # Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS.
# Ensure `autoescape=True` or use the `select_autoescape` function.
"SIM105", # Use `contextlib.suppress(FileNotFoundError)` instead of `try`-`except`-`pass`
"SIM118", # *Use `key in dict` instead of `key in dict.keys()
"T201", # `print` found
"TD003", # Missing issue link on the line following this TODO
"UP012", # Unnecessary call to `encode` as UTF-8
"UP015", # Unnecessary open mode parameters
"UP036", # *Version block is outdated for minimum Python version
"UP037", # *Remove quotes from type annotation
# type-checking
"TCH001", # *Move application import into a type-checking block
"TCH003", # *Move standard library import into a type-checking block
]
exclude = [
"tests/pytests/*",
"python/knot_resolver/controller/supervisord/plugin/*",
# submodules
# "python/knot_resolver/client/*",
# "python/knot_resolver/client/*",
# "python/knot_resolver/controller/*",
# "python/knot_resolver/manager/*",
# "python/knot_resolver/utils/*",
]
[tool.ruff.lint.isort]
known-first-party=["knot_resolver"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
[tool.mypy]
python_version = "3.8"
disallow_any_generics = true
disallow_subclassing_any = true
disallow_untyped_calls = false
disallow_untyped_decorators = true
pretty = true
show_error_codes = true
allow_redefinition = true
disallow_untyped_defs = false
strict_equality = true
disallow_incomplete_defs = true
check_untyped_defs = true
implicit_reexport = false
no_implicit_optional = true
[build-system]
requires = [
"poetry-core",
"setuptools"
]
build-backend = "poetry.core.masonry.api"
|