Skip to content

Commit

Permalink
Purge pipenv (almost) completley
Browse files Browse the repository at this point in the history
we still use it on the windows machines tho

Change-Id: I2b0dc22be52745791e12839281c22477f4dec1f1
JIRA-Ref: CMK-20868
  • Loading branch information
TimotheusBachinger committed Jan 9, 2025
1 parent 0eb0c75 commit 6ea0d74
Show file tree
Hide file tree
Showing 21 changed files with 5 additions and 135 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
12 changes: 1 addition & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 $@

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bandit.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions buildscripts/infrastructure/build-nodes/debian-11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions buildscripts/infrastructure/build-nodes/debian-12/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,13 @@ 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
export NEXUS_ARCHIVES_URL="https://artifacts.lan.tribe29.com/repository/archives/"
export BRANCH_NAME
export BRANCH_VERSION
export CLANG_VERSION
export PIPENV_VERSION
export VIRTUALENV_VERSION
export DISTRO_NAME
export VERSION_NUMBER
Expand All @@ -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"
}
Expand Down Expand Up @@ -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"
Expand Down
40 changes: 0 additions & 40 deletions buildscripts/infrastructure/build-nodes/scripts/install-pipenv.sh

This file was deleted.

21 changes: 0 additions & 21 deletions buildscripts/infrastructure/build-nodes/scripts/install-pyenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."

Expand Down Expand Up @@ -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
3 changes: 0 additions & 3 deletions buildscripts/infrastructure/build-nodes/sles-15sp3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions buildscripts/infrastructure/build-nodes/sles-15sp4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions buildscripts/infrastructure/build-nodes/sles-15sp5/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions buildscripts/infrastructure/build-nodes/sles-15sp6/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion defines.make
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion defines/dev-images/populate-build-context.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
1 change: 0 additions & 1 deletion omd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
22 changes: 0 additions & 22 deletions scripts/check-pytest-testmon

This file was deleted.

2 changes: 1 addition & 1 deletion tests/pylint/checker_layering_violation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 6ea0d74

Please sign in to comment.