From 19c5fde11d7bfb5b13f7c9327a344dd460c09e9b Mon Sep 17 00:00:00 2001 From: Mateusz Bysiek <1270332+mbdevpl@users.noreply.github.com> Date: Wed, 3 Jun 2026 17:58:21 +0900 Subject: [PATCH 1/9] build: use current macos images when possible --- .github/workflows/python.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 11159b6..5e1156c 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -11,9 +11,13 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-13, windows-latest] + os: [ubuntu-latest, macos-latest, windows-latest] python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] - + exclude: + - os: macos-latest + python-version: '3.9' + - os: macos-latest + python-version: '3.10' steps: - uses: actions/checkout@v6 with: From 40b1cb676ca6fb8b8a6d87c2156a57885fdf0fe1 Mon Sep 17 00:00:00 2001 From: Mateusz Bysiek <1270332+mbdevpl@users.noreply.github.com> Date: Wed, 3 Jun 2026 18:09:04 +0900 Subject: [PATCH 2/9] build: use latest cuda image --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 10b05fa..254cad6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -ARG CUDA_VERSION="11.7.1" +ARG CUDA_VERSION="13.2.1" -FROM nvidia/cuda:${CUDA_VERSION}-devel-ubuntu22.04 +FROM nvidia/cuda:${CUDA_VERSION}-devel-ubuntu24.04 SHELL ["/bin/bash", "-c"] From b52a97ab44a250dac769441d37008723b467276d Mon Sep 17 00:00:00 2001 From: Mateusz Bysiek <1270332+mbdevpl@users.noreply.github.com> Date: Wed, 3 Jun 2026 18:15:40 +0900 Subject: [PATCH 3/9] build: use more robust timezone setup --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 254cad6..0edbb65 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,8 +12,8 @@ RUN set -Eeuxo pipefail && \ apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ tzdata && \ - echo "${TIMEZONE}" > /etc/timezone && \ - cp "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime && \ + echo "${TIMEZONE}" > "/etc/timezone" && \ + ln -nfs "/usr/share/zoneinfo/${TIMEZONE}" "/etc/localtime" && \ apt-get -qy autoremove && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* From d1b8881d9fbce6e550bee8e4b91e631d4d8b429c Mon Sep 17 00:00:00 2001 From: Mateusz Bysiek <1270332+mbdevpl@users.noreply.github.com> Date: Wed, 3 Jun 2026 18:36:23 +0900 Subject: [PATCH 4/9] test: logging level was not applied correctly in tests --- test/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/__init__.py b/test/__init__.py index 7bce5d2..3aad969 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -8,7 +8,7 @@ class TestsLogging(Logging): """Test logging configuration.""" - level_package = logging.DEBUG + level_global = logging.DEBUG TestsLogging.configure() From 88f2a11c509fcfa84186325b7881361b4325cfab Mon Sep 17 00:00:00 2001 From: Mateusz Bysiek <1270332+mbdevpl@users.noreply.github.com> Date: Wed, 3 Jun 2026 18:36:54 +0900 Subject: [PATCH 5/9] fix: properly check for unitless values in modern pint --- system_query/cpu_info.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/system_query/cpu_info.py b/system_query/cpu_info.py index 79b63f1..424ba51 100644 --- a/system_query/cpu_info.py +++ b/system_query/cpu_info.py @@ -53,6 +53,9 @@ def _get_cache_size(level: int, cpuinfo_data: dict) -> t.Optional[int]: value = ureg(raw_value) if isinstance(value, int): return value * 1024 + assert isinstance(value, pint.Quantity), (type(value), value) + if value.units == ureg('1').units: + return value.magnitude * 1024 _LOG.debug('L%i cache size parsed by pint: "%s" -> %s', level, raw_value, value) value = value.to('bytes') return int(value.magnitude) From 8e849472a5e16115fb712735d2c475270cb4da0d Mon Sep 17 00:00:00 2001 From: Mateusz Bysiek <1270332+mbdevpl@users.noreply.github.com> Date: Wed, 3 Jun 2026 19:01:12 +0900 Subject: [PATCH 6/9] build: ensure pre-existing user and groups don't get in the way --- Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0edbb65..28dcbfc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,10 +25,12 @@ ARG GROUP_ID=1000 ARG AUX_GROUP_IDS="" RUN set -Eeuxo pipefail && \ - (addgroup --gid "${GROUP_ID}" user || echo "group ${GROUP_ID} already exists, so not adding it") && \ - adduser --disabled-password --gecos "User" --uid "${USER_ID}" --gid "${GROUP_ID}" user && \ + if id "${USER_ID}" >/dev/null 2>&1; then deluser $(id -un "${USER_ID}"); fi && \ + if getent group "${GROUP_ID}" >/dev/null 2>&1; then delgroup $(getent group "${GROUP_ID}" | cut -d: -f1); fi && \ + addgroup --gid "${GROUP_ID}" "user" && \ + adduser --disabled-password --gecos "User" --uid "${USER_ID}" --gid "${GROUP_ID}" "user" && \ echo ${AUX_GROUP_IDS} | xargs -n1 echo | xargs -I% addgroup --gid % group% && \ - echo ${AUX_GROUP_IDS} | xargs -n1 echo | xargs -I% usermod --append --groups group% user + echo ${AUX_GROUP_IDS} | xargs -n1 echo | xargs -I% usermod --append --groups group% "user" # install dependencies From 7be8b38dca8c084d168d17a59856436c3af48149 Mon Sep 17 00:00:00 2001 From: Mateusz Bysiek <1270332+mbdevpl@users.noreply.github.com> Date: Wed, 3 Jun 2026 19:13:00 +0900 Subject: [PATCH 7/9] build: create venv --- Dockerfile | 6 ++++++ Jenkinsfile | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 28dcbfc..7819a6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,11 +60,17 @@ WORKDIR /home/user/system-query COPY --chown=${USER_ID}:${GROUP_ID} requirements*.txt ./ +USER user + RUN set -Eeuxo pipefail && \ + python3 -m venv --prompt "$(basename ${PWD})" /home/user/venv && \ + source /home/user/venv/bin/activate && \ pip3 install --no-cache-dir -r requirements_ci.txt # add user to sudoers +USER root + RUN set -Eeuxo pipefail && \ usermod --append --groups sudo user && \ echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers diff --git a/Jenkinsfile b/Jenkinsfile index 1562f8a..eef8411 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,6 +30,7 @@ pipeline { steps { sh """#!/usr/bin/env bash set -Eeux + source /home/user/venv/bin/activate python3 -m pylint ${PYTHON_MODULES} |& tee pylint.log echo "\${PIPESTATUS[0]}" | tee pylint_status.log python3 -m mypy ${PYTHON_MODULES} |& tee mypy.log @@ -48,6 +49,7 @@ pipeline { steps { sh '''#!/usr/bin/env bash set -Eeuxo pipefail + source /home/user/venv/bin/activate python3 -m coverage run --branch --source . -m unittest -v pip3 install --no-cache-dir -r requirements_all.txt python3 -m coverage run --append --branch --source . -m unittest -v @@ -60,6 +62,7 @@ pipeline { steps { sh '''#!/usr/bin/env bash set -Eeux + source /home/user/venv/bin/activate python3 -m coverage report --show-missing |& tee coverage.log echo "${PIPESTATUS[0]}" | tee coverage_status.log ''' @@ -80,6 +83,7 @@ pipeline { steps { sh '''#!/usr/bin/env bash set -Eeuxo pipefail + source /home/user/venv/bin/activate python3 -m codecov --token ${CODECOV_TOKEN} ''' } @@ -93,7 +97,7 @@ pipeline { } } environment { - VERSION = sh(script: 'python3 -m version_query --predict .', returnStdout: true).trim() + VERSION = sh(script: 'source /home/user/venv/bin/activate && python3 -m version_query --predict .', returnStdout: true).trim() PYPI_AUTH = credentials('mbdev-pypi-auth') TWINE_USERNAME = "${PYPI_AUTH_USR}" TWINE_PASSWORD = "${PYPI_AUTH_PSW}" @@ -114,7 +118,7 @@ pipeline { buildingTag() } environment { - VERSION = sh(script: 'python3 -m version_query .', returnStdout: true).trim() + VERSION = sh(script: 'source /home/user/venv/bin/activate && python3 -m version_query .', returnStdout: true).trim() } steps { script { From 74764b969703d05cf0600a554b5a73f015ed997d Mon Sep 17 00:00:00 2001 From: Mateusz Bysiek <1270332+mbdevpl@users.noreply.github.com> Date: Wed, 3 Jun 2026 19:30:27 +0900 Subject: [PATCH 8/9] fix: better recognise not supporting CPU clock querying --- system_query/available_features.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system_query/available_features.py b/system_query/available_features.py index 8e53531..090251d 100644 --- a/system_query/available_features.py +++ b/system_query/available_features.py @@ -28,7 +28,7 @@ psutil = None # type: ignore _LOG.info("unable to import package psutil", exc_info=True) -CPU_CLOCK = psutil is not None +CPU_CLOCK = psutil is not None and hasattr(psutil, 'cpu_freq') CPU_CORES = psutil is not None _GPU_FAILED = False From 24986527e629bfb24c18682327adec15c60b5b17 Mon Sep 17 00:00:00 2001 From: Mateusz Bysiek <1270332+mbdevpl@users.noreply.github.com> Date: Wed, 3 Jun 2026 19:37:13 +0900 Subject: [PATCH 9/9] chore: drop Python 3.9 and 3.10 --- .github/workflows/python.yml | 7 +------ README.rst | 2 +- setup.py | 2 -- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 5e1156c..b1c643c 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -12,12 +12,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] - exclude: - - os: macos-latest - python-version: '3.9' - - os: macos-latest - python-version: '3.10' + python-version: ['3.11', '3.12', '3.13'] steps: - uses: actions/checkout@v6 with: diff --git a/README.rst b/README.rst index 03df200..b973c12 100644 --- a/README.rst +++ b/README.rst @@ -337,7 +337,7 @@ Please use ``-h`` to see usage information: Requirements ============ -Python version 3.9 or later. +Python version 3.11 or later. Python libraries as specified in ``_. Recommended (but optional) packages are listed in ``_. diff --git a/setup.py b/setup.py index 511ec99..631ad82 100644 --- a/setup.py +++ b/setup.py @@ -20,8 +20,6 @@ class Package(boilerplates.setup.Package): 'Operating System :: MacOS', 'Operating System :: Microsoft :: Windows', 'Operating System :: POSIX :: Linux', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: 3.13',