From a45aa528c5818b33336443bf8225b50c815687b8 Mon Sep 17 00:00:00 2001 From: Henry Borchers Date: Fri, 30 May 2025 10:32:28 -0500 Subject: [PATCH 1/2] ci: constrain dependency versions used --- vars/runJenkinsPipeline.groovy | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/vars/runJenkinsPipeline.groovy b/vars/runJenkinsPipeline.groovy index 659f82cbb..68a7128ab 100644 --- a/vars/runJenkinsPipeline.groovy +++ b/vars/runJenkinsPipeline.groovy @@ -150,8 +150,8 @@ def call(){ trap "rm -rf venv" EXIT . ./venv/bin/activate pip install --disable-pip-version-check uv - uvx --from sphinx --with-editable . --with-requirements requirements-dev.txt sphinx-build -W --keep-going -b html -d build/docs/.doctrees -w logs/build_sphinx_html.log docs/source build/docs/html - uvx --from sphinx --with-editable . --with-requirements requirements-dev.txt sphinx-build -W --keep-going -b latex -d build/docs/.doctrees docs/source build/docs/latex + uvx --constraint=requirements-dev.txt --from sphinx --with sphinx-argparse --with-editable . sphinx-build -W --keep-going -b html -d build/docs/.doctrees -w logs/build_sphinx_html.log docs/source build/docs/html + uvx --constraint=requirements-dev.txt --from sphinx --with sphinx-argparse --with-editable . sphinx-build -W --keep-going -b latex -d build/docs/.doctrees docs/source build/docs/latex ''') sh(label: 'Building PDF docs', script: '''make -C build/docs/latex @@ -482,7 +482,7 @@ def call(){ sh(script: 'python3 -m venv venv && venv/bin/pip install --disable-pip-version-check uv') envs = sh( label: 'Get tox environments', - script: './venv/bin/uvx --quiet --with tox-uv tox list -d --no-desc', + script: './venv/bin/uvx --constraint=requirements-dev.txt --quiet --with tox-uv tox list -d --no-desc', returnStdout: true, ).trim().split('\n') } finally{ @@ -514,7 +514,7 @@ def call(){ . ./venv/bin/activate uv python install cpython-${version} trap "rm -rf ./venv ./.tox" EXIT - uvx -p ${version} --with tox-uv tox run -e ${toxEnv} + uvx -p ${version} --constraint=requirements-dev.txt --with tox-uv tox run -e ${toxEnv} """ ) } @@ -560,7 +560,7 @@ def call(){ bat(script: 'python -m venv venv && venv\\Scripts\\pip install --disable-pip-version-check uv') envs = bat( label: 'Get tox environments', - script: '@.\\venv\\Scripts\\uvx --quiet --with tox-uv tox list -d --no-desc', + script: '@.\\venv\\Scripts\\uvx --quiet --constraint=requirements-dev.txt --with tox-uv tox list -d --no-desc', returnStdout: true, ).trim().split('\r\n') } @@ -589,7 +589,7 @@ def call(){ bat(label: 'Running Tox', script: """python -m venv venv && venv\\Scripts\\pip install --disable-pip-version-check uv venv\\Scripts\\uv python install cpython-${version} - venv\\Scripts\\uvx -p ${version} --with tox-uv tox run -e ${toxEnv} + venv\\Scripts\\uvx -p ${version} --constraint=requirements-dev.txt --with tox-uv tox run -e ${toxEnv} """ ) } @@ -706,7 +706,7 @@ def call(){ script: '''python3 -m venv venv && venv/bin/pip install --disable-pip-version-check uv trap "rm -rf venv" EXIT . ./venv/bin/activate - uvx --with $(grep \'^twine\' requirements-dev.txt) twine check --strict dist/* + uvx --constraint requirements-dev.txt twine check --strict dist/* ''' ) } @@ -767,7 +767,7 @@ def call(){ script: """python3 -m venv venv ./venv/bin/pip install --disable-pip-version-check uv ./venv/bin/uv python install cpython-${entry.PYTHON_VERSION} - ./venv/bin/uvx --with tox-uv tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')} + ./venv/bin/uvx --constraint=requirements-dev.txt --with tox-uv tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')} """ ) } @@ -785,7 +785,7 @@ def call(){ script: """python -m venv venv .\\venv\\Scripts\\pip install --disable-pip-version-check uv .\\venv\\Scripts\\uv python install cpython-${entry.PYTHON_VERSION} - .\\venv\\Scripts\\uvx --with tox-uv tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')} + .\\venv\\Scripts\\uvx --constraint=requirements-dev.txt --with tox-uv tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')} """ ) } @@ -797,7 +797,7 @@ def call(){ label: 'Testing with tox', script: """python3 -m venv venv ./venv/bin/pip install --disable-pip-version-check uv - ./venv/bin/uvx --with tox-uv tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')} + ./venv/bin/uvx --constraint=requirements-dev.txt --with tox-uv tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')} """ ) } else { @@ -806,7 +806,7 @@ def call(){ script: """python -m venv venv .\\venv\\Scripts\\pip install --disable-pip-version-check uv .\\venv\\Scripts\\uv python install cpython-${entry.PYTHON_VERSION} - .\\venv\\Scripts\\uvx --with tox-uv tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')} + .\\venv\\Scripts\\uvx --constraint=requirements-dev.txt --with tox-uv tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')} """ ) } @@ -892,7 +892,7 @@ def call(){ trap "rm -rf venv" EXIT . ./venv/bin/activate pip install --disable-pip-version-check uv - uvx --with $(grep \'^twine\' requirements-dev.txt) twine upload --disable-progress-bar --non-interactive dist/* + uvx --constraint=requirements-dev.txt twine upload --disable-progress-bar --non-interactive dist/* ''' ) } From 2ff14aa941e3e4aac5b5f39b98ff8e86ecedd07d Mon Sep 17 00:00:00 2001 From: Henry Borchers Date: Fri, 30 May 2025 11:35:03 -0500 Subject: [PATCH 2/2] ci: constrain dependency versions used by tox where appropriate --- tox.ini | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/tox.ini b/tox.ini index 393f6c729..22dd5e63b 100644 --- a/tox.ini +++ b/tox.ini @@ -3,13 +3,13 @@ envlist = py{39,310,311,312,313}-{PySide6,cli} isolated_build = true [tool:pytest] -;testpath = tests addopts = --verbose --faulthandler-timeout=10 [testenv] deps = pytest pytest-mock + -c requirements-dev.txt download=true commands = {env_bin_dir}{/}pytest --basetemp={envtmpdir} {env:pytest_args:} {posargs} @@ -23,15 +23,20 @@ set_env = QT_QPA_PLATFORM=offscreen download=true deps = - -r requirements-dev.txt - -r requirements-gui.txt + pytest + pytest-mock + PySide6 + pytest-qt + -c requirements-dev.txt + -c requirements-gui.txt commands = {env_bin_dir}{/}pytest --basetemp={envtmpdir} {env:pytest_args:} {posargs} - +extras = QT ; ======================== tests ======================== [testenv:docs] deps= sphinx sphinx-argparse + -c requirements-dev.txt commands= sphinx-build {env:sphinx_args:-W -b html -d "{envtmpdir}/doctrees" docs/source "{distdir}/html"} @@ -41,7 +46,7 @@ deps = lxml types-PyYAML types-requests - + -c requirements-dev.txt skip_install=True setenv = MYPY_CACHE_DIR = {temp_dir}/.mypy_cache commands = mypy {posargs: -p speedwagon} @@ -50,38 +55,40 @@ commands = mypy {posargs: -p speedwagon} description = check the code style deps = flake8 + -c requirements-dev.txt skip_install=True commands = flake8 {posargs: speedwagon} - [testenv:pylint] description = check the code style deps = pylint + -c requirements-dev.txt skip_install=True commands = pylint {posargs: speedwagon} --disable import-error - [testenv:doctest] -skip_install = true deps= sphinx sphinx-argparse - PyYAML - pluggy - -r requirements-vendor.txt + -c requirements-dev.txt commands = python -m sphinx -b doctest docs/source "{envtmpdir}/build/docs" -d "{envtmpdir}/build/docs/doctrees" + [testenv:pydocstyle] skip_install = true deps= pydocstyle toml + -c requirements-dev.txt commands = pydocstyle {posargs: {toxinidir}/speedwagon} + [testenv:bandit] skip_install = true deps= bandit + -c requirements-dev.txt + commands = bandit {posargs: --recursive {toxinidir}/speedwagon} @@ -89,5 +96,7 @@ commands = skip_install = true deps= ruff + -c requirements-dev.txt + commands = ruff check {posargs: {toxinidir}/speedwagon}