From 0c67b5bbff984603ea344a42c45003561a20bc3a Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 27 Aug 2024 17:28:17 +0000 Subject: [PATCH 1/9] feat: add support for python 3.13 --- README.md | 2 +- noxfile.py | 4 ++-- scripts/manylinux/check.sh | 2 +- scripts/osx/build.sh | 2 +- scripts/osx/check.sh | 4 ++-- scripts/windows/build.bat | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 62f80b67..ebed0ed1 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ C toolchain. # Currently Published Wheels -Wheels are currently published for CPython 3.9, 3.10, 3.11 and 3.12 +Wheels are currently published for CPython 3.9, 3.10, 3.11, 3.12 and 3.13 for multiple architectures. PyPy 3.9 and 3.10 are also supported for Linux. For information on building your own wheels please view [BUILDING.md](BUILDING.md). diff --git a/noxfile.py b/noxfile.py index c785639d..4ac5bd9a 100644 --- a/noxfile.py +++ b/noxfile.py @@ -24,7 +24,7 @@ HERE = os.path.dirname(__file__) -@nox.session(python=["3.9", "3.10", "3.11", "3.12"]) +@nox.session(python=["3.9", "3.10", "3.11", "3.12", "3.13"]) def build_libcrc32c(session): session.env["PY_BIN"] = f"python{session.python}" session.env["REPO_ROOT"] = HERE @@ -39,7 +39,7 @@ def build_libcrc32c(session): raise Exception("Unsupported") -@nox.session(python=["3.9", "3.10", "3.11", "3.12"]) +@nox.session(python=["3.9", "3.10", "3.11", "3.12", "3.13"]) def check(session): session.install("pytest") session.install("--no-index", f"--find-links={HERE}/wheels", "google-crc32c") diff --git a/scripts/manylinux/check.sh b/scripts/manylinux/check.sh index f5f38150..421eb529 100755 --- a/scripts/manylinux/check.sh +++ b/scripts/manylinux/check.sh @@ -37,7 +37,7 @@ install_python_pyenv() { pyenv shell $version } -SUPPORTED_PYTHON_VERSIONS=("3.9" "3.10" "3.11" "3.12") +SUPPORTED_PYTHON_VERSIONS=("3.9" "3.10" "3.11" "3.12" "3.13") for PYTHON_VERSION in "${SUPPORTED_PYTHON_VERSIONS[@]}"; do PYTHON=python${PYTHON_VERSION} diff --git a/scripts/osx/build.sh b/scripts/osx/build.sh index 326ba92d..f12ee1da 100755 --- a/scripts/osx/build.sh +++ b/scripts/osx/build.sh @@ -42,7 +42,7 @@ git submodule update --init --recursive ${OSX_DIR}/build_c_lib.sh -SUPPORTED_PYTHON_VERSIONS=("3.9" "3.10" "3.11" "3.12") +SUPPORTED_PYTHON_VERSIONS=("3.9" "3.10" "3.11" "3.12" "3.13") for PYTHON_VERSION in ${SUPPORTED_PYTHON_VERSIONS[@]}; do echo "Build wheel for Python ${PYTHON_VERSION}" diff --git a/scripts/osx/check.sh b/scripts/osx/check.sh index 7ec869c8..f0775df0 100755 --- a/scripts/osx/check.sh +++ b/scripts/osx/check.sh @@ -30,7 +30,7 @@ eval "$(pyenv init -)" eval "$(pyenv init --path)" ls ${REPO_ROOT}/wheels -SUPPORTED_PYTHON_VERSIONS=("3.9" "3.10" "3.11" "3.12") +SUPPORTED_PYTHON_VERSIONS=("3.9" "3.10" "3.11" "3.12" "3.13") for PYTHON_VERSION in ${SUPPORTED_PYTHON_VERSIONS[@]}; do PYTHON="python${PYTHON_VERSION}" @@ -44,7 +44,7 @@ for PYTHON_VERSION in ${SUPPORTED_PYTHON_VERSIONS[@]}; do ${PYTHON} -m venv ${VIRTUALENV} OS_VERSION_STR="12_0" - if [ "${PYTHON_VERSION}" == "3.12" ]; then + if [ "${PYTHON_VERSION}" == "3.12"] || ["${PYTHON_VERSION}" == "3.13" ]; then OS_VERSION_STR="14.0" fi diff --git a/scripts/windows/build.bat b/scripts/windows/build.bat index 4d8e5f5e..a55665ac 100644 --- a/scripts/windows/build.bat +++ b/scripts/windows/build.bat @@ -23,7 +23,7 @@ set CRC32C_INSTALL_PREFIX=%cd%\build\%CONFIGURATION% @rem Unfortunately pyenv for Windows has an out-of-date versions list. Choco's @rem installer seems to have some problems with installing multiple versions at @rem once, so as a workaround, we will install and then uninstall every version. -FOR %%P IN (3.9, 3.10, 3.11, 3.12) DO ( +FOR %%P IN (3.9, 3.10, 3.11, 3.12, 3.13) DO ( echo "Installing Python version %%P" choco install python --version=%%P -y --no-progress From e1de1656d848227eb064463cb57cee84b23ef343 Mon Sep 17 00:00:00 2001 From: Andrew Gorcester Date: Thu, 13 Mar 2025 11:43:51 -0700 Subject: [PATCH 2/9] upgrade script dependencies --- scripts/osx/build_python_wheel.sh | 5 +++++ scripts/osx/check.sh | 4 ++-- scripts/windows/test.bat | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/osx/build_python_wheel.sh b/scripts/osx/build_python_wheel.sh index b00a8308..9618a4d1 100755 --- a/scripts/osx/build_python_wheel.sh +++ b/scripts/osx/build_python_wheel.sh @@ -40,6 +40,11 @@ eval "$(pyenv init --path)" install_python_pyenv() { version=$1 + # special-case handle old version of pyenv in current Kokoro image + if ["$version" == "3.13"]; then + version=3.13.0rc2 + fi + if [ -z "$(pyenv versions --bare | grep $version)" ]; then echo "Python $version is not installed. Installing..." pyenv install $version diff --git a/scripts/osx/check.sh b/scripts/osx/check.sh index f0775df0..f34f18fc 100755 --- a/scripts/osx/check.sh +++ b/scripts/osx/check.sh @@ -30,7 +30,7 @@ eval "$(pyenv init -)" eval "$(pyenv init --path)" ls ${REPO_ROOT}/wheels -SUPPORTED_PYTHON_VERSIONS=("3.9" "3.10" "3.11" "3.12" "3.13") +SUPPORTED_PYTHON_VERSIONS=("3.9" "3.10" "3.11" "3.12" "3.13.0rc2") for PYTHON_VERSION in ${SUPPORTED_PYTHON_VERSIONS[@]}; do PYTHON="python${PYTHON_VERSION}" @@ -44,7 +44,7 @@ for PYTHON_VERSION in ${SUPPORTED_PYTHON_VERSIONS[@]}; do ${PYTHON} -m venv ${VIRTUALENV} OS_VERSION_STR="12_0" - if [ "${PYTHON_VERSION}" == "3.12"] || ["${PYTHON_VERSION}" == "3.13" ]; then + if [ "${PYTHON_VERSION}" == "3.12"] || ["${PYTHON_VERSION}" == "3.13"] || ["${PYTHON_VERSION}" == "3.13.0rc2"]; then OS_VERSION_STR="14.0" fi diff --git a/scripts/windows/test.bat b/scripts/windows/test.bat index 5e9d1280..c7f28501 100644 --- a/scripts/windows/test.bat +++ b/scripts/windows/test.bat @@ -25,5 +25,8 @@ py -%PYTHON_VERSION%-64 -m pip install --no-index --find-links=wheels google-crc py -%PYTHON_VERSION%-64 ./scripts/check_crc32c_extension.py +@rem pyreadline is removed here because pytest will opportunistically use it if +@rem available, but the installed version is too old to work. +py -%PYTHON_VERSION%-64 -m pip uninstall -y pyreadline py -%PYTHON_VERSION%-64 -m pip install pytest py -%PYTHON_VERSION%-64 -m pytest tests From 731d600b0b505d54625dc94669e1040bfb7118ef Mon Sep 17 00:00:00 2001 From: Andrew Gorcester Date: Thu, 13 Mar 2025 12:57:45 -0700 Subject: [PATCH 3/9] continue iterating on build scripts --- scripts/osx/build_python_wheel.sh | 2 +- scripts/osx/check.sh | 4 ++-- scripts/windows/build.bat | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/osx/build_python_wheel.sh b/scripts/osx/build_python_wheel.sh index 9618a4d1..fceed84f 100755 --- a/scripts/osx/build_python_wheel.sh +++ b/scripts/osx/build_python_wheel.sh @@ -42,7 +42,7 @@ install_python_pyenv() { # special-case handle old version of pyenv in current Kokoro image if ["$version" == "3.13"]; then - version=3.13.0rc2 + version="3.13.0rc2" fi if [ -z "$(pyenv versions --bare | grep $version)" ]; then diff --git a/scripts/osx/check.sh b/scripts/osx/check.sh index f34f18fc..7c1b7e34 100755 --- a/scripts/osx/check.sh +++ b/scripts/osx/check.sh @@ -30,7 +30,7 @@ eval "$(pyenv init -)" eval "$(pyenv init --path)" ls ${REPO_ROOT}/wheels -SUPPORTED_PYTHON_VERSIONS=("3.9" "3.10" "3.11" "3.12" "3.13.0rc2") +SUPPORTED_PYTHON_VERSIONS=("3.9" "3.10" "3.11" "3.12" "3.13") for PYTHON_VERSION in ${SUPPORTED_PYTHON_VERSIONS[@]}; do PYTHON="python${PYTHON_VERSION}" @@ -44,7 +44,7 @@ for PYTHON_VERSION in ${SUPPORTED_PYTHON_VERSIONS[@]}; do ${PYTHON} -m venv ${VIRTUALENV} OS_VERSION_STR="12_0" - if [ "${PYTHON_VERSION}" == "3.12"] || ["${PYTHON_VERSION}" == "3.13"] || ["${PYTHON_VERSION}" == "3.13.0rc2"]; then + if [ "${PYTHON_VERSION}" == "3.12"] || ["${PYTHON_VERSION}" == "3.13"]; then OS_VERSION_STR="14.0" fi diff --git a/scripts/windows/build.bat b/scripts/windows/build.bat index 1b8027c9..8f820473 100644 --- a/scripts/windows/build.bat +++ b/scripts/windows/build.bat @@ -23,7 +23,7 @@ set CRC32C_INSTALL_PREFIX=%cd%\build\%CONFIGURATION% @rem Unfortunately pyenv for Windows has an out-of-date versions list. Choco's @rem installer seems to have some problems with installing multiple versions at @rem once, so as a workaround, we will install and then uninstall every version. -FOR %%P IN (3.9, 3.10, 3.11, 3.12, 3.13) DO ( +FOR %%P IN (3.9, 3.10, 3.11, 3.12, 3.13.1) DO ( echo "Installing Python version %%P" choco install python --version=%%P -y --no-progress From f44780bce5f5918290ee33f3b54af0ea60ac1c41 Mon Sep 17 00:00:00 2001 From: Andrew Gorcester Date: Thu, 13 Mar 2025 13:12:14 -0700 Subject: [PATCH 4/9] continue iterating on build scripts --- scripts/osx/build_python_wheel.sh | 2 +- scripts/osx/check.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/osx/build_python_wheel.sh b/scripts/osx/build_python_wheel.sh index fceed84f..4315708b 100755 --- a/scripts/osx/build_python_wheel.sh +++ b/scripts/osx/build_python_wheel.sh @@ -41,7 +41,7 @@ install_python_pyenv() { version=$1 # special-case handle old version of pyenv in current Kokoro image - if ["$version" == "3.13"]; then + if [ "${version}" = "3.13" ]; then version="3.13.0rc2" fi diff --git a/scripts/osx/check.sh b/scripts/osx/check.sh index 7c1b7e34..d2f09882 100755 --- a/scripts/osx/check.sh +++ b/scripts/osx/check.sh @@ -44,7 +44,7 @@ for PYTHON_VERSION in ${SUPPORTED_PYTHON_VERSIONS[@]}; do ${PYTHON} -m venv ${VIRTUALENV} OS_VERSION_STR="12_0" - if [ "${PYTHON_VERSION}" == "3.12"] || ["${PYTHON_VERSION}" == "3.13"]; then + if [ "${PYTHON_VERSION}" == "3.12" ] || [ "${PYTHON_VERSION}" == "3.13" ]; then OS_VERSION_STR="14.0" fi From e9a78a6496cabca7cbf51b0d3b2f28afc47c7311 Mon Sep 17 00:00:00 2001 From: Andrew Gorcester Date: Thu, 13 Mar 2025 13:20:44 -0700 Subject: [PATCH 5/9] continue iterating on build scripts --- scripts/osx/build.sh | 4 ++++ scripts/osx/build_python_wheel.sh | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/osx/build.sh b/scripts/osx/build.sh index f12ee1da..10779be7 100755 --- a/scripts/osx/build.sh +++ b/scripts/osx/build.sh @@ -30,6 +30,10 @@ export REPO_ROOT=$(dirname ${SCRIPTS_DIR}) # https://github.com/pyenv/pyenv/wiki#suggested-build-environment brew install openssl readline sqlite3 xz zlib tcl-tk +# Replace the old version of pyenv with the latest version. +rm -rf /Users/kbuilder/.pyenv +git clone https://github.com/pyenv/pyenv.git /Users/kbuilder/.pyenv + # Build and install `libcrc32c` export PY_BIN="${PY_BIN:-python3}" export CRC32C_INSTALL_PREFIX="${REPO_ROOT}/usr" diff --git a/scripts/osx/build_python_wheel.sh b/scripts/osx/build_python_wheel.sh index 4315708b..b00a8308 100755 --- a/scripts/osx/build_python_wheel.sh +++ b/scripts/osx/build_python_wheel.sh @@ -40,11 +40,6 @@ eval "$(pyenv init --path)" install_python_pyenv() { version=$1 - # special-case handle old version of pyenv in current Kokoro image - if [ "${version}" = "3.13" ]; then - version="3.13.0rc2" - fi - if [ -z "$(pyenv versions --bare | grep $version)" ]; then echo "Python $version is not installed. Installing..." pyenv install $version From da2e62c4408eadbd66ad2034c17e348771f467e7 Mon Sep 17 00:00:00 2001 From: Andrew Gorcester Date: Thu, 13 Mar 2025 13:44:42 -0700 Subject: [PATCH 6/9] continue iterating on build scripts --- scripts/osx/check.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/osx/check.sh b/scripts/osx/check.sh index d2f09882..e3101325 100755 --- a/scripts/osx/check.sh +++ b/scripts/osx/check.sh @@ -19,8 +19,8 @@ VERSION=$(awk "/version \= ([0-9.]+)/" setup.cfg) PACKAGE_VERSION=${VERSION:10} # ``readlink -f`` is not our friend on OS X. This relies on **some** -# ``python`` being installed. -SCRIPT_FI=$(python -c "import os; print(os.path.realpath('${0}'))") +# ``python3`` being installed. +SCRIPT_FI=$(python3 -c "import os; print(os.path.realpath('${0}'))") OSX_DIR=$(dirname ${SCRIPT_FI}) SCRIPTS_DIR=$(dirname ${OSX_DIR}) export REPO_ROOT=$(dirname ${SCRIPTS_DIR}) From 163032791ebddcf1dae838a890a8dc4462dfa765 Mon Sep 17 00:00:00 2001 From: Andrew Gorcester Date: Thu, 13 Mar 2025 14:03:24 -0700 Subject: [PATCH 7/9] continue iterating on build scripts --- scripts/osx/build_c_lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/osx/build_c_lib.sh b/scripts/osx/build_c_lib.sh index 99b8bba7..b5740a00 100755 --- a/scripts/osx/build_c_lib.sh +++ b/scripts/osx/build_c_lib.sh @@ -44,7 +44,7 @@ mkdir -p ${CRC32C_INSTALL_PREFIX} mkdir -p ${CRC32C_INSTALL_PREFIX}/lib # Make sure we have an updated `pip`. -${PY_BIN} -m pip install --upgrade pip --user +${PY_BIN} -m pip install --upgrade pip --user --break-system-packages # Create a virtualenv where we can install `cmake`. VENV=${REPO_ROOT}/venv_build_libcrc32c ${PY_BIN} -m venv ${VENV} From 6d881ba3202baa4eea49a321db93eb98b4dc0942 Mon Sep 17 00:00:00 2001 From: Andrew Gorcester Date: Thu, 13 Mar 2025 14:04:25 -0700 Subject: [PATCH 8/9] continue iterating on build scripts --- scripts/osx/build_c_lib.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/osx/build_c_lib.sh b/scripts/osx/build_c_lib.sh index b5740a00..e1d41dae 100755 --- a/scripts/osx/build_c_lib.sh +++ b/scripts/osx/build_c_lib.sh @@ -43,8 +43,6 @@ fi mkdir -p ${CRC32C_INSTALL_PREFIX} mkdir -p ${CRC32C_INSTALL_PREFIX}/lib -# Make sure we have an updated `pip`. -${PY_BIN} -m pip install --upgrade pip --user --break-system-packages # Create a virtualenv where we can install `cmake`. VENV=${REPO_ROOT}/venv_build_libcrc32c ${PY_BIN} -m venv ${VENV} From dbee9f6bca14595da0436a6b43dee59deaac6edf Mon Sep 17 00:00:00 2001 From: Andrew Gorcester Date: Thu, 13 Mar 2025 15:02:42 -0700 Subject: [PATCH 9/9] continue iterating on build scripts --- scripts/manylinux/build_on_centos.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/manylinux/build_on_centos.sh b/scripts/manylinux/build_on_centos.sh index 2df9c2ca..4835cd8c 100755 --- a/scripts/manylinux/build_on_centos.sh +++ b/scripts/manylinux/build_on_centos.sh @@ -56,6 +56,9 @@ if [[ -z ${BUILD_PYTHON} ]]; then elif [[ "${PYTHON_BIN}" == *"312"* ]]; then PYTHON_VERSIONS="${PYTHON_VERSIONS} ${PYTHON_BIN}" continue + elif [[ "${PYTHON_BIN}" == *"313"* ]]; then + PYTHON_VERSIONS="${PYTHON_VERSIONS} ${PYTHON_BIN}" + continue else echo "Ignoring unsupported version: ${PYTHON_BIN}" echo "====================================="