From 6ea0d7431592311969e3a7a4ddf8467f459679ac Mon Sep 17 00:00:00 2001 From: Timotheus Bachinger Date: Thu, 9 Jan 2025 12:13:46 +0100 Subject: [PATCH] Purge pipenv (almost) completley we still use it on the windows machines tho Change-Id: I2b0dc22be52745791e12839281c22477f4dec1f1 JIRA-Ref: CMK-20868 --- CONTRIBUTING.md | 4 +- Makefile | 12 +----- bandit.yaml | 2 +- .../build-nodes/almalinux-9/Dockerfile | 3 -- .../build-nodes/debian-11/Dockerfile | 3 -- .../build-nodes/debian-12/Dockerfile | 3 -- .../scripts/install-development.sh | 4 -- .../build-nodes/scripts/install-pipenv.sh | 40 ------------------- .../build-nodes/scripts/install-pyenv.sh | 21 ---------- .../build-nodes/sles-15sp3/Dockerfile | 3 -- .../build-nodes/sles-15sp4/Dockerfile | 3 -- .../build-nodes/sles-15sp5/Dockerfile | 3 -- .../build-nodes/sles-15sp6/Dockerfile | 3 -- .../build-nodes/ubuntu-20.04/Dockerfile | 3 -- .../build-nodes/ubuntu-22.04/Dockerfile | 3 -- .../build-nodes/ubuntu-24.04/Dockerfile | 3 -- defines.make | 1 - defines/dev-images/populate-build-context.sh | 1 - omd/Makefile | 1 - scripts/check-pytest-testmon | 22 ---------- tests/pylint/checker_layering_violation.py | 2 +- 21 files changed, 5 insertions(+), 135 deletions(-) delete mode 100755 buildscripts/infrastructure/build-nodes/scripts/install-pipenv.sh delete mode 100755 scripts/check-pytest-testmon diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7ef6e0278d8..73dd2ab262c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -462,8 +462,8 @@ def worst_service_state(*states: int, default: int) -> int: ### Automatic formatting/sorting with ruff -The `ruff` configuration file, `pyproject.toml`, lives in the root directory of the project repository, where `ruff` picks it up automatically. -`ruff` itself lives in a virtualenv managed by pipenv in `check_mk/.venv`, you can run it with `make format-python`. +The `ruff` configuration file(s), `pyproject.toml`, live in the corresponding directories of the project repository, where `ruff` will pick it up automatically. +`ruff` itself lives in a virtualenv managed by bazel/uv in `check_mk/.venv`, you can run it with `make format-python`. This make target will then format your code base as well as sort the import statements. diff --git a/Makefile b/Makefile index e9ac9f119ea..e6c0437a0ba 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ endif # The CI environment variable should only be set by Jenkins CI ?= false -.PHONY: announcement all build check-setup \ +.PHONY: announcement all build \ clean dist documentation \ format format-c test-format-c format-python format-shell \ help install mrproper mrclean \ @@ -46,15 +46,6 @@ deb: cma: $(MAKE) -C omd cma -check-setup: - echo "From here on we check the successful setup of some parts ..." - @if [[ ":$(PATH):" != *":$(HOME)/.local/bin:"* ]]; then \ - echo "Your PATH is missing '~/.local/bin' to work properly with pipenv."; \ - exit 1; \ - else \ - echo "Checks passed"; \ - fi - $(SOURCE_BUILT_LINUX_AGENTS): $(MAKE) -C agents $@ @@ -200,7 +191,6 @@ buildclean: setup: sudo buildscripts/infrastructure/build-nodes/scripts/install-development.sh --profile all sudo bash -c 'usermod -a -G docker $$SUDO_USER' - $(MAKE) check-setup linesofcode: @wc -l $$(find -type f -name "*.py" -o -name "*.js" -o -name "*.cc" -o -name "*.h" -o -name "*.css" | grep -v openhardwaremonitor | grep -v jquery ) | sort -n diff --git a/bandit.yaml b/bandit.yaml index 80851c9e228..08a6a5e9c7a 100644 --- a/bandit.yaml +++ b/bandit.yaml @@ -1,6 +1,6 @@ ### Bandit config file generated from: -# 'PIPENV_VENV_IN_PROJECT=true pipenv run bandit-config-generator -o ../bandit.yaml' +# bandit-config-generator -o ../bandit.yaml' ### This config may optionally select a subset of tests to run or skip by ### filling out the 'tests' and 'skips' lists given below. If no tests are diff --git a/buildscripts/infrastructure/build-nodes/almalinux-9/Dockerfile b/buildscripts/infrastructure/build-nodes/almalinux-9/Dockerfile index 10c3d829b6a..78df983d8fe 100644 --- a/buildscripts/infrastructure/build-nodes/almalinux-9/Dockerfile +++ b/buildscripts/infrastructure/build-nodes/almalinux-9/Dockerfile @@ -212,9 +212,6 @@ RUN /opt/install-bazel.sh link-only RUN /opt/install-rust-cargo.sh link-only # Install non cached dependencies -COPY install-pipenv.sh /opt/ -RUN /opt/install-pipenv.sh - COPY "${DISTRO_MK_FILE}" /opt/ COPY install-cmk-dependencies.sh /opt/ RUN /opt/install-cmk-dependencies.sh diff --git a/buildscripts/infrastructure/build-nodes/debian-11/Dockerfile b/buildscripts/infrastructure/build-nodes/debian-11/Dockerfile index 85eabc84bdd..a682e101ee9 100644 --- a/buildscripts/infrastructure/build-nodes/debian-11/Dockerfile +++ b/buildscripts/infrastructure/build-nodes/debian-11/Dockerfile @@ -166,9 +166,6 @@ RUN /opt/install-bazel.sh link-only RUN /opt/install-rust-cargo.sh link-only # Install non cached dependencies -COPY install-pipenv.sh /opt/ -RUN /opt/install-pipenv.sh - COPY "${DISTRO_MK_FILE}" /opt/ COPY install-cmk-dependencies.sh /opt/ RUN /opt/install-cmk-dependencies.sh diff --git a/buildscripts/infrastructure/build-nodes/debian-12/Dockerfile b/buildscripts/infrastructure/build-nodes/debian-12/Dockerfile index 8c0f6384180..8c41b4616d7 100644 --- a/buildscripts/infrastructure/build-nodes/debian-12/Dockerfile +++ b/buildscripts/infrastructure/build-nodes/debian-12/Dockerfile @@ -165,9 +165,6 @@ RUN /opt/install-bazel.sh link-only RUN /opt/install-rust-cargo.sh link-only # Install non cached dependencies -COPY install-pipenv.sh /opt/ -RUN /opt/install-pipenv.sh - COPY "${DISTRO_MK_FILE}" /opt/ COPY install-cmk-dependencies.sh /opt/ RUN /opt/install-cmk-dependencies.sh diff --git a/buildscripts/infrastructure/build-nodes/scripts/install-development.sh b/buildscripts/infrastructure/build-nodes/scripts/install-development.sh index 0cfc575b379..cb6b2c6ced7 100755 --- a/buildscripts/infrastructure/build-nodes/scripts/install-development.sh +++ b/buildscripts/infrastructure/build-nodes/scripts/install-development.sh @@ -98,7 +98,6 @@ setup_env_variables() { BRANCH_NAME=$(get_version "$SCRIPT_DIR" BRANCH_NAME) BRANCH_VERSION=$(get_version "$SCRIPT_DIR" BRANCH_VERSION) CLANG_VERSION=$(get_version "$SCRIPT_DIR" CLANG_VERSION) - PIPENV_VERSION=$(get_version "$SCRIPT_DIR" PIPENV_VERSION) VIRTUALENV_VERSION=$(get_version "$SCRIPT_DIR" VIRTUALENV_VERSION) export DISTRO="${DISTRO_NAME,,}-${VERSION_NUMBER}" # export NEXUS_ARCHIVES_URL here (as well) in case no creds have to be collected, e.g. CI build @@ -106,7 +105,6 @@ setup_env_variables() { export BRANCH_NAME export BRANCH_VERSION export CLANG_VERSION - export PIPENV_VERSION export VIRTUALENV_VERSION export DISTRO_NAME export VERSION_NUMBER @@ -119,7 +117,6 @@ setup_env_variables() { print_debug "BRANCH_NAME = ${BRANCH_NAME}" print_debug "BRANCH_VERSION = ${BRANCH_VERSION}" print_debug "CLANG_VERSION = ${CLANG_VERSION}" - print_debug "PIPENV_VERSION = ${PIPENV_VERSION}" print_debug "VIRTUALENV_VERSION = ${VIRTUALENV_VERSION}" print_green "Env variables setup done" } @@ -232,7 +229,6 @@ install_for_python_dev() { # not installed via pyenv, do it the oldschool way print_blue "All right, Python will be installed as done in the CI to $TARGET_DIR" install_python_and_teammates - "${SCRIPT_DIR}"/install-pipenv.sh fi print_green "Installation for Python development done" diff --git a/buildscripts/infrastructure/build-nodes/scripts/install-pipenv.sh b/buildscripts/infrastructure/build-nodes/scripts/install-pipenv.sh deleted file mode 100755 index d86eaae5ab1..00000000000 --- a/buildscripts/infrastructure/build-nodes/scripts/install-pipenv.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# Copyright (C) 2019 Checkmk GmbH - License: GNU General Public License v2 -# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and -# conditions defined in the file COPYING, which is part of this source code package. - -set -e -o pipefail - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" -# shellcheck source=buildscripts/infrastructure/build-nodes/scripts/build_lib.sh -. "${SCRIPT_DIR}/build_lib.sh" - -TARGET_DIR="${TARGET_DIR:-/opt}" - -# read optional command line argument -if [ "$#" -eq 1 ]; then - PYTHON_VERSION=$1 -else - PYTHON_VERSION=$(get_version "$SCRIPT_DIR" PYTHON_VERSION) -fi - -PIPENV_VERSION=$(get_version "$SCRIPT_DIR" PIPENV_VERSION) -VIRTUALENV_VERSION=$(get_version "$SCRIPT_DIR" VIRTUALENV_VERSION) - -if type pip3 >/dev/null 2>&1; then - CMD="pip3" -else - CMD="${TARGET_DIR}/Python-${PYTHON_VERSION}/bin/pip3" -fi -$CMD install \ - pipenv=="$PIPENV_VERSION" \ - virtualenv=="$VIRTUALENV_VERSION" - -# link pipenv to /usr/bin to be in PATH. Fallback to /opt/bin if no permissions for writting to /usr/bin. -# /opt/bin does not work as default, because `make -C omd deb` requires it to be in /usr/bin. -# only /usr/bin does not work, because GitHub Actions do not have permissions to write there. -PIPENV_PATH="${TARGET_DIR}/Python-${PYTHON_VERSION}/bin/pipenv" -ln -sf "${PIPENV_PATH}"* /usr/bin || ln -sf "${PIPENV_PATH}"* "${TARGET_DIR}"/bin - -test_package "pipenv --version" "$PIPENV_VERSION$" -test_package "$CMD freeze" "virtualenv" diff --git a/buildscripts/infrastructure/build-nodes/scripts/install-pyenv.sh b/buildscripts/infrastructure/build-nodes/scripts/install-pyenv.sh index 23138ebb98e..09c74c958ef 100755 --- a/buildscripts/infrastructure/build-nodes/scripts/install-pyenv.sh +++ b/buildscripts/infrastructure/build-nodes/scripts/install-pyenv.sh @@ -35,7 +35,6 @@ install() { pyenv update pyenv install "${DESIRED_PYTHON_VERSION}" --skip-existing pyenv global "${DESIRED_PYTHON_VERSION}" # make pip3 available - install_pipenv else print_blue "Team CI recommends to install pyenv for easy use. It is currently not yet installed." @@ -71,28 +70,8 @@ EOF pyenv install "${DESIRED_PYTHON_VERSION}" pyenv global "${DESIRED_PYTHON_VERSION}" # make pip3 available - install_pipenv fi fi } -install_pipenv() { - PIPENV_VERSION=$(get_version "$SCRIPT_DIR" PIPENV_VERSION) - VIRTUALENV_VERSION=$(get_version "$SCRIPT_DIR" VIRTUALENV_VERSION) - - pip3 install \ - pipenv=="$PIPENV_VERSION" \ - virtualenv=="$VIRTUALENV_VERSION" - - # link pipenv to /usr/bin to be in PATH. Fallback to /opt/bin if no permissions for writting to /usr/bin. - # /opt/bin does not work as default, because `make -C omd deb` requires it to be in /usr/bin. - # only /usr/bin does not work, because GitHub Actions do not have permissions to write there. - PIPENV_PATH=$(command -v pipenv) - print_debug "Creating symlink to /usr/bin or ${TARGET_DIR}/bin for OMD usage" - sudo ln -sf "${PIPENV_PATH}"* /usr/bin || sudo ln -sf "${PIPENV_PATH}"* "${TARGET_DIR}"/bin - - test_package "pipenv --version" "$PIPENV_VERSION$" - test_package "pip3 freeze" "virtualenv" -} - install diff --git a/buildscripts/infrastructure/build-nodes/sles-15sp3/Dockerfile b/buildscripts/infrastructure/build-nodes/sles-15sp3/Dockerfile index 26a5e3bf77b..ac1fefc980e 100644 --- a/buildscripts/infrastructure/build-nodes/sles-15sp3/Dockerfile +++ b/buildscripts/infrastructure/build-nodes/sles-15sp3/Dockerfile @@ -178,9 +178,6 @@ RUN /opt/install-bazel.sh link-only RUN /opt/install-rust-cargo.sh link-only # Install non cached dependencies -COPY install-pipenv.sh /opt/ -RUN /opt/install-pipenv.sh - COPY "${DISTRO_MK_FILE}" /opt/ COPY install-cmk-dependencies.sh /opt/ RUN /opt/install-cmk-dependencies.sh diff --git a/buildscripts/infrastructure/build-nodes/sles-15sp4/Dockerfile b/buildscripts/infrastructure/build-nodes/sles-15sp4/Dockerfile index 3c8017e4075..b92d675d9f1 100644 --- a/buildscripts/infrastructure/build-nodes/sles-15sp4/Dockerfile +++ b/buildscripts/infrastructure/build-nodes/sles-15sp4/Dockerfile @@ -177,9 +177,6 @@ RUN /opt/install-bazel.sh link-only RUN /opt/install-rust-cargo.sh link-only # Install non cached dependencies -COPY install-pipenv.sh /opt/ -RUN /opt/install-pipenv.sh - COPY "${DISTRO_MK_FILE}" /opt/ COPY install-cmk-dependencies.sh /opt/ RUN /opt/install-cmk-dependencies.sh diff --git a/buildscripts/infrastructure/build-nodes/sles-15sp5/Dockerfile b/buildscripts/infrastructure/build-nodes/sles-15sp5/Dockerfile index a0e86f902c7..a5b311c27eb 100644 --- a/buildscripts/infrastructure/build-nodes/sles-15sp5/Dockerfile +++ b/buildscripts/infrastructure/build-nodes/sles-15sp5/Dockerfile @@ -176,9 +176,6 @@ RUN /opt/install-bazel.sh link-only RUN /opt/install-rust-cargo.sh link-only # Install non cached dependencies -COPY install-pipenv.sh /opt/ -RUN /opt/install-pipenv.sh - COPY "${DISTRO_MK_FILE}" /opt/ COPY install-cmk-dependencies.sh /opt/ RUN /opt/install-cmk-dependencies.sh diff --git a/buildscripts/infrastructure/build-nodes/sles-15sp6/Dockerfile b/buildscripts/infrastructure/build-nodes/sles-15sp6/Dockerfile index 74db8279ccf..14cd494b2d3 100644 --- a/buildscripts/infrastructure/build-nodes/sles-15sp6/Dockerfile +++ b/buildscripts/infrastructure/build-nodes/sles-15sp6/Dockerfile @@ -176,9 +176,6 @@ RUN /opt/install-bazel.sh link-only RUN /opt/install-rust-cargo.sh link-only # Install non cached dependencies -COPY install-pipenv.sh /opt/ -RUN /opt/install-pipenv.sh - COPY "${DISTRO_MK_FILE}" /opt/ COPY install-cmk-dependencies.sh /opt/ RUN /opt/install-cmk-dependencies.sh diff --git a/buildscripts/infrastructure/build-nodes/ubuntu-20.04/Dockerfile b/buildscripts/infrastructure/build-nodes/ubuntu-20.04/Dockerfile index 497f54ab4a3..9e99f9acb92 100644 --- a/buildscripts/infrastructure/build-nodes/ubuntu-20.04/Dockerfile +++ b/buildscripts/infrastructure/build-nodes/ubuntu-20.04/Dockerfile @@ -172,9 +172,6 @@ RUN /opt/install-bazel.sh link-only RUN /opt/install-rust-cargo.sh link-only # Install non cached dependencies -COPY install-pipenv.sh /opt/ -RUN /opt/install-pipenv.sh - COPY "${DISTRO_MK_FILE}" /opt/ COPY install-cmk-dependencies.sh /opt/ RUN /opt/install-cmk-dependencies.sh diff --git a/buildscripts/infrastructure/build-nodes/ubuntu-22.04/Dockerfile b/buildscripts/infrastructure/build-nodes/ubuntu-22.04/Dockerfile index 9bbfd484eb8..3190733179b 100644 --- a/buildscripts/infrastructure/build-nodes/ubuntu-22.04/Dockerfile +++ b/buildscripts/infrastructure/build-nodes/ubuntu-22.04/Dockerfile @@ -175,9 +175,6 @@ RUN /opt/install-bazel.sh link-only RUN /opt/install-rust-cargo.sh link-only # Install non cached dependencies -COPY install-pipenv.sh /opt/ -RUN /opt/install-pipenv.sh - COPY "${DISTRO_MK_FILE}" /opt/ COPY install-cmk-dependencies.sh /opt/ RUN /opt/install-cmk-dependencies.sh diff --git a/buildscripts/infrastructure/build-nodes/ubuntu-24.04/Dockerfile b/buildscripts/infrastructure/build-nodes/ubuntu-24.04/Dockerfile index 379b286ee3c..dc6e75ba234 100644 --- a/buildscripts/infrastructure/build-nodes/ubuntu-24.04/Dockerfile +++ b/buildscripts/infrastructure/build-nodes/ubuntu-24.04/Dockerfile @@ -175,9 +175,6 @@ RUN /opt/install-bazel.sh link-only RUN /opt/install-rust-cargo.sh link-only # Install non cached dependencies -COPY install-pipenv.sh /opt/ -RUN /opt/install-pipenv.sh - COPY "${DISTRO_MK_FILE}" /opt/ COPY install-cmk-dependencies.sh /opt/ RUN /opt/install-cmk-dependencies.sh diff --git a/defines.make b/defines.make index 64d02e15688..eaf18e00f9b 100644 --- a/defines.make +++ b/defines.make @@ -106,7 +106,6 @@ PYTHON_VERSION_WINDOWS_MAJOR_DOT_MINOR := $(PYTHON_VERSION_WINDOWS_MAJOR).$(PYTH AGENT_PLUGIN_PYTHON_VERSIONS := 2.7 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 # Needed for bootstrapping CI and development environments -PIPENV_VERSION := 2023.11.15 VIRTUALENV_VERSION := 20.25.0 NODEJS_VERSION := 22 NPM_VERSION := 10 diff --git a/defines/dev-images/populate-build-context.sh b/defines/dev-images/populate-build-context.sh index 4452cb25df4..6552ccf52d1 100755 --- a/defines/dev-images/populate-build-context.sh +++ b/defines/dev-images/populate-build-context.sh @@ -30,7 +30,6 @@ TARGET_DIR="$(realpath "${1:-.}")" install-gnu-toolchain.sh \ install-openssl.sh \ install-patchelf.sh \ - install-pipenv.sh \ install-protobuf-cpp.sh \ install-python.sh \ install-rust-cargo.sh \ diff --git a/omd/Makefile b/omd/Makefile index 1da67428f76..f0e755bcc16 100644 --- a/omd/Makefile +++ b/omd/Makefile @@ -317,7 +317,6 @@ deb: debian/changelog debian/control --preserve-envvar="RUSTUP_HOME" \ --prepend-path $$HOME/.cargo/bin \ --prepend-path=/usr/local/bin \ - --prepend-path=`dirname $$(which pipenv)` \ --prepend-path=`dirname $$(which python3)` \ --set-envvar EDITION=$(EDITION) \ --no-lintian \ diff --git a/scripts/check-pytest-testmon b/scripts/check-pytest-testmon deleted file mode 100755 index 791d846c0cc..00000000000 --- a/scripts/check-pytest-testmon +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# This checks ALL tests, but on a second run only those -# which need to be run because the code they test has been -# changed or because they previously have failed. -if [ "$1" != "127" ]; then - set -e -o pipefail -fi - -REPO_PATH="$(git rev-parse --show-toplevel)" -PIPENV=pipenv - -pushd "$REPO_PATH"/tests >/dev/null -PIPENV_VENV_IN_PROJECT=true \ - PIPENV_NOSPIN=true \ - PIPENV_HIDE_EMOJIS=true \ - PIPENV_NO_INHERIT=true \ - PIPENV_PIPFILE="$REPO_PATH/Pipfile" \ - PIPENV_IGNORE_VIRTUALENVS=1 \ - PYTEST_ARGS=--testmon \ - $PIPENV run make test-unit -popd >/dev/null diff --git a/tests/pylint/checker_layering_violation.py b/tests/pylint/checker_layering_violation.py index 6c66ea2a9f2..c2de6b10eed 100644 --- a/tests/pylint/checker_layering_violation.py +++ b/tests/pylint/checker_layering_violation.py @@ -11,7 +11,7 @@ # real separate packages with their own setup.py files etc. # Test with: -# PYTHONPATH=. pipenv run python3 -m pylint --load-plugins=tests.testlib.pylint_checker_layering_violation --disable=all --enable=layering-violation cmk/{bi,ec,checkers,fields,notification_plugins,snmplib,utils} livestatus.py +# PYTHONPATH=. pylint --load-plugins=tests.testlib.pylint_checker_layering_violation --disable=all --enable=layering-violation cmk/{bi,ec,checkers,fields,notification_plugins,snmplib,utils} livestatus.py from __future__ import annotations