From 4e2d2a439c9b9cfadc73db0a7fc89f04131c707e Mon Sep 17 00:00:00 2001 From: Nicolas Cornu Date: Wed, 2 Oct 2024 16:07:09 +0200 Subject: [PATCH 1/2] Remove deprecated python 3.8 --- .circleci/config.yml | 3 +-- .github/ISSUE_TEMPLATE/release-patch.md | 2 +- .github/ISSUE_TEMPLATE/release.md | 2 +- .github/workflows/coverage.yml | 2 +- .github/workflows/neuron-ci.yml | 2 +- CMakeLists.txt | 2 +- azure-pipelines.yml | 6 ------ ci/win_build_cmake.sh | 2 +- ci/win_download_deps.cmd | 1 - ci/win_install_deps.cmd | 4 ---- ci/win_test_installer.cmd | 3 --- docs/install/python_wheels.md | 10 +++++----- docs/install/windows.md | 4 ++-- src/mswin/CMakeLists.txt | 4 ++-- src/nrniv/nrnpy.cpp | 2 +- src/nrnpython/nrnpython.h | 4 ++-- 16 files changed, 19 insertions(+), 34 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 737c5cc777..27c16c14c3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -49,7 +49,6 @@ jobs: # choose available python versions from pyenv pyenv_py_ver="" case << parameters.NRN_PYTHON_VERSION >> in - 38) pyenv_py_ver="3.8" ;; 39) pyenv_py_ver="3.9" ;; 310) pyenv_py_ver="3.10" ;; 311) pyenv_py_ver="3.11" ;; @@ -102,5 +101,5 @@ workflows: - manylinux2014-aarch64: matrix: parameters: - NRN_PYTHON_VERSION: ["38", "39", "310", "311", "312"] + NRN_PYTHON_VERSION: ["39", "310", "311", "312"] NRN_NIGHTLY_UPLOAD: ["true"] diff --git a/.github/ISSUE_TEMPLATE/release-patch.md b/.github/ISSUE_TEMPLATE/release-patch.md index ee73129c71..7f899113ed 100644 --- a/.github/ISSUE_TEMPLATE/release-patch.md +++ b/.github/ISSUE_TEMPLATE/release-patch.md @@ -39,7 +39,7 @@ Releasing - [ ] aarch64 wheels (use existing `release/x.y-aarch64` branch for this, see [guide](https://nrn.readthedocs.io/en/latest/install/python_wheels.html#publishing-the-wheels-on-pypi-via-circleci)) - [ ] Publish the `x.y.z` wheels on PyPI; see [wheel publishing instructions](https://nrn.readthedocs.io/en/latest/install/python_wheels.html#publishing-the-wheels-on-pypi-via-azure) - [ ] Once wheels are published, activate the `x.y.z` tag on ReadTheDocs -- [ ] Rename the Windows installer in the GitHub release to match the new version and the supported python versions (i.e. `nrn-8.2.2.w64-mingw-py-37-38-39-310-311-setup.exe`) +- [ ] Rename the Windows installer in the GitHub release to match the new version and the supported python versions (i.e. `nrn-8.2.2.w64-mingw-py-39-310-311-312-setup.exe`) - [ ] Publish release on GitHub (edit https://github.com/neuronsimulator/nrn/releases/tag/x.y.z and un-tick the pre-release checkbox) diff --git a/.github/ISSUE_TEMPLATE/release.md b/.github/ISSUE_TEMPLATE/release.md index 0d0721a066..b8cbd848b4 100644 --- a/.github/ISSUE_TEMPLATE/release.md +++ b/.github/ISSUE_TEMPLATE/release.md @@ -37,7 +37,7 @@ Releasing - [ ] aarch64 wheels (create a `release/x.y-aarch64` branch for this, see [guide](https://nrn.readthedocs.io/en/latest/install/python_wheels.html#publishing-the-wheels-on-pypi-via-circleci)) - [ ] Publish the `x.y.z` wheels on Pypi; see [wheel publishing instructions](https://nrn.readthedocs.io/en/latest/install/python_wheels.html#publishing-the-wheels-on-pypi-via-azure) - [ ] Once wheels are published, activate the `x.y.z` tag on ReadTheDocs -- [ ] Rename the Windows installer in the GitHub release to match the new version and the supported python versions (i.e. `nrn-8.2.2.w64-mingw-py-37-38-39-310-311-setup.exe` +- [ ] Rename the Windows installer in the GitHub release to match the new version and the supported python versions (i.e. `nrn-8.2.2.w64-mingw-py-39-310-311-312-setup.exe` ) - [ ] Publish release on GitHub (edit https://github.com/neuronsimulator/nrn/releases/tag/x.y.z and un-tick the pre-release checkbox) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index ce0bb21bae..8d3c3bdfb2 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -22,7 +22,7 @@ on: # - 'docs/**' env: - PY_MIN_VERSION: '3.8' + PY_MIN_VERSION: '3.9' PY_MID_VERSION: '3.10' PY_MAX_VERSION: '3.12' diff --git a/.github/workflows/neuron-ci.yml b/.github/workflows/neuron-ci.yml index dfe8a9327c..747337cc9d 100644 --- a/.github/workflows/neuron-ci.yml +++ b/.github/workflows/neuron-ci.yml @@ -38,7 +38,7 @@ jobs: BUILD_TYPE: Release DESIRED_CMAKE_VERSION: 3.17 DYNAMIC_PYTHON_CMAKE_VERSION: 3.18 - PY_MIN_VERSION: ${{ matrix.config.python_min_version || '3.8' }} + PY_MIN_VERSION: ${{ matrix.config.python_min_version || '3.9' }} PY_MAX_VERSION: ${{ matrix.config.python_max_version || '3.12' }} MUSIC_INSTALL_DIR: /opt/MUSIC MUSIC_VERSION: 1.2.1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 87d423a7b4..abbd866e3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -268,7 +268,7 @@ string(REPLACE "," ";" NRN_SANITIZERS_LIST "${NRN_SANITIZERS}") # NRN_DEFAULT_PYTHON_LIBRARIES are its include direcory and library # * NRN_PYTHON_EXECUTABLES is a list of absolute paths to all Python executables to be built against # (length >=1 if NRN_ENABLE_PYTHON_DYNAMIC else == 1) -# * NRN_PYTHON_VERSIONS (3.8, 3.11, ...), NRN_PYTHON_INCLUDES and NRN_PYTHON_LIBRARIES are populated +# * NRN_PYTHON_VERSIONS (3.9, 3.11, ...), NRN_PYTHON_INCLUDES and NRN_PYTHON_LIBRARIES are populated # with values patching NRN_PYTHON_EXECUTABLES # * NRN_PYTHON_COUNT is set to the number of entries in those lists (i.e. number of Pythons), and # NRN_PYTHON_ITERATION_LIMIT is set to ${NRN_PYTHON_COUNT} - 1 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 238988a536..5caa869a89 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -34,8 +34,6 @@ stages: vmImage: 'ubuntu-20.04' strategy: matrix: - Python38: - python.version: '3.8' Python39: python.version: '3.9' Python310: @@ -88,10 +86,6 @@ stages: vmImage: 'macOS-12' strategy: matrix: - Python38: - python.version: '3.8' - python.org.version: '3.8.9' - python.installer.name: 'macosx10.9.pkg' Python39: python.version: '3.9' python.org.version: '3.9.13' diff --git a/ci/win_build_cmake.sh b/ci/win_build_cmake.sh index ca610acea3..b82e430444 100755 --- a/ci/win_build_cmake.sh +++ b/ci/win_build_cmake.sh @@ -32,7 +32,7 @@ cd $BUILD_SOURCESDIRECTORY/build -DNRN_BINARY_DIST_BUILD=ON \ -DPYTHON_EXECUTABLE=/c/Python39/python.exe \ -DNRN_ENABLE_PYTHON_DYNAMIC=ON \ - -DNRN_PYTHON_DYNAMIC='c:/Python38/python.exe;c:/Python39/python.exe;c:/Python310/python.exe;c:/Python311/python.exe;c:/Python312/python.exe' \ + -DNRN_PYTHON_DYNAMIC='c:/Python39/python.exe;c:/Python310/python.exe;c:/Python311/python.exe;c:/Python312/python.exe' \ -DCMAKE_INSTALL_PREFIX='/c/nrn-install' \ -DMPI_CXX_LIB_NAMES:STRING=msmpi \ -DMPI_C_LIB_NAMES:STRING=msmpi \ diff --git a/ci/win_download_deps.cmd b/ci/win_download_deps.cmd index a006ffc0d2..40a9b44f49 100644 --- a/ci/win_download_deps.cmd +++ b/ci/win_download_deps.cmd @@ -3,7 +3,6 @@ :: download all installers :: python -pwsh -command Invoke-WebRequest -MaximumRetryCount 4 -OutFile python-3.8.exe https://www.python.org/ftp/python/3.8.2/python-3.8.2-amd64.exe || goto :error pwsh -command Invoke-WebRequest -MaximumRetryCount 4 -OutFile python-3.9.exe https://www.python.org/ftp/python/3.9.0/python-3.9.0-amd64.exe || goto :error pwsh -command Invoke-WebRequest -MaximumRetryCount 4 -OutFile python-3.10.exe https://www.python.org/ftp/python/3.10.0/python-3.10.0-amd64.exe || goto :error pwsh -command Invoke-WebRequest -MaximumRetryCount 4 -OutFile python-3.11.exe https://www.python.org/ftp/python/3.11.1/python-3.11.1-amd64.exe || goto :error diff --git a/ci/win_install_deps.cmd b/ci/win_install_deps.cmd index b30c41c733..f41e6b00ea 100644 --- a/ci/win_install_deps.cmd +++ b/ci/win_install_deps.cmd @@ -3,27 +3,23 @@ :: install all dependencies :: install python -python-3.8.exe /passive Include_pip=1 Include_test=0 PrependPath=1 DefaultJustForMeTargetDir=C:\Python38 || goto :error python-3.9.exe /passive Include_pip=1 Include_test=0 PrependPath=1 DefaultJustForMeTargetDir=C:\Python39 || goto :error python-3.10.exe /passive Include_pip=1 Include_test=0 PrependPath=1 DefaultJustForMeTargetDir=C:\Python310 || goto :error python-3.11.exe /passive Include_pip=1 Include_test=0 PrependPath=1 DefaultJustForMeTargetDir=C:\Python311 || goto :error python-3.12.exe /passive Include_pip=1 Include_test=0 PrependPath=1 DefaultJustForMeTargetDir=C:\Python312 || goto :error :: fix msvcc version for all python3 -pwsh -command "(Get-Content C:\Python38\Lib\distutils\cygwinccompiler.py) -replace 'elif msc_ver == ''1600'':', 'elif msc_ver == ''1916'':' | Out-File C:\Python38\Lib\distutils\cygwinccompiler.py" pwsh -command "(Get-Content C:\Python39\Lib\distutils\cygwinccompiler.py) -replace 'elif msc_ver == ''1600'':', 'elif msc_ver == ''1927'':' | Out-File C:\Python39\Lib\distutils\cygwinccompiler.py" pwsh -command "(Get-Content C:\Python310\Lib\distutils\cygwinccompiler.py) -replace 'elif msc_ver == ''1600'':', 'elif msc_ver == ''1929'':' | Out-File C:\Python310\Lib\distutils\cygwinccompiler.py" pwsh -command "(Get-Content C:\Python311\Lib\distutils\cygwinccompiler.py) -replace 'elif msc_ver == ''1600'':', 'elif msc_ver == ''1934'':' | Out-File C:\Python311\Lib\distutils\cygwinccompiler.py" :: fix msvc runtime library for all python -pwsh -command "(Get-Content C:\Python38\Lib\distutils\cygwinccompiler.py) -replace 'msvcr100', 'msvcrt' | Out-File C:\Python38\Lib\distutils\cygwinccompiler.py" pwsh -command "(Get-Content C:\Python39\Lib\distutils\cygwinccompiler.py) -replace 'msvcr100', 'msvcrt' | Out-File C:\Python39\Lib\distutils\cygwinccompiler.py" pwsh -command "(Get-Content C:\Python310\Lib\distutils\cygwinccompiler.py) -replace 'msvcr100', 'msvcrt' | Out-File C:\Python310\Lib\distutils\cygwinccompiler.py" pwsh -command "(Get-Content C:\Python311\Lib\distutils\cygwinccompiler.py) -replace 'msvcr100', 'msvcrt' | Out-File C:\Python311\Lib\distutils\cygwinccompiler.py" :: install numpy -C:\Python38\python.exe -m pip install numpy cython || goto :error C:\Python39\python.exe -m pip install numpy cython || goto :error C:\Python310\python.exe -m pip install numpy cython || goto :error C:\Python311\python.exe -m pip install numpy cython || goto :error diff --git a/ci/win_test_installer.cmd b/ci/win_test_installer.cmd index 0bf68842ab..bda5bbec7b 100644 --- a/ci/win_test_installer.cmd +++ b/ci/win_test_installer.cmd @@ -17,21 +17,18 @@ echo %NEURONHOME% if not exist association.hoc.out (start /wait /REALTIME %cd%\ci\association.hoc) :: test all pythons -C:\Python38\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y" C:\Python39\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y" C:\Python310\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y" C:\Python311\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y" C:\Python312\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y" :: install oldest supported numpy -C:\Python38\python.exe -m pip install -r packaging/python/oldest_numpy_requirements.txt || goto :error C:\Python39\python.exe -m pip install -r packaging/python/oldest_numpy_requirements.txt || goto :error C:\Python310\python.exe -m pip install -r packaging/python/oldest_numpy_requirements.txt || goto :error C:\Python311\python.exe -m pip install -r packaging/python/oldest_numpy_requirements.txt || goto :error C:\Python312\python.exe -m pip install -r packaging/python/oldest_numpy_requirements.txt || goto :error :: test all pythons again -C:\Python38\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y" C:\Python39\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y" C:\Python310\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y" C:\Python311\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y" diff --git a/docs/install/python_wheels.md b/docs/install/python_wheels.md index 42387bfad8..e437776cd1 100644 --- a/docs/install/python_wheels.md +++ b/docs/install/python_wheels.md @@ -162,7 +162,7 @@ ls -la wheelhouse You can build the wheel for a specific python version: ``` -bash packaging/python/build_wheels.bash linux 38 # 38 for Python v3.8 +bash packaging/python/build_wheels.bash linux 39 # 39 for Python v3.9 ``` To build wheels with CoreNEURON support you have to pass an additional argument: `coreneuron`. @@ -193,10 +193,10 @@ To test the generated wheels, you can do: ``` # first arg is a python exe and second arg is the corresponding wheel -bash packaging/python/test_wheels.sh python3.8 wheelhouse/NEURON-7.8.0.236-cp38-cp38-macosx_10_9_x86_64.whl +bash packaging/python/test_wheels.sh python3.9 wheelhouse/NEURON-7.8.0.236-cp39-cp39-macosx_10_9_x86_64.whl # Or, you can provide the pypi url -bash packaging/python/test_wheels.sh python3.8 "-i https://test.pypi.org/simple/NEURON==7.8.11.2" +bash packaging/python/test_wheels.sh python3.9 "-i https://test.pypi.org/simple/NEURON==7.8.11.2" ``` ### MacOS considerations @@ -210,7 +210,7 @@ On BB5, we can test CPU wheels with: ``` salloc -A proj16 -N 1 --ntasks-per-node=4 -C "cpu" --time=1:00:00 -p interactive module load unstable python -bash packaging/python/test_wheels.sh python3.8 wheelhouse/NEURON-7.8.0.236-cp38-cp38m-manylinux1_x86_64.whl +bash packaging/python/test_wheels.sh python3.9 wheelhouse/NEURON-7.8.0.236-cp39-cp39m-manylinux1_x86_64.whl ``` ## Publishing the wheels on Pypi via Azure @@ -289,7 +289,7 @@ $ git diff matrix: parameters: - NRN_PYTHON_VERSION: ["311"] -+ NRN_PYTHON_VERSION: ["38", "39", "310", "311", "312"] ++ NRN_PYTHON_VERSION: ["39", "310", "311", "312"] NRN_NIGHTLY_UPLOAD: ["false"] nightly: diff --git a/docs/install/windows.md b/docs/install/windows.md index daf80e42b2..53f4eaa5b9 100644 --- a/docs/install/windows.md +++ b/docs/install/windows.md @@ -87,9 +87,9 @@ As you can see in the script, a typical configuration would be: -DNRN_ENABLE_PYTHON=ON \ -DNRN_ENABLE_RX3D=ON \ -DNRN_RX3D_OPT_LEVEL=2 \ - -DPYTHON_EXECUTABLE=/c/Python38/python.exe \ + -DPYTHON_EXECUTABLE=/c/Python39/python.exe \ -DNRN_ENABLE_PYTHON_DYNAMIC=ON \ - -DNRN_PYTHON_DYNAMIC='c:/Python38/python.exe;c:/Python39/python.exe;c:/Python310/python.exe;c:/Python311/python.exe' \ + -DNRN_PYTHON_DYNAMIC='c:/Python39/python.exe;c:/Python310/python.exe;c:/Python311/python.exe' \ -DCMAKE_INSTALL_PREFIX='/c/nrn-install' \ -DMPI_CXX_LIB_NAMES:STRING=msmpi \ -DMPI_C_LIB_NAMES:STRING=msmpi \ diff --git a/src/mswin/CMakeLists.txt b/src/mswin/CMakeLists.txt index b660eaed4c..fac79a48bc 100644 --- a/src/mswin/CMakeLists.txt +++ b/src/mswin/CMakeLists.txt @@ -12,9 +12,9 @@ # /mingw64/bin/cmake .. -G "Unix Makefiles" \ # -DCMAKE_INSTALL_PREFIX=/C/marshalnrn/nrn \ # -DIV_DIR=/home/hines/neuron/ivcmake/build/install \ -# -DPYTHON_EXECUTABLE=/e/python38/python \ +# -DPYTHON_EXECUTABLE=/e/python39/python \ # -DNRN_ENABLE_PYTHON_DYNAMIC=ON \ -# -DNRN_PYTHON_DYNAMIC="e:/python38/python;e:/python39/python;e:/python310/python;e:/python311/python" \ +# -DNRN_PYTHON_DYNAMIC="e:/python39/python;e:/python39/python;e:/python310/python;e:/python311/python" \ # -DNRN_ENABLE_MPI_DYNAMIC=ON \ # -DCMAKE_PREFIX_PATH="/c/ms-mpi" \ # -DNRN_ENABLE_CORENEURON=Off diff --git a/src/nrniv/nrnpy.cpp b/src/nrniv/nrnpy.cpp index 9176a63858..dec03193e5 100644 --- a/src/nrniv/nrnpy.cpp +++ b/src/nrniv/nrnpy.cpp @@ -258,7 +258,7 @@ void nrnpython_reg() { static nrnpython_reg_real_t load_nrnpython() { std::string pyversion{}; if (auto const pv10 = nrn_is_python_extension; pv10 > 0) { - // pv10 is one of the packed integers like 310 (3.10) or 38 (3.8) + // pv10 is one of the packed integers like 310 (3.10) or 39 (3.9) auto const factor = (pv10 >= 100) ? 100 : 10; pyversion = std::to_string(pv10 / factor) + "." + std::to_string(pv10 % factor); } else { diff --git a/src/nrnpython/nrnpython.h b/src/nrnpython/nrnpython.h index b664c6e841..b4ddcabc79 100644 --- a/src/nrnpython/nrnpython.h +++ b/src/nrnpython/nrnpython.h @@ -27,8 +27,8 @@ #define PyInt_AsLong PyLong_AsLong #define PyInt_FromLong PyLong_FromLong -static_assert(PY_MAJOR_VERSION > 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 8), - "Python >= 3.8 required"); +static_assert(PY_MAJOR_VERSION > 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 9), + "Python >= 3.9 required"); extern PyObject* nrnpy_hoc_pop(const char* mes); extern int nrnpy_numbercheck(PyObject*); From 75a9d53f0765169af3e135efc26526d0e723aaa1 Mon Sep 17 00:00:00 2001 From: Nicolas Cornu Date: Mon, 21 Oct 2024 10:04:33 +0200 Subject: [PATCH 2/2] No more 'm' --- docs/install/python_wheels.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/install/python_wheels.md b/docs/install/python_wheels.md index e437776cd1..325a97131d 100644 --- a/docs/install/python_wheels.md +++ b/docs/install/python_wheels.md @@ -210,7 +210,7 @@ On BB5, we can test CPU wheels with: ``` salloc -A proj16 -N 1 --ntasks-per-node=4 -C "cpu" --time=1:00:00 -p interactive module load unstable python -bash packaging/python/test_wheels.sh python3.9 wheelhouse/NEURON-7.8.0.236-cp39-cp39m-manylinux1_x86_64.whl +bash packaging/python/test_wheels.sh python3.9 wheelhouse/NEURON-7.8.0.236-cp39-cp39-manylinux1_x86_64.whl ``` ## Publishing the wheels on Pypi via Azure