Skip to content

feat: add UV to python feature #1324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion src/python/devcontainer-feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"toolsToInstall": {
"type": "string",
"default": "flake8,autopep8,black,yapf,mypy,pydocstyle,pycodestyle,bandit,pipenv,virtualenv,pytest,pylint",
"default": "flake8,autopep8,black,yapf,mypy,pydocstyle,pycodestyle,bandit,pipenv,virtualenv,pytest,pylint,uv",
"description": "Comma-separated list of tools to install when 'installTools' is true. Defaults to a set of common Python tools like pylint."
},
"optimize": {
Expand Down
2 changes: 1 addition & 1 deletion src/python/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ CONFIGURE_JUPYTERLAB_ALLOW_ORIGIN="${CONFIGUREJUPYTERLABALLOWORIGIN:-""}"
ADDITIONAL_VERSIONS="${ADDITIONALVERSIONS:-""}"

# Comma-separated list of additional tools to be installed via pipx.
IFS="," read -r -a DEFAULT_UTILS <<< "${TOOLSTOINSTALL:-flake8,autopep8,black,yapf,mypy,pydocstyle,pycodestyle,bandit,pipenv,virtualenv,pytest}"
IFS="," read -r -a DEFAULT_UTILS <<< "${TOOLSTOINSTALL:-flake8,autopep8,black,yapf,mypy,pydocstyle,pycodestyle,bandit,pipenv,virtualenv,pytest,uv}"

PYTHON_SOURCE_GPG_KEYS="64E628F8D684696D B26995E310250568 2D347EA6AA65421D FB9921286F5E1540 3A5CA953F73C700D 04C367C218ADD4FF 0EDDC5F26A45C816 6AF053F07D9DC8D2 C9BE28DEE6DF025C 126EB563A74B06BF D9866941EA5BBD71 ED9D77D5 A821E680E5FA6305"

Expand Down
2 changes: 2 additions & 0 deletions test/python/alma-8-minimal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ check "pycodestyle" pycodestyle --version
check "pydocstyle" pydocstyle --version
check "pylint" pylint --version
check "pytest" pytest --version
check "uv" uv --version

# Check paths in settings
check "current symlink is correct" bash -c "which python | grep /usr/local/python/current/bin/python"
Expand All @@ -35,6 +36,7 @@ check "which pycodestyle" bash -c "which pycodestyle | grep /usr/local/py-utils/
check "which pydocstyle" bash -c "which pydocstyle | grep /usr/local/py-utils/bin/pydocstyle"
check "which pylint" bash -c "which pylint | grep /usr/local/py-utils/bin/pylint"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"

# Report result
reportResults
2 changes: 2 additions & 0 deletions test/python/alma-8.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ check "pycodestyle" pycodestyle --version
check "pydocstyle" pydocstyle --version
check "pylint" pylint --version
check "pytest" pytest --version
check "uv" uv --version

# Check paths in settings
check "current symlink is correct" bash -c "which python | grep /usr/local/python/current/bin/python"
Expand All @@ -35,6 +36,7 @@ check "which pycodestyle" bash -c "which pycodestyle | grep /usr/local/py-utils/
check "which pydocstyle" bash -c "which pydocstyle | grep /usr/local/py-utils/bin/pydocstyle"
check "which pylint" bash -c "which pylint | grep /usr/local/py-utils/bin/pylint"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"

# Report result
reportResults
2 changes: 2 additions & 0 deletions test/python/alma-9-minimal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ check "pycodestyle" pycodestyle --version
check "pydocstyle" pydocstyle --version
check "pylint" pylint --version
check "pytest" pytest --version
check "uv" uv --version

# Check paths in settings
check "current symlink is correct" bash -c "which python | grep /usr/local/python/current/bin/python"
Expand All @@ -35,6 +36,7 @@ check "which pycodestyle" bash -c "which pycodestyle | grep /usr/local/py-utils/
check "which pydocstyle" bash -c "which pydocstyle | grep /usr/local/py-utils/bin/pydocstyle"
check "which pylint" bash -c "which pylint | grep /usr/local/py-utils/bin/pylint"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"

# Report result
reportResults
2 changes: 2 additions & 0 deletions test/python/alma-9.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ check "pycodestyle" pycodestyle --version
check "pydocstyle" pydocstyle --version
check "pylint" pylint --version
check "pytest" pytest --version
check "uv" uv --version

# Check paths in settings
check "current symlink is correct" bash -c "which python | grep /usr/local/python/current/bin/python"
Expand All @@ -35,6 +36,7 @@ check "which pycodestyle" bash -c "which pycodestyle | grep /usr/local/py-utils/
check "which pydocstyle" bash -c "which pydocstyle | grep /usr/local/py-utils/bin/pydocstyle"
check "which pylint" bash -c "which pylint | grep /usr/local/py-utils/bin/pylint"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"

# Report result
reportResults
2 changes: 2 additions & 0 deletions test/python/centos-7.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ check "pycodestyle" pycodestyle --version
check "pydocstyle" pydocstyle --version
check "pylint" pylint --version
check "pytest" pytest --version
check "uv" uv --version

# Check paths in settings
check "current symlink is correct" bash -c "which python | grep /usr/local/python/current/bin/python"
Expand All @@ -35,6 +36,7 @@ check "which pycodestyle" bash -c "which pycodestyle | grep /usr/local/py-utils/
check "which pydocstyle" bash -c "which pydocstyle | grep /usr/local/py-utils/bin/pydocstyle"
check "which pylint" bash -c "which pylint | grep /usr/local/py-utils/bin/pylint"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"

# Report result
reportResults
2 changes: 2 additions & 0 deletions test/python/fedora.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ check "pycodestyle" pycodestyle --version
check "pydocstyle" pydocstyle --version
check "pylint" pylint --version
check "pytest" pytest --version
check "uv" uv --version

# Check paths in settings
check "current symlink is correct" bash -c "which python | grep /usr/local/python/current/bin/python"
Expand All @@ -35,6 +36,7 @@ check "which pycodestyle" bash -c "which pycodestyle | grep /usr/local/py-utils/
check "which pydocstyle" bash -c "which pydocstyle | grep /usr/local/py-utils/bin/pydocstyle"
check "which pylint" bash -c "which pylint | grep /usr/local/py-utils/bin/pylint"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"

# Report result
reportResults
2 changes: 2 additions & 0 deletions test/python/install_additional_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ check "pycodestyle" pycodestyle --version
check "pydocstyle" pydocstyle --version
check "pylint" pylint --version
check "pytest" pytest --version
check "uv" uv --version

# Check paths in settings
check "current symlink is correct" bash -c "which python | grep /usr/local/python/current/bin/python"
Expand All @@ -36,6 +37,7 @@ check "which pycodestyle" bash -c "which pycodestyle | grep /usr/local/py-utils/
check "which pydocstyle" bash -c "which pydocstyle | grep /usr/local/py-utils/bin/pydocstyle"
check "which pylint" bash -c "which pylint | grep /usr/local/py-utils/bin/pylint"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"

# Report result
reportResults
2 changes: 2 additions & 0 deletions test/python/install_additional_python_rhel_family.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ check "pycodestyle" pycodestyle --version
check "pydocstyle" pydocstyle --version
check "pylint" pylint --version
check "pytest" pytest --version
check "uv" uv --version

# Check paths in settings
check "current symlink is correct" bash -c "which python | grep /usr/local/python/current/bin/python"
Expand All @@ -36,6 +37,7 @@ check "which pycodestyle" bash -c "which pycodestyle | grep /usr/local/py-utils/
check "which pydocstyle" bash -c "which pydocstyle | grep /usr/local/py-utils/bin/pydocstyle"
check "which pylint" bash -c "which pylint | grep /usr/local/py-utils/bin/pylint"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"

# Report result
reportResults
2 changes: 2 additions & 0 deletions test/python/install_alternate_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ check "bandit" bandit --version
check "mypy" mypy --version
check "pipenv" pipenv --version
check "pytest" pytest --version
check "uv" uv --version
check "ruff" ruff --version
check "virtualenv" virtualenv --version

Expand All @@ -25,6 +26,7 @@ check "which bandit" bash -c "which bandit | grep /usr/local/py-utils/bin/bandit
check "which mypy" bash -c "which mypy | grep /usr/local/py-utils/bin/mypy"
check "which pipenv" bash -c "which pipenv | grep /usr/local/py-utils/bin/pipenv"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"
check "which ruff" bash -c "which ruff | grep /usr/local/py-utils/bin/ruff"
check "which virtualenv" bash -c "which virtualenv | grep /usr/local/py-utils/bin/virtualenv"

Expand Down
2 changes: 2 additions & 0 deletions test/python/install_alternate_tools_rhel_family.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ check "bandit" bandit --version
check "mypy" mypy --version
check "pipenv" pipenv --version
check "pytest" pytest --version
check "uv" uv --version
check "ruff" ruff --version
check "virtualenv" virtualenv --version

Expand All @@ -25,6 +26,7 @@ check "which bandit" bash -c "which bandit | grep /usr/local/py-utils/bin/bandit
check "which mypy" bash -c "which mypy | grep /usr/local/py-utils/bin/mypy"
check "which pipenv" bash -c "which pipenv | grep /usr/local/py-utils/bin/pipenv"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"
check "which ruff" bash -c "which ruff | grep /usr/local/py-utils/bin/ruff"
check "which virtualenv" bash -c "which virtualenv | grep /usr/local/py-utils/bin/virtualenv"

Expand Down
2 changes: 2 additions & 0 deletions test/python/install_os_provided_python_deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ check "pycodestyle" pycodestyle --version
check "pydocstyle" pydocstyle --version
check "pylint" pylint --version
check "pytest" pytest --version
check "uv" uv --version

# Check paths in settings
check "current symlink is correct" bash -c "which python | grep /usr/local/python/current/bin/python"
Expand All @@ -35,6 +36,7 @@ check "which pycodestyle" bash -c "which pycodestyle | grep /usr/local/py-utils/
check "which pydocstyle" bash -c "which pydocstyle | grep /usr/local/py-utils/bin/pydocstyle"
check "which pylint" bash -c "which pylint | grep /usr/local/py-utils/bin/pylint"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"

# Report result
reportResults
2 changes: 2 additions & 0 deletions test/python/install_os_provided_python_mariner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ check "pycodestyle" pycodestyle --version
check "pydocstyle" pydocstyle --version
check "pylint" pylint --version
check "pytest" pytest --version
check "uv" uv --version

# Check paths in settings
check "current symlink is correct" bash -c "which python | grep /usr/local/python/current/bin/python"
Expand All @@ -35,6 +36,7 @@ check "which pycodestyle" bash -c "which pycodestyle | grep /usr/local/py-utils/
check "which pydocstyle" bash -c "which pydocstyle | grep /usr/local/py-utils/bin/pydocstyle"
check "which pylint" bash -c "which pylint | grep /usr/local/py-utils/bin/pylint"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"

# Report result
reportResults
2 changes: 2 additions & 0 deletions test/python/install_os_provided_python_rhel_family.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ check "pycodestyle" pycodestyle --version
check "pydocstyle" pydocstyle --version
check "pylint" pylint --version
check "pytest" pytest --version
check "uv" uv --version

# Check paths in settings
check "current symlink is correct" bash -c "which python | grep /usr/local/python/current/bin/python"
Expand All @@ -35,6 +36,7 @@ check "which pycodestyle" bash -c "which pycodestyle | grep /usr/local/py-utils/
check "which pydocstyle" bash -c "which pydocstyle | grep /usr/local/py-utils/bin/pydocstyle"
check "which pylint" bash -c "which pylint | grep /usr/local/py-utils/bin/pylint"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"

# Report result
reportResults
2 changes: 2 additions & 0 deletions test/python/install_python310_setuptools_vulnerability.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ check "pycodestyle" pycodestyle --version
check "pydocstyle" pydocstyle --version
check "pylint" pylint --version
check "pytest" pytest --version
check "uv" uv --version
check "setuptools" pip list | grep setuptools

# Check paths in settings
Expand All @@ -63,6 +64,7 @@ check "which pycodestyle" bash -c "which pycodestyle | grep /usr/local/py-utils/
check "which pydocstyle" bash -c "which pydocstyle | grep /usr/local/py-utils/bin/pydocstyle"
check "which pylint" bash -c "which pylint | grep /usr/local/py-utils/bin/pylint"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"

checkVulnerableFile_OR_DIR()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ check "pycodestyle" pycodestyle --version
check "pydocstyle" pydocstyle --version
check "pylint" pylint --version
check "pytest" pytest --version
check "uv" uv --version
check "setuptools" pip list | grep setuptools

# Check paths in settings
Expand All @@ -63,6 +64,7 @@ check "which pycodestyle" bash -c "which pycodestyle | grep /usr/local/py-utils/
check "which pydocstyle" bash -c "which pydocstyle | grep /usr/local/py-utils/bin/pydocstyle"
check "which pylint" bash -c "which pylint | grep /usr/local/py-utils/bin/pylint"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"

HL="\033[1;33m"
N="\033[0;37m"
Expand Down
2 changes: 2 additions & 0 deletions test/python/install_python311_setuptools_vulnerability.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ check "pycodestyle" pycodestyle --version
check "pydocstyle" pydocstyle --version
check "pylint" pylint --version
check "pytest" pytest --version
check "uv" uv --version
check "setuptools" pip list | grep setuptools

# Check paths in settings
Expand All @@ -64,6 +65,7 @@ check "which pycodestyle" bash -c "which pycodestyle | grep /usr/local/py-utils/
check "which pydocstyle" bash -c "which pydocstyle | grep /usr/local/py-utils/bin/pydocstyle"
check "which pylint" bash -c "which pylint | grep /usr/local/py-utils/bin/pylint"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"

checkVulnerableFile_OR_DIR()
{
Expand Down
2 changes: 2 additions & 0 deletions test/python/install_python_3_12.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ check "pycodestyle" pycodestyle --version
check "pydocstyle" pydocstyle --version
check "pylint" pylint --version
check "pytest" pytest --version
check "uv" uv --version

# Check paths in settings
check "current symlink is correct" bash -c "which python | grep /usr/local/python/current/bin/python"
Expand All @@ -33,6 +34,7 @@ check "which pycodestyle" bash -c "which pycodestyle | grep /usr/local/py-utils/
check "which pydocstyle" bash -c "which pydocstyle | grep /usr/local/py-utils/bin/pydocstyle"
check "which pylint" bash -c "which pylint | grep /usr/local/py-utils/bin/pylint"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"

# Report result
reportResults
2 changes: 2 additions & 0 deletions test/python/install_python_shared_lib_deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ check "pycodestyle" pycodestyle --version
check "pydocstyle" pydocstyle --version
check "pylint" pylint --version
check "pytest" pytest --version
check "uv" uv --version

# Check paths in settings
check "current symlink is correct" bash -c "which python | grep /usr/local/python/current/bin/python"
Expand All @@ -35,6 +36,7 @@ check "which pycodestyle" bash -c "which pycodestyle | grep /usr/local/py-utils/
check "which pydocstyle" bash -c "which pydocstyle | grep /usr/local/py-utils/bin/pydocstyle"
check "which pylint" bash -c "which pylint | grep /usr/local/py-utils/bin/pylint"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"

# Check compiled with "--enable-shared" -- python truth is opposite of the shells
# therefore we negate the check to get a '0' exit code when the python
Expand Down
2 changes: 2 additions & 0 deletions test/python/install_python_shared_lib_rhel_family.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ check "pycodestyle" pycodestyle --version
check "pydocstyle" pydocstyle --version
check "pylint" pylint --version
check "pytest" pytest --version
check "uv" uv --version

# Check paths in settings
check "current symlink is correct" bash -c "which python | grep /usr/local/python/current/bin/python"
Expand All @@ -35,6 +36,7 @@ check "which pycodestyle" bash -c "which pycodestyle | grep /usr/local/py-utils/
check "which pydocstyle" bash -c "which pydocstyle | grep /usr/local/py-utils/bin/pydocstyle"
check "which pylint" bash -c "which pylint | grep /usr/local/py-utils/bin/pylint"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"

# Check compiled with "--enable-shared" -- python truth is opposite of the shells
# therefore we negate the check to get a '0' exit code when the python
Expand Down
2 changes: 2 additions & 0 deletions test/python/install_via_oryx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ check "pycodestyle" pycodestyle --version
check "pydocstyle" pydocstyle --version
check "pylint" pylint --version
check "pytest" pytest --version
check "uv" uv --version

# Check paths in settings
check "current symlink is correct" bash -c "which python | grep /usr/local/python/current/bin/python"
Expand All @@ -35,6 +36,7 @@ check "which pycodestyle" bash -c "which pycodestyle | grep /usr/local/py-utils/
check "which pydocstyle" bash -c "which pydocstyle | grep /usr/local/py-utils/bin/pydocstyle"
check "which pylint" bash -c "which pylint | grep /usr/local/py-utils/bin/pylint"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"

# Report result
reportResults
4 changes: 2 additions & 2 deletions test/python/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
"features": {
"python": {
"version": "3.12",
"toolsToInstall": "ruff,mypy,bandit,pipenv,virtualenv,pytest"
"toolsToInstall": "ruff,mypy,bandit,pipenv,virtualenv,pytest,uv"
}
}
},
Expand All @@ -186,7 +186,7 @@
"features": {
"python": {
"version": "3.12",
"toolsToInstall": "ruff,mypy,bandit,pipenv,virtualenv,pytest"
"toolsToInstall": "ruff,mypy,bandit,pipenv,virtualenv,pytest,uv"
}
}
},
Expand Down
2 changes: 2 additions & 0 deletions test/python/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ check "pycodestyle" pycodestyle --version
check "pydocstyle" pydocstyle --version
check "pylint" pylint --version
check "pytest" pytest --version
check "uv" uv --version

# Check paths in settings
check "current symlink is correct" bash -c "which python | grep /usr/local/python/current/bin/python"
Expand All @@ -35,6 +36,7 @@ check "which pycodestyle" bash -c "which pycodestyle | grep /usr/local/py-utils/
check "which pydocstyle" bash -c "which pydocstyle | grep /usr/local/py-utils/bin/pydocstyle"
check "which pylint" bash -c "which pylint | grep /usr/local/py-utils/bin/pylint"
check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest"
check "which uv" bash -c "which uv | grep /usr/local/py-utils/bin/uv"

# Report result
reportResults