Fix requirement for python3.12 (#16215)

* Fix pip version constraint for Python 3.12 compatibility

Remove outdated pip<22.0 constraint that was a workaround for
pip-tools#1558. This issue was fixed in pip-tools 6.5.0+ and
the old constraint breaks Python 3.12 where pkgutil.ImpImporter
was removed.

* Update requirements.txt

* Fix license file inconsistencies with requirements

- Rename awx-plugins.interfaces.txt to awx-plugins-interfaces.txt
  to match the package name in requirements
- Remove backports-tarfile.txt and importlib-resources.txt as these
  packages are no longer in requirements

* Fix updater.sh for pip 25.3 normalized output format

Changes to requirements_git.txt:
- Update to PEP 440 format (name @ git+url) to match pip-compile output
- Normalize package names (hyphens instead of dots/underscores)
- Sort extras alphabetically with hyphens (e.g., jwt-consumer not jwt_consumer)
- Add documentation explaining format requirements

Changes to updater.sh:
- Escape BRE regex metacharacters in sed pattern to handle brackets in extras
- Change sed delimiter from ! to | to avoid conflict with comment text
- Add explicit return statements to functions
- Assign positional parameters to local variables
- Redirect error messages to stderr
- Replace backticks with $() for command substitution
- Pin pip to version 25.3

requirements.txt regenerated via updater.sh

* Normalize package names in requirements.in to match pip output

- prometheus_client -> prometheus-client
- setuptools_scm -> setuptools-scm
- dispatcherd[pg_notify] -> dispatcherd[pg-notify]

PEP 503 specifies that package names should use hyphens.

* Fix license files to match normalized package names

- Remove awx_plugins.interfaces.txt (duplicate of awx-plugins-interfaces.txt)
- Rename system-certifi.txt to certifi.txt to match package name
This commit is contained in:
Hao Liu
2026-01-08 14:21:11 -05:00
committed by GitHub
parent 049a4b6438
commit 10a2946f9f
9 changed files with 57 additions and 453 deletions

View File

@@ -41,7 +41,7 @@ opentelemetry-sdk~=1.37
opentelemetry-instrumentation-logging
opentelemetry-exporter-otlp
pexpect
prometheus_client
prometheus-client
psycopg
psutil
pygerduty
@@ -66,11 +66,11 @@ uwsgitop
wheel>=0.38.1 # CVE-2022-40898
pip==25.3 # see UPGRADE BLOCKERs
setuptools==80.9.0 # see UPGRADE BLOCKERs
setuptools_scm[toml]
setuptools-scm[toml]
setuptools-rust>=0.11.4 # cryptography build dep
pkgconfig>=1.5.1 # xmlsec build dep - needed for offline build
django-flags>=5.0.13
dispatcherd[pg_notify] # tasking system, previously part of AWX code base
dispatcherd[pg-notify] # tasking system, previously part of AWX code base
protobuf>=4.25.8 # CVE-2025-4565
idna>=3.10 # CVE-2024-3651
# Temporarily added to use ansible-runner from git branch, to be removed

View File

@@ -18,7 +18,7 @@ aiosignal==1.4.0
# via aiohttp
ansi2html==1.9.2
# via -r /awx_devel/requirements/requirements.in
# git+https://github.com/ansible/ansible-runner.git@devel # git requirements installed separately
# ansible-runner @ git+https://github.com/ansible/ansible-runner.git@devel # git requirements installed separately
# via -r /awx_devel/requirements/requirements_git.txt
asgiref==3.11.0
# via
@@ -43,9 +43,9 @@ autocommand==2.2.2
# via jaraco-text
automat==25.4.16
# via twisted
# awx-plugins-core @ git+https://github.com/ansible/awx-plugins.git@devel # git requirements installed separately
# awx-plugins-core[credentials-github-app] @ git+https://github.com/ansible/awx-plugins.git@devel # git requirements installed separately
# via -r /awx_devel/requirements/requirements_git.txt
awx-plugins.interfaces @ git+https://github.com/ansible/awx_plugins.interfaces.git
# awx-plugins-interfaces @ git+https://github.com/ansible/awx_plugins.interfaces.git # git requirements installed separately
# via
# -r /awx_devel/requirements/requirements_git.txt
# awx-plugins-core
@@ -66,8 +66,6 @@ azure-keyvault-keys==4.11.0
# via azure-keyvault
azure-keyvault-secrets==4.10.0
# via azure-keyvault
backports-tarfile==1.2.0
# via jaraco-context
boto3==1.40.46
# via -r /awx_devel/requirements/requirements.in
botocore==1.40.46
@@ -79,7 +77,7 @@ brotli==1.1.0
# via aiohttp
cachetools==6.2.0
# via google-auth
# git+https://github.com/ansible/system-certifi.git@devel # git requirements installed separately
# certifi @ git+https://github.com/ansible/system-certifi.git@devel # git requirements installed separately
# via
# -r /awx_devel/requirements/requirements_git.txt
# kubernetes
@@ -118,7 +116,7 @@ cython==3.1.3
# via -r /awx_devel/requirements/requirements.in
daphne==4.2.1
# via -r /awx_devel/requirements/requirements.in
dispatcherd[pg_notify]==2025.12.12
dispatcherd[pg-notify]==2025.12.12
# via -r /awx_devel/requirements/requirements.in
distro==1.9.0
# via -r /awx_devel/requirements/requirements.in
@@ -136,7 +134,7 @@ django==5.2.8
# django-solo
# djangorestframework
# drf-spectacular
# django-ansible-base @ git+https://github.com/ansible/django-ansible-base@devel # git requirements installed separately
# django-ansible-base[feature-flags,jwt-consumer,rbac,resource-registry,rest-filters] @ git+https://github.com/ansible/django-ansible-base@devel # git requirements installed separately
# via -r /awx_devel/requirements/requirements_git.txt
django-cors-headers==4.9.0
# via -r /awx_devel/requirements/requirements.in
@@ -208,8 +206,6 @@ idna==3.10
# yarl
importlib-metadata==8.7.0
# via opentelemetry-api
importlib-resources==6.5.2
# via irc
incremental==24.7.2
# via twisted
inflection==0.5.1
@@ -362,7 +358,9 @@ protobuf==6.32.1
psutil==7.1.0
# via -r /awx_devel/requirements/requirements.in
psycopg==3.2.10
# via -r /awx_devel/requirements/requirements.in
# via
# -r /awx_devel/requirements/requirements.in
# dispatcherd
ptyprocess==0.7.0
# via pexpect
pyasn1==0.6.1

View File

@@ -1,5 +1,24 @@
git+https://github.com/ansible/system-certifi.git@devel#egg=certifi
git+https://github.com/ansible/ansible-runner.git@devel#egg=ansible-runner
awx-plugins-core @ git+https://github.com/ansible/awx-plugins.git@devel#egg=awx-plugins-core[credentials-github-app]
django-ansible-base @ git+https://github.com/ansible/django-ansible-base@devel#egg=django-ansible-base[rest-filters,jwt_consumer,resource-registry,rbac,feature-flags]
awx_plugins.interfaces @ git+https://github.com/ansible/awx_plugins.interfaces.git
# Git-based requirements - installed separately from requirements.txt
#
# IMPORTANT: Use PEP 440 format that matches pip-compile's normalized output:
# name @ git+https://github.com/org/repo.git@branch
#
# Format rules:
# - Package name MUST match pip's normalized form (hyphens, not dots/underscores)
# - Extras go in the package name: pkg[extra1,extra2] @ git+...
# - Extras MUST be sorted alphabetically and use hyphens (not underscores)
# - Do NOT use the legacy #egg=name format
#
# Example:
# WRONG: git+https://github.com/org/repo.git@devel#egg=my-package[foo,bar]
# WRONG: my_package[bar,foo] @ git+https://github.com/org/repo.git@devel
# RIGHT: my-package[bar,foo] @ git+https://github.com/org/repo.git@devel
#
# updater.sh uses these lines to comment out matching entries in requirements.txt
# so they are not installed twice (once from git, once from PyPI).
#
certifi @ git+https://github.com/ansible/system-certifi.git@devel
ansible-runner @ git+https://github.com/ansible/ansible-runner.git@devel
awx-plugins-core[credentials-github-app] @ git+https://github.com/ansible/awx-plugins.git@devel
django-ansible-base[feature-flags,jwt-consumer,rbac,resource-registry,rest-filters] @ git+https://github.com/ansible/django-ansible-base@devel
awx-plugins-interfaces @ git+https://github.com/ansible/awx_plugins.interfaces.git

View File

@@ -11,32 +11,39 @@ sanitize_git="1"
_cleanup() {
cd /
test "${KEEP_TMP:-0}" = 1 || rm -rf "${_tmp}"
return 0
}
generate_requirements() {
venv="`pwd`/venv"
echo $venv
local input_reqs="$1"
venv="$(pwd)/venv"
echo "$venv"
/usr/bin/python3.12 -m venv "${venv}"
# shellcheck disable=SC1090
source ${venv}/bin/activate
source "${venv}/bin/activate"
# FIXME: https://github.com/jazzband/pip-tools/issues/1558
${venv}/bin/python3 -m pip install -U 'pip<22.0' pip-tools
# pip version must match the version used in AWX venv (see README.md UPGRADE BLOCKERs)
"${venv}/bin/python3" -m pip install -U 'pip==25.3' pip-tools
${pip_compile} $1 --output-file requirements.txt
${pip_compile} ${input_reqs} --output-file requirements.txt
# consider the git requirements for purposes of resolving deps
# Then comment out any git+ lines from requirements.txt
if [[ "$sanitize_git" == "1" ]] ; then
while IFS= read -r line; do
if [[ $line != \#* ]]; then # ignore lines which are already comments
# Escape regex special characters for the search pattern
# Only escape BRE metacharacters: . * ^ $ [ \
escaped_pattern=$(printf '%s\n' "${line%#*}" | sed 's/[[\.*^$]/\\&/g')
# Add # to the start of any line matched
sed -i "s!^.*${line%#*}!# ${line%#*} # git requirements installed separately!g" requirements.txt
sed -i "s|^.*${escaped_pattern}|# ${line%#*} # git requirements installed separately|g" requirements.txt
fi
done < "${requirements_git}"
fi;
return 0
}
main() {
local command="${1:-}"
base_dir=$(pwd)
dest_requirements="${requirements}"
input_requirements="${requirements_in} ${requirements_git}"
@@ -45,7 +52,7 @@ main() {
trap _cleanup INT TERM EXIT
case $1 in
case "${command}" in
"run")
NEEDS_HELP=0
;;
@@ -63,9 +70,9 @@ main() {
NEEDS_HELP=1
;;
*)
echo ""
echo "ERROR: Parameter $1 not valid"
echo ""
echo "" >&2
echo "ERROR: Parameter ${command} not valid" >&2
echo "" >&2
NEEDS_HELP=1
;;
esac
@@ -86,13 +93,13 @@ main() {
fi
if [[ ! -d /awx_devel ]] ; then
echo "This script should be run inside the awx container"
echo "This script should be run inside the awx container" >&2
exit
fi
if [[ ! -z "$(tail -c 1 "${requirements_git}")" ]]
then
echo "No newline at end of ${requirements_git}, please add one"
echo "No newline at end of ${requirements_git}, please add one" >&2
exit
fi
@@ -105,6 +112,7 @@ main() {
cat requirements.txt | sed "s:$base_dir:/awx_devel/requirements:" > "${dest_requirements}"
_cleanup
return 0
}
# set EVAL=1 in case you want to source this script