Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-13, windows-latest]
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']

os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v6
with:
Expand Down
22 changes: 15 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

Expand All @@ -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/*
Expand All @@ -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

Expand Down Expand Up @@ -58,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
Expand Down
8 changes: 6 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
'''
Expand All @@ -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}
'''
}
Expand All @@ -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}"
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<requirements.txt>`_.
Recommended (but optional) packages are listed in `<requirements_optional.txt>`_.
Expand Down
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion system_query/available_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions system_query/cpu_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class TestsLogging(Logging):
"""Test logging configuration."""

level_package = logging.DEBUG
level_global = logging.DEBUG


TestsLogging.configure()
Loading