]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
python: remove legacy setup.py and build_c_extensions.py
authorAleš Mrázek <ales.mrazek@nic.cz>
Mon, 29 Jun 2026 14:32:35 +0000 (16:32 +0200)
committerAleš Mrázek <ales.mrazek@nic.cz>
Tue, 30 Jun 2026 23:11:37 +0000 (01:11 +0200)
build_c_extensions.py [deleted file]
pyproject.toml
scripts/poe-tasks/check-code
scripts/poe-tasks/check-files
scripts/poe-tasks/fix-format
scripts/poe-tasks/gen-setuppy [deleted file]
scripts/poe-tasks/utils/_env.sh
scripts/poe-tasks/utils/create_setup.py [deleted file]
setup.py [deleted file]

diff --git a/build_c_extensions.py b/build_c_extensions.py
deleted file mode 100644 (file)
index 77c197a..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-from typing import Any, Dict
-
-from setuptools import Extension
-
-
-def build(setup_kwargs: Dict[Any, Any]) -> None:
-    setup_kwargs.update(
-        {
-            "ext_modules": [
-                Extension(
-                    name="knot_resolver.controller.supervisord.plugin.notify",
-                    sources=["python/knot_resolver/controller/supervisord/plugin/notifymodule.c"],
-                ),
-            ]
-        }
-    )
index 3dae35e8c6e269f54fe9ba9a1adfe4149a1f40bd..2fae681bcea13b096e68dcfa6e984de0092026ba 100644 (file)
@@ -71,7 +71,6 @@ docs = { cmd = "scripts/poe-tasks/docs", help = "Build Knot Resolver's HTML docu
 # 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)." }
@@ -85,7 +84,6 @@ clean = { cmd = "scripts/poe-tasks/clean", help="Cleanup build directories and f
 [tool.ruff]
 line-length = 120
 target-version = "py38"
-exclude = ["setup.py"]
 
 [tool.ruff.lint]
 select = ["ALL"]
index 7ca26fb9fce1c1791712bdf696bf93370835eae2..7c89841f4a9dfc476e5254c250a042e2d30b3127 100755 (executable)
@@ -8,7 +8,7 @@ source $src_dir/utils/_env.sh
 set +e
 
 # dirs to check
-dirs="python/knot_resolver/ tests/manager scripts/poe-tasks/utils/create_setup.py"
+dirs="python/knot_resolver/ tests/manager"
 
 # check imports
 echo -e "${yellow}Checking Python imports using Ruff...${reset}"
index 76da1209a099e19f78776a2c10d91aa10dca4b5d..ef2f18610c5e207ddc4b3463330b717f4480f4bb 100755 (executable)
@@ -20,14 +20,6 @@ if test "$aggregated_rv" -ne "0"; then
        exit 1
 fi
 
-# check that setup.py is not behind pyproject.toml
-echo -e "${yellow}Checking setup.py${reset}"
-python scripts/poe-tasks/utils/create_setup.py | diff - setup.py
-check_rv $?
-python setup.py --help > /dev/null
-check_rv $?
-echo
-
 # check python/knot_resolver/constants.py
 echo -e "${yellow}python/knot_resolver/constants.py${reset}"
 meson_setup_configure > /dev/null
index 8a8554a51fab69a7003fa5fe6deefb6ae5a2e869..be2bf038ddfdd4cb361254186124acc5c9b0d879 100755 (executable)
@@ -4,7 +4,7 @@
 src_dir="$(dirname "$(realpath "$0")")"
 source $src_dir/utils/_env.sh
 
-dirs="python/knot_resolver/ tests/manager scripts/poe-tasks/utils/create_setup.py"
+dirs="python/knot_resolver/ tests/manager"
 
 # sort python import
 echo -e "${yellow}Sorting Python imports using ruff...${reset}"
diff --git a/scripts/poe-tasks/gen-setuppy b/scripts/poe-tasks/gen-setuppy
deleted file mode 100755 (executable)
index 8a6d543..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env bash
-
-# ensure consistent behaviour
-src_dir="$(dirname "$(realpath "$0")")"
-source $src_dir/utils/_env.sh
-
-# create setup.py
-python scripts/poe-tasks/utils/create_setup.py > setup.py
index a29ca0ec288a211836c0b4f64cdfc58f7b322cb1..99a5356c2bf03ca9f87be28f60f555a4fdfd2766 100644 (file)
@@ -122,7 +122,6 @@ function fancy_message {
                echo -e "${red}Failure.${reset}"
                echo -e "${red}These commands might help you:${reset}"
                echo -e "${red}\tpoe fix-format${reset}"
-               echo -e "${red}\tpoe gen-setuppy${reset}"
                echo -e "${red}\tpoe gen-constantspy${reset}"
                echo -e "${red}\tpoe gen-schema${reset}"
                echo -e "${red}That's not great. Could you please fix that?${reset} 😲😟"
diff --git a/scripts/poe-tasks/utils/create_setup.py b/scripts/poe-tasks/utils/create_setup.py
deleted file mode 100755 (executable)
index 93ff0b9..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-#
-# Original source:
-# https://github.com/sdss/flicamera/blob/main/create_setup.py
-# We modified the script so that it outputs the setup.py to stdout and that no
-# version upper bounds are outputted in the depencency list.
-#
-# @Author: José Sánchez-Gallego (gallegoj@uw.edu)
-# @Date: 2019-12-18
-# @Filename: create_setup.py
-# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
-
-# This is a temporary solution for the fact that pip install . fails with
-# poetry when there is no setup.py and an extension needs to be compiled.
-# See https://github.com/python-poetry/poetry/issues/1516. Running this
-# script creates a setup.py filled out with information generated by
-# poetry when parsing the pyproject.toml.
-
-import os
-import re
-import sys
-
-from packaging.version import Version
-
-# If there is a global installation of poetry, prefer that.
-lib = os.path.expanduser("~/.poetry/lib")
-vendors = os.path.join(lib, "poetry", "_vendor")
-current_vendors = os.path.join(vendors, "py{}".format(".".join(str(v) for v in sys.version_info[:2])))
-
-sys.path.insert(0, lib)
-sys.path.insert(0, current_vendors)
-
-try:
-    try:
-        from poetry.core.factory import Factory
-        from poetry.core.masonry.builders.sdist import SdistBuilder
-    except (ImportError, ModuleNotFoundError):
-        from poetry.factory import Factory
-        from poetry.masonry.builders.sdist import SdistBuilder
-    from poetry.__version__ import __version__
-except (ImportError, ModuleNotFoundError) as ee:
-    raise ImportError(f"install poetry by doing pip install poetry to use this script: {ee}")
-
-
-# Generate a Poetry object that knows about the metadata in pyproject.toml
-factory = Factory()
-poetry = factory.create_poetry(os.path.dirname(__file__))
-
-# Use the SdistBuilder to genrate a blob for setup.py
-if Version(__version__) >= Version("1.1.0b1"):
-    sdist_builder = SdistBuilder(poetry, None)
-else:
-    sdist_builder = SdistBuilder(poetry, None, None)
-
-setuppy_blob: bytes = sdist_builder.build_setup()
-
-
-# patch the result so that it does not contain upper bounds in dependencies
-# (but it should contain them in python version)
-setuppy = setuppy_blob.decode("utf8")
-setuppy, _ = re.subn(r"(\'[^\']+>=[^<>=,\']*),<[^<>=,\']*\'", "\\1'", setuppy)
-
-# output the setup.py script to stdout
-print(setuppy)
-print("\n# This setup.py was autogenerated using Poetry for backward compatibility with setuptools.")
diff --git a/setup.py b/setup.py
deleted file mode 100644 (file)
index 5bf3d3f..0000000
--- a/setup.py
+++ /dev/null
@@ -1,61 +0,0 @@
-# -*- coding: utf-8 -*-
-from setuptools import setup
-
-package_dir = \
-{'': 'python'}
-
-packages = \
-['knot_resolver',
- 'knot_resolver.client',
- 'knot_resolver.client.commands',
- 'knot_resolver.controller',
- 'knot_resolver.controller.supervisord',
- 'knot_resolver.controller.supervisord.plugin',
- 'knot_resolver.datamodel',
- 'knot_resolver.datamodel.templates',
- 'knot_resolver.datamodel.types',
- 'knot_resolver.manager',
- 'knot_resolver.manager.files',
- 'knot_resolver.manager.metrics',
- 'knot_resolver.utils',
- 'knot_resolver.utils.compat',
- 'knot_resolver.utils.modeling']
-
-package_data = \
-{'': ['*'], 'knot_resolver.datamodel.templates': ['macros/*']}
-
-install_requires = \
-['aiohttp', 'jinja2', 'pyyaml', 'supervisor', 'typing-extensions']
-
-extras_require = \
-{'prometheus': ['prometheus-client'], 'watchdog': ['watchdog']}
-
-entry_points = \
-{'console_scripts': ['knot-resolver = knot_resolver.manager.main:main',
-                     'kresctl = knot_resolver.client.main:main']}
-
-setup_kwargs = {
-    'name': 'knot-resolver',
-    'version': '6.4.0',
-    'description': 'Knot Resolver Manager - a Python program that automatically manages the other components of the resolver',
-    'long_description': "# Knot Resolver\n\n[![Build Status](https://gitlab.nic.cz/knot/knot-resolver/badges/nightly/pipeline.svg?x)](https://gitlab.nic.cz/knot/knot-resolver/commits/nightly)\n[![Coverage Status](https://gitlab.nic.cz/knot/knot-resolver/badges/nightly/coverage.svg?x)](https://www.knot-resolver.cz/documentation/latest)\n[![Packaging status](https://repology.org/badge/tiny-repos/knot-resolver.svg)](https://repology.org/project/knot-resolver/versions)\n\nKnot Resolver is a full caching DNS resolver implementation. The core architecture is tiny and efficient, written in C and [LuaJIT][luajit], providing a foundation and a state-machine-like API for extension modules. There are three built-in modules - *iterator*, *validator* and *cache* - which provide the main functionality of the resolver. A few other modules are automatically loaded by default to extend the resolver's functionality.\n\nSince Knot Resolver version 6, it also includes a so-called [manager][manager]. It is a new component written in [Python][python] that hides the complexity of older versions and makes it more user friendly. For example, new features include declarative configuration in YAML format and HTTP API for dynamic changes in the resolver and more.\n\nKnot Resolver uses a [different scaling strategy][scaling] than the rest of the DNS resolvers - no threading, shared-nothing architecture (except MVCC cache which can be shared), which allows you to pin workers to available CPU cores and grow by self-replication. You can start and stop additional workers based on the contention without downtime, which is automated by the [manager][manager] by default.\n\nThe LuaJIT modules, support for DNS privacy and DNSSEC, and persistent cache with low memory footprint make it a great personal DNS resolver or a research tool to tap into DNS data. Strong filtering rules, and auto-configuration with etcd make it a great large-scale resolver solution. It also has strong support for DNS over TCP, in particular TCP Fast-Open, query pipelining and deduplication, and response reordering.\n\nFor more on using the resolver, see the [User Documentation][doc]. See the [Developer Documentation][doc-dev] for detailed architecture and development.\n\n## Packages\n\nThe latest stable packages for various distributions are available in our\n[upstream repository](https://pkg.labs.nic.cz/doc/?project=knot-resolver).\nFollow the installation instructions to add this repository to your system.\n\nKnot Resolver is also available from the following distributions' repositories:\n\n* [Fedora and Fedora EPEL](https://src.fedoraproject.org/rpms/knot-resolver)\n* [Debian stable](https://packages.debian.org/stable/knot-resolver),\n  [Debian testing](https://packages.debian.org/testing/knot-resolver),\n  [Debian unstable](https://packages.debian.org/sid/knot-resolver)\n* [Ubuntu](https://packages.ubuntu.com/jammy/knot-resolver)\n* [Arch Linux](https://archlinux.org/packages/extra/x86_64/knot-resolver/)\n* [Alpine Linux](https://pkgs.alpinelinux.org/packages?name=knot-resolver)\n\n### Packaging\n\nThe project uses [`apkg`](https://gitlab.nic.cz/packaging/apkg) for packaging.\nSee [`distro/README.md`](distro/README.md) for packaging specific instructions.\n\n## Building from sources\n\nKnot Resolver mainly depends on [KnotDNS][knot-dns] libraries, [LuaJIT][luajit], [libuv][libuv] and [Python][python].\n\nSee the [Building project][build] documentation page for more information.\n\n## Running\n\nBy default, Knot Resolver comes with [systemd][systemd] integration and you just need to start its service. It requires no configuration changes to run a server on localhost.\n\n```\n# systemctl start knot-resolver\n```\n\nSee the documentation at [knot-resolver.cz/documentation/latest][doc] for more information.\n\n## Running the Docker image\n\nRunning the Docker image is simple and doesn't require any dependencies or system modifications, just run:\n\n```\n$ docker run -Pit cznic/knot-resolver\n```\n\nThe images are meant as an easy way to try the resolver, and they're not designed for production use.\n\n## Contacting us\n\n- [GitLab issues](https://gitlab.nic.cz/knot/knot-resolver/issues) (you may authenticate via GitHub)\n- [mailing list](https://lists.nic.cz/postorius/lists/knot-resolver-announce.lists.nic.cz/)\n- [![Join the chat at https://gitter.im/CZ-NIC/knot-resolver](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/CZ-NIC/knot-resolver?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)\n\n[build]: https://www.knot-resolver.cz/documentation/latest/dev/build.html\n[doc]: https://www.knot-resolver.cz/documentation/latest/\n[doc-dev]: https://www.knot-resolver.cz/documentation/latest/dev\n[knot-dns]: https://www.knot-dns.cz/\n[luajit]: https://luajit.org/\n[libuv]: http://libuv.org\n[python]: https://www.python.org/\n[systemd]: https://systemd.io/\n[scaling]: https://www.knot-resolver.cz/documentation/latest/config-multiple-workers.html\n[manager]: https://www.knot-resolver.cz/documentation/latest/dev/architecture.html\n",
-    'author': 'Aleš Mrázek',
-    'author_email': 'ales.mrazek@nic.cz',
-    'maintainer': 'Aleš Mrázek',
-    'maintainer_email': 'ales.mrazek@nic.cz',
-    'url': 'https://www.knot-resolver.cz',
-    'package_dir': package_dir,
-    'packages': packages,
-    'package_data': package_data,
-    'install_requires': install_requires,
-    'extras_require': extras_require,
-    'entry_points': entry_points,
-    'python_requires': '>=3.8,<4.0',
-}
-from build_c_extensions import *
-build(setup_kwargs)
-
-setup(**setup_kwargs)
-
-
-# This setup.py was autogenerated using Poetry for backward compatibility with setuptools.