Skip to content

Commit

Permalink
Add Python 3.12 wheels and testing fixes (#2719)
Browse files Browse the repository at this point in the history
* python-3.12 is now supported on 8.2

* Updates to build_wheels.bash for py312

* Install setuptools

* No more need for specific delocate
  • Loading branch information
heerener committed Feb 9, 2024
1 parent 6536a7b commit 85d9374
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
8 changes: 7 additions & 1 deletion azure-pipelines.yml
Expand Up @@ -44,6 +44,8 @@ stages:
python.version: '3.10'
Python311:
python.version: '3.11'
Python312:
python.version: '3.12'
steps:

# Secure files documentation:
Expand Down Expand Up @@ -107,6 +109,10 @@ stages:
python.version: '3.11'
python.org.version: '3.11.1'
python.installer.name: 'macos11.pkg'
Python312:
python.version: '3.12'
python.org.version: '3.12.2'
python.installer.name: 'macos11.pkg'

steps:

Expand Down Expand Up @@ -198,7 +204,7 @@ stages:
echo "Setting dropurl to $AZURE_DROP_URL"
echo "##vso[task.setvariable variable=dropurl]$AZURE_DROP_URL"
displayName: 'Resolve Azure drop URL'
- task: GitHubComment@0
inputs:
gitHubConnection: 'neuronsimulator'
Expand Down
10 changes: 9 additions & 1 deletion packaging/python/build_wheels.bash
Expand Up @@ -55,11 +55,12 @@ pip_numpy_install() {
39) numpy_ver="numpy==1.19.3" ;;
310) numpy_ver="numpy==1.21.3" ;;
311) numpy_ver="numpy==1.23.5" ;;
312) numpy_ver="numpy==1.26.0" ;;
*) echo "Error: numpy version not specified for this python!" && exit 1;;
esac

# older version for apple m1 as building from source fails
if [[ `uname -m` == 'arm64' ]]; then
if [[ `uname -m` == 'arm64' ]] && [[ $py_ver != 311 ]] && [[ $py_ver != 312 ]]; then
numpy_ver="numpy==1.21.3"
fi

Expand Down Expand Up @@ -157,6 +158,12 @@ build_wheel_osx() {
py_platform=$(python -c "import sysconfig; print('%s' % sysconfig.get_platform());")

echo " - Python platform: ${py_platform}"
if [[ "${py_platform}" == "macosx"-*"-arm64" ]]; then
# This is a shortcut to have a successful delocate-wheel. See:
# https://github.com/matthew-brett/delocate/issues/153
python -c "import os,delocate; print(os.path.join(os.path.dirname(delocate.__file__), 'tools.py'));quit()" | xargs -I{} sed -i."" "s/first, /input.pop('i386',None); first, /g" {}
python -c "import os,delocate; print('LOOK HERE'); print(os.path.join(os.path.dirname(delocate.__file__), 'tools.py'));quit()"
fi
if [[ "${py_platform}" == *"-universal2" ]]; then
if [[ `uname -m` == 'arm64' ]]; then
export _PYTHON_HOST_PLATFORM="${py_platform/universal2/arm64}"
Expand All @@ -166,6 +173,7 @@ build_wheel_osx() {
# This is a shortcut to have a successful delocate-wheel. See:
# https://github.com/matthew-brett/delocate/issues/153
python -c "import os,delocate; print(os.path.join(os.path.dirname(delocate.__file__), 'tools.py'));quit()" | xargs -I{} sed -i."" "s/first, /input.pop('i386',None); first, /g" {}
python -c "import os,delocate; print('LOOK HERE'); print(os.path.join(os.path.dirname(delocate.__file__), 'tools.py'));quit()"
else
export _PYTHON_HOST_PLATFORM="${py_platform/universal2/x86_64}"
echo " - Python installation is universal2 and we are on x84_64, setting _PYTHON_HOST_PLATFORM to: ${_PYTHON_HOST_PLATFORM}"
Expand Down
3 changes: 3 additions & 0 deletions packaging/python/test_wheels.sh
Expand Up @@ -293,6 +293,9 @@ fi
# gpu wheel needs updated pip
$python_exe -m pip install --upgrade pip

# we'll want setuptools installed and up-to-date
$python_exe -m pip install --upgrade setuptools


# install numpy, pytest and neuron
$python_exe -m pip install numpy pytest
Expand Down

0 comments on commit 85d9374

Please sign in to comment.