Skip to content

Commit

Permalink
Enable builds for Python 3.13 (#4414)
Browse files Browse the repository at this point in the history
* Enable builds for Python 3.13
  • Loading branch information
arnabanimesh authored Oct 18, 2024
1 parent f762c88 commit dd03f0c
Show file tree
Hide file tree
Showing 15 changed files with 53 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/amd64_linux_bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
{version: '3.10'},
{version: '3.11'},
{version: '3.12'},
{version: '3.13'},
]
fail-fast: false
name: Linux • Bazel • Python-${{ matrix.python.version }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/amd64_linux_cmake_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
{version: "3.10"},
{version: "3.11"},
{version: "3.12"},
{version: "3.13"},
]
fail-fast: false
name: Linux • ${{ matrix.cmake.generator }} • Python-${{ matrix.python.version }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/amd64_macos_bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
{version: '3.10'},
{version: '3.11'},
{version: '3.12'},
{version: '3.13'},
]
fail-fast: false
name: MacOS • Bazel • Python-${{ matrix.python.version }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/amd64_macos_cmake_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ jobs:
{version: "3.9"},
{version: "3.10"},
{version: "3.11"},
{version: "3.12"}
{version: "3.12"},
{version: "3.13"},
]
fail-fast: false
name: MacOS • ${{ matrix.cmake.generator }} • Python-${{ matrix.python.version }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/amd64_windows_bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
{version: '3.10'},
{version: '3.11'},
{version: '3.12'},
{version: '3.13'},
]
fail-fast: false # Don't cancel all jobs if one fails.
name: ${{ matrix.runner }} • Bazel • Python-${{ matrix.python.version }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/amd64_windows_cmake_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
{version: "3.10", dir: Python310},
{version: "3.11", dir: Python311},
{version: "3.12", dir: Python312},
{version: "3.13", dir: Python313},
]
fail-fast: false
name: Windows • ${{ matrix.cmake.generator }} • Python-${{ matrix.python.version }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/arm64_macos_bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
{version: '3.10'},
{version: '3.11'},
{version: '3.12'},
{version: '3.13'},
]
fail-fast: false
name: MacOS • Bazel • Python-${{ matrix.python.version }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/arm64_macos_cmake_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ jobs:
{version: "3.9"},
{version: "3.10"},
{version: "3.11"},
{version: "3.12"}
{version: "3.12"},
{version: "3.13"},
]
fail-fast: false
name: MacOS • ${{ matrix.cmake.generator }} • Python-${{ matrix.python.version }}
Expand Down
1 change: 1 addition & 0 deletions ortools/python/setup.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ setup(
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: C++',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Office/Business :: Scheduling',
Expand Down
3 changes: 2 additions & 1 deletion tools/docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ help:
@echo -e "\t\t${BOLD}310${RESET} Python3.10"
@echo -e "\t\t${BOLD}311${RESET} Python3.11"
@echo -e "\t\t${BOLD}312${RESET} Python3.12"
@echo -e "\t\t${BOLD}313${RESET} Python3.13"
@echo
@echo -e "\t${BOLD}<step>${RESET}:"
@echo -e "\t\t${BOLD}env${RESET}"
Expand Down Expand Up @@ -206,7 +207,7 @@ cache/python: | cache
-mkdir $@

## MANYLINUX ##
PYTHON_VERSIONS := 38 39 310 311 312
PYTHON_VERSIONS := 38 39 310 311 312 313

export/python/manylinux: | export/python
-mkdir -p $@
Expand Down
2 changes: 1 addition & 1 deletion tools/docker/python/build-manylinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ DESCRIPTION
\tYou MUST define the following variables before running this script:
\t* PLATFORM: x86_64 aarch64
\t* PYTHON_VERSION: 3 38 39 310 311 312
\t* PYTHON_VERSION: 3 38 39 310 311 312 313
note: PYTHON_VERSION=3 will generate for all pythons which could take time...
OPTIONS
Expand Down
4 changes: 2 additions & 2 deletions tools/release/build_delivery_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ function build_python() {
command -v swig | xargs echo "swig: " | tee -a build.log

if [[ ${PLATFORM} == "arm64" ]]; then
local -r PY=(3.8 3.9 3.10 3.11 3.12)
local -r PY=(3.8 3.9 3.10 3.11 3.12 3.13)
else
local -r PY=(3.8 3.9 3.10 3.11 3.12)
local -r PY=(3.8 3.9 3.10 3.11 3.12 3.13)
fi

# Check Python env
Expand Down
4 changes: 2 additions & 2 deletions tools/release/build_delivery_win.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ set PATH=%userprofile%\AppData\Roaming\Python\Python3%1\Scripts;%PATH%
::echo "python path: %PATH%"
GOTO :eof

REM PYTHON 3.8, 3.9, 3.10, 3.11, 3.12
REM PYTHON 3.8, 3.9, 3.10, 3.11, 3.12, 3.13
:BUILD_PYTHON
title Build Python
set HASH=
Expand All @@ -279,7 +279,7 @@ echo Python build seems up to date, skipping
exit /B 0
)

FOR %%v IN (8 9 10 11 12) DO (
FOR %%v IN (8 9 10 11 12 13) DO (
title Build Python 3.%%v
echo Check python3.%%v... | tee.exe -a build.log
which.exe "C:\python3%%v-64\python.exe" || exit 1
Expand Down
4 changes: 2 additions & 2 deletions tools/release/test_delivery_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ command -v make | xargs echo "make: " | tee -a test.log
command -v swig | xargs echo "swig: " | tee -a test.log
# python
if [[ ${PLATFORM} == "arm64" ]]; then
local -r PY=(3.8 3.9 3.10 3.11 3.12)
local -r PY=(3.8 3.9 3.10 3.11 3.12 3.13)
else
local -r PY=(3.8 3.9 3.10 3.11 3.12)
local -r PY=(3.8 3.9 3.10 3.11 3.12 3.13)
fi

for i in "${PY[@]}"; do
Expand Down
33 changes: 33 additions & 0 deletions tools/release/test_delivery_win.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,36 @@ echo Testing ortools Python3.12... | tee.exe -a test.log
echo Testing ortools Python3.12...DONE | tee.exe -a test.log

FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO copy %%i .

REM ###################
REM ## PYTHON 3.13 ##
REM ###################
echo Cleaning Python... | tee.exe -a test.log
make.exe clean_python WINDOWS_PATH_TO_PYTHON=c:\python313-64
echo Cleaning Python...DONE | tee.exe -a test.log

REM make.exe python WINDOWS_PATH_TO_PYTHON=c:\python313-64 || exit 1
REM echo make python3.13: DONE | tee.exe -a build.log
REM make.exe test_python WINDOWS_PATH_TO_PYTHON=c:\python313-64 || exit 1
REM echo make test_python3.13: DONE | tee.exe -a build.log
echo Rebuild Python3.13 pypi archive... | tee.exe -a test.log
make.exe package_python WINDOWS_PATH_TO_PYTHON=c:\python313-64 || exit 1
echo Rebuild Python3.13 pypi archive...DONE | tee.exe -a test.log

echo Creating Python3.13 venv... | tee.exe -a test.log
set PATH=c:\python313-64;c:\python313-64\Scripts;%PATH%
python -m pip install virtualenv
set TEMP_DIR=temp_python313
python -m virtualenv %TEMP_DIR%\venv
set PATH=%LOCAL_PATH%
echo Creating Python3.13 venv...DONE | tee.exe -a test.log

echo Installing ortools Python3.13 venv... | tee.exe -a test.log
FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO %TEMP_DIR%\venv\Scripts\python -m pip install %%i
echo Installing ortools Python3.13 venv...DONE | tee.exe -a test.log

echo Testing ortools Python3.13... | tee.exe -a test.log
%TEMP_DIR%\venv\Scripts\python cmake\samples\python\sample.py 2>&1 | tee.exe -a test.log
echo Testing ortools Python3.13...DONE | tee.exe -a test.log

FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO copy %%i .

0 comments on commit dd03f0c

Please sign in to comment.