diff options
author | Aleš Mrázek <ales.mrazek@nic.cz> | 2024-07-12 10:12:36 +0200 |
---|---|---|
committer | Aleš Mrázek <ales.mrazek@nic.cz> | 2024-08-26 14:28:10 +0200 |
commit | b0b8b8bd00b270d0d8c14179bce38662223f51b9 (patch) | |
tree | ae4af4a7271bece14ab621f40d6e07ade5b633bd /pyproject.toml | |
parent | manager: scripts moved to the repository root (diff) | |
download | knot-resolver-b0b8b8bd00b270d0d8c14179bce38662223f51b9.tar.xz knot-resolver-b0b8b8bd00b270d0d8c14179bce38662223f51b9.zip |
manager: poetry project moved to the repository root
Diffstat (limited to 'pyproject.toml')
-rw-r--r-- | pyproject.toml | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..ec3f7794 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,161 @@ +[tool.poetry] +name = "knot-resolver-manager" +version = "6.0.8" +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_manager", from = "manager"} +] + +# 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 } + +[tool.poetry.extras] +prometheus = ["prometheus-client"] + +[tool.poetry.group.dev.dependencies] +poetry = "^1.8.3" +pyparsing = "^3.1.1" +poethepoet = "^0.24.4" +debugpy = "^1.8.1" + +[tool.poetry.group.test.dependencies] +pytest = "^8.0.1" +pytest-cov = "^4.1.0" +pytest-asyncio = "^0.23.5" + +[tool.poetry.group.lint.dependencies] +black = "^24.2.0" +isort = "^5.13.2" +toml = "^0.10.2" +mypy = "^1.8.0" +types-pyyaml = "^6.0.12.12" +pylint = "^3.0.3" +flake8 = {version = "*", python = "^3.8.1"} + +[tool.poetry.group.docs.dependencies] +sphinx = "^5.3.0" +sphinx-tabs = "^3.4.5" +sphinx-rtd-theme = "^2.0.0" +breathe = "^4.35.0" +json-schema-for-humans = "^0.47" + +[tool.poetry.scripts] +kresctl = 'knot_resolver_manager.cli.main:main' +knot-resolver = 'knot_resolver_manager.__main__:run' + +[tool.poe.tasks] +configure = { cmd = "scripts/meson-configure", help = "Configure Knot Resolver daemon" } +run = { cmd = "scripts/run", help = "Run the manager" } +run-debug = { cmd = "scripts/run-debug", help = "Run the manager under debugger" } +docs = { cmd = "scripts/docs", help = "Create HTML documentation" } +test = { shell = "env PYTHONPATH=. pytest --junitxml=unit.junit.xml --cov=manager/knot_resolver_manager --show-capture=all tests/manager", help = "Run tests" } +check = { cmd = "scripts/codecheck", help = "Run static code analysis" } +format = { shell = "black manager/knot_resolver_manager/ tests/manager scripts/create_setup.py manager/build_c_extensions.py; isort .", help = "Run code formatter" } +fixdeps = { shell = "poetry install; npm install; npm update", help = "Install/update dependencies according to configuration files"} +examples = { cmd = "scripts/examples", help = "Validate all configuration examples" } +kresctl = { script = "knot_resolver_manager.cli.main:main", cwd="${POE_PWD}", help="run kresctl" } +kresctl-nocwd = { script = "knot_resolver_manager.cli.main:main", help="run kresctl" } # Python <3.8 and poethepoet <0.22.0 compatibility (see also `./poe`) +clean = """ + rm -rf .coverage + .mypy_cache + .pytest_cache + ./**/__pycache__ + build + dist +""" +gen-setuppy = { shell = "python scripts/create_setup.py > setup.py", help = "Generate setup.py file for backwards compatibility" } +man = {cmd = "scripts/man", help = "Display manpage from sources" } + +[tool.black] +line-length = 120 +target_version = ['py312'] +include = '\.py$' +exclude = "setup.py" # Poetry generates it and we want to keep it unchanged + +[tool.isort] +line_length=120 # corresponds to -w flag +profile = "black" +multi_line_output=3 # corresponds to -m flag +include_trailing_comma=true # corresponds to -tc flag +skip_glob = '^((?!py$).)*$' # isort all Python files +float_to_top=true +skip = "setup.py" # Poetry generates it and we want to keep it unchanged + +[tool.pylint."MESSAGES CONTROL"] +disable= [ + "broad-except", + "fixme", + "global-statement", + "invalid-name", + "line-too-long", # checked by flake8 + "missing-docstring", + "no-else-return", + "too-few-public-methods", + "unused-import", # checked by flake8, + "too-many-return-statements", # would prevent us from using recursive tree traversals + "logging-fstring-interpolation", # see https://github.com/PyCQA/pylint/issues/1788 + "no-else-raise", # not helpful for readability, when we want explicit branches + "raising-bad-type", # handled by type checker + "too-many-arguments", # sure, but how can we change the signatures to take less arguments? artificially create objects with arguments? That's stupid... + "invalid-overridden-method", # hopefully checked by type checkers + "no-member", # pylint does not do it properly + "import-error", # pylint does not do it properly +] + +[tool.pylint.SIMILARITIES] +min-similarity-lines = "6" +ignore-comments = "yes" +ignore-docstrings = "yes" +ignore-imports = "yes" + +[tool.pylint.DESIGN] +max-parents = "10" + +[tool.mypy] +python_version = "3.12" +# strict = true +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>=1.0.0", + "setuptools>=67.8.0" +] +build-backend = "poetry.core.masonry.api" |