diff --git a/.circleci/config.yml b/.circleci/config.yml index 2064f017a5..b20deacb03 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -31,7 +31,7 @@ jobs: -e NRN_RELEASE_UPLOAD \ -e NEURON_WHEEL_VERSION \ -e NRN_BUILD_FOR_UPLOAD=1 \ - 'neuronsimulator/neuron_wheel:latest-gcc9-aarch64' \ + 'neuronsimulator/neuron_wheel:latest-aarch64' \ packaging/python/build_wheels.bash linux << parameters.NRN_PYTHON_VERSION >> coreneuron - store_artifacts: @@ -54,6 +54,8 @@ jobs: 39) pyenv_py_ver="3.9.1" ;; 310) pyenv_py_ver="3.10.1" ;; 311) pyenv_py_ver="3.11.0" ;; + 312) pyenv_py_ver="3.12.0" ;; + 313) pyenv_py_ver="3.13.1" ;; *) echo "Error: pyenv python version not specified!" && exit 1;; esac @@ -110,5 +112,5 @@ workflows: - manylinux2014-aarch64: matrix: parameters: - NRN_PYTHON_VERSION: ["37", "38", "39", "310", "311"] + NRN_PYTHON_VERSION: ["37", "38", "39", "310", "311", "312", "313"] NRN_NIGHTLY_UPLOAD: ["true"] diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 50d42052a4..d54eade58d 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -21,7 +21,7 @@ on: env: PY_MIN_VERSION: '3.7' - PY_MAX_VERSION: '3.11' + PY_MAX_VERSION: '3.13' jobs: coverage: diff --git a/.github/workflows/neuron-ci.yml b/.github/workflows/neuron-ci.yml index d31a1ac24d..0fc0f5e8ba 100644 --- a/.github/workflows/neuron-ci.yml +++ b/.github/workflows/neuron-ci.yml @@ -23,7 +23,7 @@ env: BUILD_TYPE: Release DESIRED_CMAKE_VERSION: 3.15.0 PY_MIN_VERSION: '3.7' - PY_MAX_VERSION: '3.11' + PY_MAX_VERSION: '3.13' jobs: ci: @@ -40,12 +40,12 @@ jobs: BUILD_TYPE: Release DESIRED_CMAKE_VERSION: 3.15.0 PY_MIN_VERSION: ${{ matrix.config.python_min_version || '3.8' }} - PY_MAX_VERSION: ${{ matrix.config.python_max_version || '3.11' }} + PY_MAX_VERSION: ${{ matrix.config.python_max_version || '3.12' }} MUSIC_INSTALL_DIR: /opt/MUSIC strategy: matrix: - os: [ macOS-12, ubuntu-20.04] + os: [ macOS-13, ubuntu-20.04] config: - { matrix_eval : "CC=gcc-9 CXX=g++-9", build_mode: "setuptools"} - { matrix_eval : "CC=gcc-8 CXX=g++-8", build_mode: "cmake", music: ON} @@ -120,6 +120,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 2 + submodules: recursive - name: Set up Python@${{ env.PY_MIN_VERSION }} if: ${{matrix.config.python_dynamic == 'ON'}} @@ -148,7 +149,7 @@ jobs: run: | python3 -m venv music-venv source music-venv/bin/activate - python3 -m pip install mpi4py "cython<3" "numpy<2" + python3 -m pip install mpi4py cython numpy sudo mkdir -p $MUSIC_INSTALL_DIR sudo chown -R $USER $MUSIC_INSTALL_DIR # Stable build: https://github.com/INCF/MUSIC/archive/refs/heads/switch-to-MPI-C-interface.zip @ f33b66ea9348888eed1761738ab48c23ffc8a0d0 @@ -156,7 +157,7 @@ jobs: unzip MUSIC.zip && mv MUSIC-* MUSIC && cd MUSIC ./autogen.sh # workaround for MUSIC on MacOS 12 - if [[ "${{matrix.os}}" == "macOS-12" ]]; then + if [[ "${{matrix.os}}" == "macOS-13" ]]; then MPI_CXXFLAGS="-g" MPI_CFLAGS="-g" MPI_LDFLAGS="-g" CC=mpicc CXX=mpicxx ./configure --with-python-sys-prefix --prefix=$MUSIC_INSTALL_DIR --disable-anysource else ./configure --with-python-sys-prefix --prefix=$MUSIC_INSTALL_DIR --disable-anysource diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 64383067da..9e637ee90d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -46,7 +46,13 @@ stages: python.version: '3.11' Python312: python.version: '3.12' + Python313: + python.version: '3.13' + steps: + - script: | + git submodule update --init --recursive + displayName: Init submodules # Secure files documentation: # https://docs.microsoft.com/en-us/azure/devops/pipelines/library/secure-files?view=azure-devops @@ -71,7 +77,7 @@ stages: -e NRN_RELEASE_UPLOAD \ -e NEURON_WHEEL_VERSION \ -e NRN_BUILD_FOR_UPLOAD=1 \ - 'neuronsimulator/neuron_wheel:latest-gcc9-x86_64' \ + 'neuronsimulator/neuron_wheel:latest-x86_64' \ packaging/python/build_wheels.bash linux $(python.version) coreneuron displayName: 'Building ManyLinux Wheel' @@ -86,7 +92,7 @@ stages: - job: 'MacOSWheels' timeoutInMinutes: 40 pool: - vmImage: 'macOS-12' + vmImage: 'macOS-13' strategy: matrix: Python37: @@ -113,8 +119,15 @@ stages: python.version: '3.12' python.org.version: '3.12.2' python.installer.name: 'macos11.pkg' + Python313: + python.version: '3.13' + python.org.version: '3.13.1' + python.installer.name: 'macos11.pkg' steps: + - script: | + git submodule update --init --recursive + displayName: Init submodules - script: | installer=python-$(python.org.version)-$(python.installer.name) diff --git a/bldnrnmacpkgcmake.sh b/bldnrnmacpkgcmake.sh index 12ccd1588f..c88ee4c38a 100644 --- a/bldnrnmacpkgcmake.sh +++ b/bldnrnmacpkgcmake.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -ex -default_pythons="python3.8 python3.9 python3.10 python3.11 python3.12" +default_pythons="python3.8 python3.9 python3.10 python3.11 python3.12 python3.13" # distribution built with # bash bldnrnmacpkgcmake.sh # without args, default are the pythons above. diff --git a/ci/win_build_cmake.sh b/ci/win_build_cmake.sh index 116f30a175..940246cda2 100755 --- a/ci/win_build_cmake.sh +++ b/ci/win_build_cmake.sh @@ -9,8 +9,9 @@ export MINGW_CHOST=x86_64-w64-mingw32 export MSYSTEM_PREFIX=/mingw64 export PATH=/mingw64/bin:$PATH -# have compatible cython3 -python3 -m pip install "cython<3" + +# have compatible cython and setuptools +python3 -m pip install cython setuptools # if BUILD_SOURCESDIRECTORY not available, use te root of the repo if [ -z "$BUILD_SOURCESDIRECTORY" ]; then @@ -31,7 +32,7 @@ cd $BUILD_SOURCESDIRECTORY/build -DNRN_RX3D_OPT_LEVEL=2 \ -DPYTHON_EXECUTABLE=/c/Python37/python.exe \ -DNRN_ENABLE_PYTHON_DYNAMIC=ON \ - -DNRN_PYTHON_DYNAMIC='c:/Python37/python.exe;c:/Python38/python.exe;c:/Python39/python.exe;c:/Python310/python.exe;c:/Python311/python.exe;c:/Python312/python.exe' \ + -DNRN_PYTHON_DYNAMIC='c:/Python37/python.exe;c:/Python38/python.exe;c:/Python39/python.exe;c:/Python310/python.exe;c:/Python311/python.exe;c:/Python312/python.exe;c:/Python313/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 95f2588528..9c9e8d8ad3 100644 --- a/ci/win_download_deps.cmd +++ b/ci/win_download_deps.cmd @@ -9,6 +9,7 @@ pwsh -command Invoke-WebRequest -MaximumRetryCount 4 -OutFile python-3.9.exe htt 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 pwsh -command Invoke-WebRequest -MaximumRetryCount 4 -OutFile python-3.12.exe https://www.python.org/ftp/python/3.12.1/python-3.12.1-amd64.exe || goto :error +pwsh -command Invoke-WebRequest -MaximumRetryCount 4 -OutFile python-3.13.exe https://www.python.org/ftp/python/3.13.1/python-3.13.1-amd64.exe || goto :error :: mpi pwsh -command Invoke-WebRequest -MaximumRetryCount 4 -OutFile msmpisetup.exe https://download.microsoft.com/download/a/5/2/a5207ca5-1203-491a-8fb8-906fd68ae623/msmpisetup.exe || goto :error diff --git a/ci/win_install_deps.cmd b/ci/win_install_deps.cmd index 88954242de..ac12eb5bcd 100644 --- a/ci/win_install_deps.cmd +++ b/ci/win_install_deps.cmd @@ -9,6 +9,7 @@ python-3.9.exe /passive Include_pip=1 Include_test=0 PrependPath=1 DefaultJustFo 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 +python-3.13.exe /passive Include_pip=1 Include_test=0 PrependPath=1 DefaultJustForMeTargetDir=C:\Python313 || goto :error :: fix msvcc version for all python3 pwsh -command "(Get-Content C:\Python37\Lib\distutils\cygwinccompiler.py) -replace 'elif msc_ver == ''1600'':', 'elif msc_ver == ''1900'':' | Out-File C:\Python37\Lib\distutils\cygwinccompiler.py" @@ -26,14 +27,16 @@ pwsh -command "(Get-Content C:\Python310\Lib\distutils\cygwinccompiler.py) -repl pwsh -command "(Get-Content C:\Python311\Lib\distutils\cygwinccompiler.py) -replace 'msvcr100', 'msvcrt' | Out-File C:\Python311\Lib\distutils\cygwinccompiler.py" :: install numpy -C:\Python37\python.exe -m pip install numpy==1.14.6 "cython < 3" || goto :error -C:\Python38\python.exe -m pip install numpy==1.17.5 "cython < 3" || goto :error -C:\Python39\python.exe -m pip install numpy==1.19.3 "cython < 3" || goto :error -C:\Python310\python.exe -m pip install numpy==1.21.3 "cython < 3" || goto :error -C:\Python311\python.exe -m pip install numpy==1.23.5 "cython < 3" || goto :error -C:\Python312\python.exe -m pip install numpy==1.26.3 "cython < 3" || goto :error +C:\Python37\python.exe -m pip install numpy==1.14.6 cython || goto :error +C:\Python38\python.exe -m pip install numpy==1.17.5 cython || goto :error +C:\Python39\python.exe -m pip install numpy==1.19.3 cython || goto :error +C:\Python310\python.exe -m pip install numpy==1.21.3 cython || goto :error +C:\Python311\python.exe -m pip install numpy==1.23.5 cython || goto :error +C:\Python312\python.exe -m pip install numpy==1.26.3 cython || goto :error +C:\Python313\python.exe -m pip install numpy cython || goto :error :: setuptools 70.2 leads to an error C:\Python312\python.exe -m pip install setuptools==70.1.1 || goto :error +C:\Python313\python.exe -m pip install setuptools==70.1.1 || goto :error :: install nsis nsis-3.05-setup.exe /S || goto :error @@ -67,11 +70,11 @@ base-devel ^ mingw-w64-x86_64-cmake ^ mingw-w64-x86_64-ncurses ^ mingw-w64-x86_64-readline ^ -mingw-w64-x86_64-python3 ^ +mingw-w64-x86_64-python ^ mingw64/mingw-w64-x86_64-cython ^ -mingw-w64-x86_64-python3-setuptools ^ -mingw-w64-x86_64-python3-packaging ^ -mingw-w64-x86_64-python3-pip ^ +mingw-w64-x86_64-python-setuptools ^ +mingw-w64-x86_64-python-packaging ^ +mingw-w64-x86_64-python-pip ^ mingw64/mingw-w64-x86_64-dlfcn ^ mingw-w64-x86_64-toolchain || goto :error diff --git a/ci/win_test_installer.cmd b/ci/win_test_installer.cmd index e26dd2b139..df6c44f67a 100644 --- a/ci/win_test_installer.cmd +++ b/ci/win_test_installer.cmd @@ -23,8 +23,28 @@ C:\Python39\python -c "import neuron; neuron.test(); quit()" || set "errorfound= 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" +C:\Python313\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y" + +:: install oldest supported numpy +C:\Python37\python.exe -m pip install -r packaging/python/oldest_numpy_requirements.txt || goto :error +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 +C:\Python313\python.exe -m pip install -r packaging/python/oldest_numpy_requirements.txt || goto :error + +:: test all pythons again +C:\Python37\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y" +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" +C:\Python313\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y" + :: install numpy dependency -python -m pip install "numpy<2" +python -m pip install numpy :: run also using whatever is system python python --version python -c "import neuron; neuron.test(); quit()" || set "errorfound=y" diff --git a/ci/win_test_installer_wo_rxd.cmd b/ci/win_test_installer_wo_rxd.cmd index 369bfa39cf..86e49d0e40 100644 --- a/ci/win_test_installer_wo_rxd.cmd +++ b/ci/win_test_installer_wo_rxd.cmd @@ -26,9 +26,10 @@ C:\Python39\python -c "import neuron; neuron.test(); quit()" || set "errorfound= 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" +C:\Python313\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y" :: install numpy dependency -python -m pip install "numpy<2" +python -m pip install numpy :: run also using whatever is system python python --version python -c "import neuron; neuron.test(); quit()" || set "errorfound=y" diff --git a/docs/changelog.md b/docs/changelog.md index 803c8cb372..a1363e5f61 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,10 @@ # NEURON 8.2 +## 8.2.7 +_Release Date_ : 01-02-2025 + +This release allows use of Python 3.13 + ## 8.2.6 _Release Date_ : 24-07-2024 diff --git a/docs/conda_environment.yml b/docs/conda_environment.yml index 3c794969e7..6637782481 100644 --- a/docs/conda_environment.yml +++ b/docs/conda_environment.yml @@ -9,7 +9,7 @@ dependencies: - cmake - xorg-libxcomposite - ffmpeg - - cython<3 + - cython - pandoc - pip - pip: diff --git a/docs/domains/hocdomain.py b/docs/domains/hocdomain.py index 73ae11df5d..6a2d575e2c 100644 --- a/docs/domains/hocdomain.py +++ b/docs/domains/hocdomain.py @@ -1617,7 +1617,6 @@ def resolve_any_xref( multiple_matches = len(matches) > 1 for name, obj in matches: - if multiple_matches and obj.aliased: # Skip duplicated matches continue diff --git a/docs/index.rst b/docs/index.rst index 0df1324839..ed83cc14bb 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -88,7 +88,7 @@ Installation pip3 install neuron - Alternatively, you can use the `PKG installer `_. + Alternatively, you can use the `PKG installer `_. For troubleshooting, see the `detailed installation instructions `_. diff --git a/docs/install/install_instructions.md b/docs/install/install_instructions.md index 5a952ba735..070579e64c 100644 --- a/docs/install/install_instructions.md +++ b/docs/install/install_instructions.md @@ -205,7 +205,7 @@ In order to build NEURON from source, the following packages must be available: The following packages are optional (see build options): - Python >=3.7 (for Python interface) -- Cython < 3 (for RXD) +- Cython (for RXD) - MPI (for parallel) - X11 (Linux) or XQuartz (MacOS) (for GUI) diff --git a/docs/install/mac_pkg.md b/docs/install/mac_pkg.md index 8a36dc03b7..38145da1c7 100644 --- a/docs/install/mac_pkg.md +++ b/docs/install/mac_pkg.md @@ -55,7 +55,7 @@ cmake .. -DCMAKE_INSTALL_PREFIX=$NRN_INSTALL \ The default variables above will be ``` -pythons="python3.9;python3.10;python3.11;python3.12" +pythons="python3.9;python3.10;python3.11;python3.12;python3.13" archs_cmake='-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64' ``` diff --git a/docs/parse_rst.py b/docs/parse_rst.py index 8753626ada..0322302eb2 100644 --- a/docs/parse_rst.py +++ b/docs/parse_rst.py @@ -10,7 +10,6 @@ class ParseRst(object): - help_dictionary = {} def __init__(self, rst_path, out_file): diff --git a/nrn_requirements.txt b/nrn_requirements.txt index c4ce7d3ae0..3aacefa65b 100644 --- a/nrn_requirements.txt +++ b/nrn_requirements.txt @@ -5,9 +5,9 @@ matplotlib # bokeh 3 seems to break docs notebooks bokeh<3 ipython -cython<3 +cython packaging pytest pytest-cov mpi4py -numpy<2 +numpy diff --git a/packaging/python/build_requirements.txt b/packaging/python/build_requirements.txt index dcbd639f9c..ba9dcfb0e8 100644 --- a/packaging/python/build_requirements.txt +++ b/packaging/python/build_requirements.txt @@ -1,2 +1,2 @@ -cython<3 +cython packaging diff --git a/packaging/python/build_wheels.bash b/packaging/python/build_wheels.bash index dfa9e90f9d..d09525d16f 100755 --- a/packaging/python/build_wheels.bash +++ b/packaging/python/build_wheels.bash @@ -52,15 +52,16 @@ pip_numpy_install() { 36) numpy_ver="numpy==1.12.1" ;; 37) numpy_ver="numpy==1.14.6" ;; 38) numpy_ver="numpy==1.17.5" ;; - 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" ;; + 39) numpy_ver="numpy>=2" ;; + 310) numpy_ver="numpy>=2" ;; + 311) numpy_ver="numpy>=2" ;; + 312) numpy_ver="numpy>=2" ;; + 313) numpy_ver="numpy>=2" ;; *) 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' ]] && [[ $py_ver != 311 ]] && [[ $py_ver != 312 ]]; then + if [[ `uname -m` == 'arm64' ]] && [[ $py_ver -le 311 ]] ; then numpy_ver="numpy==1.21.3" fi diff --git a/packaging/python/oldest_numpy_requirements.txt b/packaging/python/oldest_numpy_requirements.txt new file mode 100644 index 0000000000..53f064c633 --- /dev/null +++ b/packaging/python/oldest_numpy_requirements.txt @@ -0,0 +1,8 @@ +numpy==1.14.6;python_version=='3.7' +numpy==1.17.5;python_version=='3.8' +numpy==1.20.3;python_version=='3.9' and platform_machine!='arm64' +numpy==1.21.6;python_version=='3.9' and platform_machine=='arm64' +numpy==1.21.6;python_version=='3.10' +numpy==1.23.5;python_version=='3.11' +numpy==1.26.4;python_version=='3.12' +numpy>=2;python_version=='3.13' diff --git a/packaging/python/test_requirements.txt b/packaging/python/test_requirements.txt new file mode 100644 index 0000000000..6dbabce060 --- /dev/null +++ b/packaging/python/test_requirements.txt @@ -0,0 +1,2 @@ +pytest +setuptools;python_version>='3.12' # From 3.12, no longer installed by default diff --git a/packaging/python/test_wheels.sh b/packaging/python/test_wheels.sh index e7c6ca5dc7..e64c2d2e33 100755 --- a/packaging/python/test_wheels.sh +++ b/packaging/python/test_wheels.sh @@ -274,6 +274,12 @@ test_wheel () { } +test_wheel_basic_python () { + echo "=========== BASIC PYTHON TESTS ===========" + $python_exe -c "import neuron; neuron.test(); neuron.test_rxd()" +} + + echo "== Testing $python_wheel using $python_exe ($python_ver) ==" @@ -297,10 +303,8 @@ $python_exe -m pip install --upgrade pip $python_exe -m pip install --upgrade setuptools -# install numpy, pytest and neuron -# we install setuptools because since python 3.12 it is no more installed -# by default -$python_exe -m pip install "numpy<2" pytest setuptools +# install test requirements +$python_exe -m pip install -r packaging/python/test_requirements.txt $python_exe -m pip install $python_wheel $python_exe -m pip show neuron \ || $python_exe -m pip show neuron-nightly \ @@ -332,9 +336,14 @@ if [[ "$has_gpu_support" == "true" ]]; then fi -# run tests -test_wheel $(which python) +# run tests with latest NumPy +echo " == Running tests with latest NumPy == " +test_wheel +# run basic python tests with oldest supported NumPy +echo " == Running basic python tests with oldest supported NumPy == " +$python_exe -m pip install -r packaging/python/oldest_numpy_requirements.txt +test_wheel_basic_python # cleanup if [[ "$use_venv" != "false" ]]; then diff --git a/setup.py b/setup.py index 0ca138e607..8cf867d80d 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ import os +import platform import re import shutil import subprocess @@ -211,7 +212,6 @@ def run(self, *args, **kw): the CMake building, sets the extension build environment and collects files. """ for ext in self.extensions: - if isinstance(ext, CMakeAugmentedExtension): if ext.cmake_done: continue @@ -410,7 +410,7 @@ def setup_package(): NRN_COLLECT_DIRS = ["bin", "lib", "include", "share"] docs_require = [] # sphinx, themes, etc - maybe_rxd_reqs = ["numpy<2", "Cython<3"] if Components.RX3D else [] + maybe_rxd_reqs = ["numpy", "Cython"] if Components.RX3D else [] maybe_docs = docs_require if "docs" in sys.argv else [] maybe_test_runner = ["pytest-runner"] if "test" in sys.argv else [] @@ -439,7 +439,6 @@ def setup_package(): list, library_dirs=[os.path.join(cmake_build_dir, "lib")], libraries=ext_common_libraries, - language="c++", ) logging.info("Extension common compile flags %s" % str(extension_common_params)) @@ -500,6 +499,7 @@ def setup_package(): "neuronmusic", ["src/neuronmusic/neuronmusic.pyx"], include_dirs=["src/nrnpython", "src/nrnmusic"], + language="c++", **extension_common_params, ) ] @@ -522,6 +522,9 @@ def setup_package(): ) ) + if platform.system() == "Darwin": + rxd_params["extra_link_args"] += ["-headerpad_max_install_names"] + logging.info("RX3D compile flags %s" % str(rxd_params)) extensions += [ @@ -574,7 +577,7 @@ def setup_package(): ], cmdclass=dict(build_ext=CMakeAugmentedBuilder, docs=Docs), install_requires=[ - "numpy>=1.9.3,<2", + "numpy>=1.9.3", "packaging", "find_libpython", "setuptools", @@ -614,6 +617,9 @@ def fmt(version): explicit_target = tuple( int(x) for x in os.environ["MACOSX_DEPLOYMENT_TARGET"].split(".") ) + else: + # default deployment target + explicit_target = (10, 9) # Match Python OSX framework py_osx_framework = extract_macosx_min_system_version(sys.executable) diff --git a/share/lib/python/neuron/doc.py b/share/lib/python/neuron/doc.py index 6b95673e2c..61cc9cc7c9 100644 --- a/share/lib/python/neuron/doc.py +++ b/share/lib/python/neuron/doc.py @@ -207,7 +207,6 @@ def get_docstring(objtype, symbol): f.close() if (objtype, symbol) == ("", ""): - return doc_h # are we asking for help on a class, e.g. h.Vector @@ -229,7 +228,6 @@ def get_docstring(objtype, symbol): if full_name in _help_dict: return _get_from_help_dict(full_name) else: - return default_member_doc_template % ( objtype, symbol, diff --git a/share/lib/python/neuron/rxd/geometry3d/FullJoinMorph.py b/share/lib/python/neuron/rxd/geometry3d/FullJoinMorph.py index 34553b1fa2..158748cf12 100644 --- a/share/lib/python/neuron/rxd/geometry3d/FullJoinMorph.py +++ b/share/lib/python/neuron/rxd/geometry3d/FullJoinMorph.py @@ -22,7 +22,6 @@ def find_parent_seg(join, sdict, objects): - if not join: return None elif join[0] not in objects: @@ -65,7 +64,6 @@ def sort_spheres_last(item): def fullmorph(source, dx, soma_step=100, mesh_grid=None, relevant_pts=None): - """Input: object source; arguments to pass to ctng Output: all voxels with SA and volume associated, categorized by segment""" source = list(source) diff --git a/share/lib/python/neuron/rxd/geometry3d/GeneralizedVoxelization.py b/share/lib/python/neuron/rxd/geometry3d/GeneralizedVoxelization.py index 37b358024f..83b87a8e6e 100644 --- a/share/lib/python/neuron/rxd/geometry3d/GeneralizedVoxelization.py +++ b/share/lib/python/neuron/rxd/geometry3d/GeneralizedVoxelization.py @@ -52,7 +52,7 @@ def verts_in(f, voxel, surf, g): verts = get_verts(voxel, g) ins = 0 distlist = [] - for (x, y, z) in verts: + for x, y, z in verts: if ( g["xlo"] <= x <= g["xhi"] and g["ylo"] <= y <= g["yhi"] @@ -173,7 +173,8 @@ def find_endpoints(f, surf, include_ga, row, guesses, g): def voxelize(grid, Object, corners=None, include_ga=False): """return a list of all voxels (i,j,k) that contain part of the object - Other returned elements: set of surface voxels, possibly_missed for error handling""" + Other returned elements: set of surface voxels, possibly_missed for error handling + """ # include_ga is whether to include grid-adjacent voxels in the surface, even if entirely within the surface yes_voxels = set() diff --git a/share/lib/python/neuron/rxd/geometry3d/surfaces.pyx b/share/lib/python/neuron/rxd/geometry3d/surfaces.pyx index 141adf7899..bf3aac2eb1 100644 --- a/share/lib/python/neuron/rxd/geometry3d/surfaces.pyx +++ b/share/lib/python/neuron/rxd/geometry3d/surfaces.pyx @@ -1,13 +1,11 @@ import os import numpy -import graphicsPrimitives -import neuron -import numpy cimport numpy import itertools import bisect cimport cython +from neuron.rxd.geometry3d import graphicsPrimitives """ The surfaces module diff --git a/share/lib/python/neuron/rxd/gui.py b/share/lib/python/neuron/rxd/gui.py index 6616006abe..b96e39e287 100644 --- a/share/lib/python/neuron/rxd/gui.py +++ b/share/lib/python/neuron/rxd/gui.py @@ -1204,6 +1204,7 @@ def map(self): _the_species_editor = _SpeciesEditor() + # this is a way of faking the Singleton pattern def SpeciesEditor(): if not _the_species_editor.is_mapped: @@ -1249,6 +1250,7 @@ def map(self): _the_species_pane = _SpeciesPane() + # this is a way of faking the Singleton pattern def SpeciesPane(): _the_species_pane = _SpeciesPane() @@ -1700,6 +1702,7 @@ def map(self): _the_reaction_pane = _ReactionPane() + # this is a way of faking the Singleton pattern def ReactionPane(): if not _the_reaction_pane.is_mapped: diff --git a/share/lib/python/neuron/rxd/node.py b/share/lib/python/neuron/rxd/node.py index 60e09b4d76..23360ccabe 100644 --- a/share/lib/python/neuron/rxd/node.py +++ b/share/lib/python/neuron/rxd/node.py @@ -71,7 +71,7 @@ def _remove(start, stop): # remove _node_flux newflux = {"index": [], "type": [], "source": [], "scale": [], "region": []} - for (i, idx) in enumerate(_node_fluxes["index"]): + for i, idx in enumerate(_node_fluxes["index"]): if idx not in dels: for key in _node_fluxes: newflux[key].append(_node_fluxes[key][i]) @@ -79,7 +79,7 @@ def _remove(start, stop): _has_node_fluxes = _node_fluxes["index"] != [] # remove _node_flux - for (i, idx) in enumerate(_node_fluxes["index"]): + for i, idx in enumerate(_node_fluxes["index"]): if idx in dels: for lst in _node_fluxes.values(): del lst[i] @@ -108,7 +108,7 @@ def _replace(old_offset, old_nseg, new_offset, new_nseg): _states = numpy.delete(_states, list(range(start, stop))) # update _node_flux index - for (i, idx) in enumerate(_node_fluxes["index"]): + for i, idx in enumerate(_node_fluxes["index"]): if idx in dels: j = int(((idx + 0.5) / new_nseg) * old_nseg) _node_fluxes["index"][i] = j diff --git a/share/lib/python/neuron/rxd/region.py b/share/lib/python/neuron/rxd/region.py index 5791c68130..317e3f6aa2 100644 --- a/share/lib/python/neuron/rxd/region.py +++ b/share/lib/python/neuron/rxd/region.py @@ -447,7 +447,6 @@ def _parse_tortuosity(self, value, is_permeability=False): return parsed_value, ecs_permeability def _parse_volume_fraction(self, volume_fraction): - if numpy.isscalar(volume_fraction): alpha = float(volume_fraction) alpha = alpha diff --git a/share/lib/python/neuron/rxd/rxd.py b/share/lib/python/neuron/rxd/rxd.py index 698381dfe5..2464780c24 100644 --- a/share/lib/python/neuron/rxd/rxd.py +++ b/share/lib/python/neuron/rxd/rxd.py @@ -65,7 +65,7 @@ setup_solver.argtypes = [ ndpointer(ctypes.c_double), ctypes.c_int, - numpy.ctypeslib.ndpointer(numpy.int_, flags="contiguous"), + numpy.ctypeslib.ndpointer(ctypes.c_long, flags="contiguous"), ctypes.c_int, ] @@ -608,7 +608,6 @@ def _update_node_data(force=False, newspecies=False): or _structure_change_count.value != last_structure_change_cnt or force ): - last_diam_change_cnt = _diam_change_count.value last_structure_change_cnt = _structure_change_count.value # if not species._has_3d: @@ -655,17 +654,15 @@ def _matrix_to_rxd_sparse(m): return ( n, len(nonzero_i), - numpy.ascontiguousarray(nonzero_i, dtype=numpy.int_), - numpy.ascontiguousarray(nonzero_j, dtype=numpy.int_), + numpy.ascontiguousarray(nonzero_i, dtype=ctypes.c_long), + numpy.ascontiguousarray(nonzero_j, dtype=ctypes.c_long), nonzero_values, ) # TODO: make sure this does the right thing when the diffusion constant changes between two neighboring nodes def _setup_matrices(): - with initializer._init_lock: - # update _node_fluxes in C _include_flux() @@ -674,7 +671,7 @@ def _setup_matrices(): n = len(_node_get_states()) volumes = node._get_data()[0] - zero_volume_indices = (numpy.where(volumes == 0)[0]).astype(numpy.int_) + zero_volume_indices = (numpy.where(volumes == 0)[0]).astype(ctypes.c_long) if species._has_1d: # TODO: initialization is slow. track down why @@ -1462,7 +1459,7 @@ def localize_index(creg, rate): continue fxn_string += "\n\trate = %s;" % rate_str summed_mults = collections.defaultdict(lambda: 0) - for (mult, sp) in zip(r._mult, r._sources + r._dests): + for mult, sp in zip(r._mult, r._sources + r._dests): summed_mults[creg._species_ids.get(sp()._id)] += mult for idx in sorted([k for k in summed_mults if k is not None]): operator = "+=" if species_ids_used[idx][region_id] else "=" @@ -1871,7 +1868,7 @@ def _init(): _setup_matrices() # if species._has_1d and species._1d_submatrix_n(): # volumes = node._get_data()[0] - # zero_volume_indices = (numpy.where(volumes == 0)[0]).astype(numpy.int_) + # zero_volume_indices = (numpy.where(volumes == 0)[0]).astype(ctypes.c_long) # setup_solver(_node_get_states(), len(_node_get_states()), zero_volume_indices, len(zero_volume_indices), h._ref_t, h._ref_dt) clear_rates() _setup_memb_currents() @@ -2007,7 +2004,7 @@ def _windows_remove_dlls(): kernel32.FreeLibrary.argtypes = [ctypes.c_void_p] else: kernel32 = ctypes.windll.kernel32 - for (dll_ptr, filepath) in zip(_windows_dll, _windows_dll_files): + for dll_ptr, filepath in zip(_windows_dll, _windows_dll_files): dll = dll_ptr() if dll: handle = dll._handle diff --git a/share/lib/python/neuron/rxd/section1d.py b/share/lib/python/neuron/rxd/section1d.py index 09746f0a9e..5c9b9a1440 100644 --- a/share/lib/python/neuron/rxd/section1d.py +++ b/share/lib/python/neuron/rxd/section1d.py @@ -67,7 +67,7 @@ def remove(self, rxdsec): def add_values(mat, i, js, vals): mat_i = mat[i] - for (j, val) in zip(js, vals): + for j, val in zip(js, vals): if val == 0: continue if j in mat_i: diff --git a/share/lib/python/neuron/rxd/species.py b/share/lib/python/neuron/rxd/species.py index 93fcba63ad..245223df68 100644 --- a/share/lib/python/neuron/rxd/species.py +++ b/share/lib/python/neuron/rxd/species.py @@ -60,12 +60,12 @@ ctypes.c_int, ctypes.py_object, ctypes.c_long, - numpy.ctypeslib.ndpointer(dtype=int), - numpy.ctypeslib.ndpointer(dtype=int), + numpy.ctypeslib.ndpointer(dtype=ctypes.c_long), + numpy.ctypeslib.ndpointer(dtype=ctypes.c_long), ctypes.c_long, - numpy.ctypeslib.ndpointer(dtype=int), + numpy.ctypeslib.ndpointer(dtype=ctypes.c_long), ctypes.c_long, - numpy.ctypeslib.ndpointer(dtype=int), + numpy.ctypeslib.ndpointer(dtype=ctypes.c_long), ctypes.c_long, numpy.ctypeslib.ndpointer(dtype=float), ctypes.c_double, @@ -842,7 +842,7 @@ def line_defs(self, nodes, direction, nodes_length): # sort list for parallelization line_defs.sort(key=lambda x: x[1], reverse=True) - line_defs = numpy.asarray(line_defs, dtype=int) + line_defs = numpy.asarray(line_defs, dtype=ctypes.c_long) line_defs = line_defs.reshape(2 * len(line_defs)) return line_defs @@ -862,7 +862,7 @@ def ordered_nodes(self, p_line_defs, direction, neighbors): def create_neighbors_array(self, nodes, nodes_length): self._isalive() - my_array = numpy.zeros((nodes_length, 3), dtype=int) + my_array = numpy.zeros((nodes_length, 3), dtype=ctypes.c_long) for n in nodes: for i, ele in enumerate(n.neighbors[::2]): my_array[n._index, i] = ele if ele is not None else -1 @@ -1507,7 +1507,6 @@ def _import_concentration(self): self._states[i] = getattr(seg, stateo) def _semi_compile(self, reg, instruction): - self._isalive() if self._species: sp = _defined_species[self._species][self._region]() @@ -1523,7 +1522,6 @@ def _semi_compile(self, reg, instruction): @property def d(self): - self._isalive() return self._d @@ -2283,7 +2281,8 @@ def _import_concentration(self, init=True): def nodes(self): """A NodeList of all the nodes corresponding to the species. - This can then be further restricted using the callable property of NodeList objects.""" + This can then be further restricted using the callable property of NodeList objects. + """ from . import rxd diff --git a/share/lib/python/neuron/rxdtests/tests/3d/circadian_rhythm.py b/share/lib/python/neuron/rxdtests/tests/3d/circadian_rhythm.py index 8c9aa12ecc..811da1b913 100644 --- a/share/lib/python/neuron/rxdtests/tests/3d/circadian_rhythm.py +++ b/share/lib/python/neuron/rxdtests/tests/3d/circadian_rhythm.py @@ -11,6 +11,7 @@ hour = 60 * minute h.dt = 1 * minute + # def run_sim(): def declare_parameters(**kwargs): """enables clean declaration of parameters in top namespace""" diff --git a/share/lib/python/neuron/rxdtests/tests/hh.py b/share/lib/python/neuron/rxdtests/tests/hh.py index 70f76a68dd..0736410653 100644 --- a/share/lib/python/neuron/rxdtests/tests/hh.py +++ b/share/lib/python/neuron/rxdtests/tests/hh.py @@ -61,6 +61,7 @@ # extracellular ecs = rxd.Extracellular(-100, -100, -100, 100, 100, 100, dx=100) + # Who? def init(ics, ecs): return lambda nd: ecs if isinstance(nd, rxd.node.NodeExtracellular) else ics diff --git a/share/lib/python/neuron/rxdtests/tests/hh_cvode.py b/share/lib/python/neuron/rxdtests/tests/hh_cvode.py index bf272bece6..86b23a8495 100644 --- a/share/lib/python/neuron/rxdtests/tests/hh_cvode.py +++ b/share/lib/python/neuron/rxdtests/tests/hh_cvode.py @@ -61,6 +61,7 @@ # extracellular ecs = rxd.Extracellular(-100, -100, -100, 100, 100, 100, dx=100) + # Who? def init(ics, ecs): return lambda nd: ecs if isinstance(nd, rxd.node.NodeExtracellular) else ics diff --git a/share/lib/python/neuron/rxdtests/tests/hh_param.py b/share/lib/python/neuron/rxdtests/tests/hh_param.py index 11c1f784da..5ea22df5bb 100644 --- a/share/lib/python/neuron/rxdtests/tests/hh_param.py +++ b/share/lib/python/neuron/rxdtests/tests/hh_param.py @@ -61,6 +61,7 @@ # extracellular ecs = rxd.Extracellular(-100, -100, -100, 100, 100, 100, dx=33) + # Who? def init(ics, ecs): return lambda nd: ecs if isinstance(nd, rxd.node.NodeExtracellular) else ics diff --git a/share/lib/python/neuron/rxdtests/tests/hh_param_cvode.py b/share/lib/python/neuron/rxdtests/tests/hh_param_cvode.py index f9f11f95fa..254cef35ff 100644 --- a/share/lib/python/neuron/rxdtests/tests/hh_param_cvode.py +++ b/share/lib/python/neuron/rxdtests/tests/hh_param_cvode.py @@ -61,6 +61,7 @@ # extracellular ecs = rxd.Extracellular(-100, -100, -100, 100, 100, 100, dx=33) + # Who? def init(ics, ecs): return lambda nd: ecs if isinstance(nd, rxd.node.NodeExtracellular) else ics diff --git a/share/lib/python/neuron/tests/test_all.py b/share/lib/python/neuron/tests/test_all.py index 3726bc9ff8..7af6d620e0 100644 --- a/share/lib/python/neuron/tests/test_all.py +++ b/share/lib/python/neuron/tests/test_all.py @@ -13,7 +13,6 @@ def suite(): - suite = unittest.TestSuite() suite.addTest(test_vector.suite()) suite.addTest(test_neuron.suite()) @@ -22,7 +21,6 @@ def suite(): if __name__ == "__main__": - # unittest.main() runner = unittest.TextTestRunner(verbosity=2) runner.run(suite()) diff --git a/share/lib/python/neuron/tests/test_neuron.py b/share/lib/python/neuron/tests/test_neuron.py index f706dc2f4a..5392acf9cf 100644 --- a/share/lib/python/neuron/tests/test_neuron.py +++ b/share/lib/python/neuron/tests/test_neuron.py @@ -277,13 +277,10 @@ def basicRxD3D(): def suite(): - - suite = unittest.makeSuite(NeuronTestCase, "test") - return suite + return unittest.defaultTestLoader.loadTestsFromTestCase(NeuronTestCase) if __name__ == "__main__": - # unittest.main() runner = unittest.TextTestRunner(verbosity=2) runner.run(suite()) diff --git a/share/lib/python/neuron/tests/test_rxd.py b/share/lib/python/neuron/tests/test_rxd.py index 964bd53738..db85696c90 100644 --- a/share/lib/python/neuron/tests/test_rxd.py +++ b/share/lib/python/neuron/tests/test_rxd.py @@ -798,8 +798,7 @@ def test_ecs_diffusion_variable_step_fine(self): def suite(): - suite = unittest.makeSuite(RxDTestCase, "test") - return suite + return unittest.defaultTestLoader.loadTestsFromTestCase(RxDTestCase) def test(): diff --git a/share/lib/python/neuron/tests/test_vector.py b/share/lib/python/neuron/tests/test_vector.py index efd5c672af..69166c9dcb 100644 --- a/share/lib/python/neuron/tests/test_vector.py +++ b/share/lib/python/neuron/tests/test_vector.py @@ -103,13 +103,10 @@ def testNumpyInteraction(self): def suite(): - - suite = unittest.makeSuite(VectorTestCase, "test") - return suite + return unittest.defaultTestLoader.loadTestsFromTestCase(VectorTestCase) if __name__ == "__main__": - # unittest.main() runner = unittest.TextTestRunner(verbosity=2) runner.run(suite()) diff --git a/src/nrniv/glinerec.cpp b/src/nrniv/glinerec.cpp index 7b48b68e1b..d41ad96a49 100644 --- a/src/nrniv/glinerec.cpp +++ b/src/nrniv/glinerec.cpp @@ -10,7 +10,6 @@ #include "hocparse.h" #include "code.h" -#undef begin #undef add #include diff --git a/src/nrnpython/nrnpy_hoc.cpp b/src/nrnpython/nrnpy_hoc.cpp index 2d225e7df6..c8988ce1ec 100644 --- a/src/nrnpython/nrnpy_hoc.cpp +++ b/src/nrnpython/nrnpy_hoc.cpp @@ -1596,13 +1596,16 @@ PyObject* nrnpy_forall(PyObject* self, PyObject* args) { static PyObject* hocobj_iter(PyObject* self) { // printf("hocobj_iter %p\n", self); PyHocObject* po = (PyHocObject*) self; - if (po->type_ == PyHoc::HocObject) { + if (po->type_ == PyHoc::HocObject || po->type_ == PyHoc::HocSectionListIterator) { if (po->ho_->ctemplate == hoc_vec_template_) { return PySeqIter_New(self); } else if (po->ho_->ctemplate == hoc_list_template_) { return PySeqIter_New(self); } else if (po->ho_->ctemplate == hoc_sectionlist_template_) { // need a clone of self so nested loops do not share iteritem_ + // The HocSectionListIter arm of the outer 'if' became necessary + // at Python-3.13.1 upon which the following body is executed + // twice. See https://github.com/python/cpython/issues/127682 PyObject* po2 = nrnpy_ho2po(po->ho_); PyHocObject* pho2 = (PyHocObject*) po2; pho2->type_ = PyHoc::HocSectionListIterator; diff --git a/src/nrnpython/nrnpython.cpp b/src/nrnpython/nrnpython.cpp index b774623aa5..b09a77c07d 100644 --- a/src/nrnpython/nrnpython.cpp +++ b/src/nrnpython/nrnpython.cpp @@ -210,6 +210,13 @@ extern "C" int nrnpython_start(int b) { // del g // Also, NEURONMainMenu/File/Quit did not work. The solution to both // seems to be to just avoid gui threads if MINGW and launched nrniv + + // Beginning with Python 3.13.0 it seems that the readline + // module has not been loaded yet. Since PyInit_readline sets + // PyOS_ReadlineFunctionPointer = call_readline; without checking, + // we need to import here. + PyRun_SimpleString("import readline as nrn_readline"); + PyOS_ReadlineFunctionPointer = nrnpython_getline; // Is there a -c "command" or file.py arg. diff --git a/src/oc/fileio.cpp b/src/oc/fileio.cpp index 609a2abbde..185f44db06 100644 --- a/src/oc/fileio.cpp +++ b/src/oc/fileio.cpp @@ -16,7 +16,7 @@ #include "nrnfilewrap.h" -extern jmp_buf begin; +extern jmp_buf begin_; extern char* neuron_home; NrnFILEWrap* frin; diff --git a/src/oc/hoc.cpp b/src/oc/hoc.cpp index 467dde99ef..5f5fad2875 100644 --- a/src/oc/hoc.cpp +++ b/src/oc/hoc.cpp @@ -190,7 +190,7 @@ int lineno; #include #include static int control_jmpbuf = 0; /* don't change jmp_buf if being controlled */ -jmp_buf begin; +jmp_buf begin_; static int hoc_oc_jmpbuf; static jmp_buf hoc_oc_begin; int intset; /* safer interrupt handling */ @@ -695,7 +695,7 @@ extern void hoc_newobj1_err(); * hoc_newobj1_err needs handle to know how much to unwrap the newobj1 stack. **/ void* nrn_get_hoc_jmp() { - void* jmp = hoc_oc_jmpbuf ? (void*) hoc_oc_begin : (void*) begin; + void* jmp = hoc_oc_jmpbuf ? (void*) hoc_oc_begin : (void*) begin_; return jmp; } @@ -748,7 +748,7 @@ void hoc_execerror_mes(const char* s, const char* t, int prnt) { /* recover from longjmp(hoc_oc_begin, 1); } hoc_newobj1_err(); - longjmp(begin, 1); + longjmp(begin_, 1); } extern "C" void hoc_execerror(const char* s, const char* t) /* recover from run-time error */ @@ -928,7 +928,7 @@ void hoc_main1_init(const char* pname, const char** envp) { } } progname = pname; - if (setjmp(begin)) { + if (setjmp(begin_)) { nrn_exit(1); } @@ -1007,7 +1007,7 @@ int hoc_main1(int argc, const char** argv, const char** envp) /* hoc6 */ controlled = control_jmpbuf; if (!controlled) { control_jmpbuf = 1; - if (setjmp(begin)) { + if (setjmp(begin_)) { control_jmpbuf = 0; return 1; } @@ -1385,7 +1385,7 @@ static int hoc_run1(void) /* execute until EOF */ if (!controlled) { set_signals(); control_jmpbuf = 1; - if (setjmp(begin)) { + if (setjmp(begin_)) { fin = sav_fin; if (!nrn_fw_eq(fin, stdin)) { return EXIT_FAILURE; @@ -1430,7 +1430,7 @@ static int hoc_run1(void) /* execute until EOF */ Where do we go in case of an hoc_execerror. We have to go to the beginning of hoc. But just maybe that is here. However hoc_oc may be called recursively. Or it may be called from the original hoc_run. Or it may be - There is therefore a notion of the controlling routine for the jmp_buf begin. + There is therefore a notion of the controlling routine for the jmp_buf begin_. We only do a setjmp and set the signals when there is no other controlling routine. */ diff --git a/src/oc/redef.h b/src/oc/redef.h index 0891ecef01..c680501511 100644 --- a/src/oc/redef.h +++ b/src/oc/redef.h @@ -29,7 +29,6 @@ #define argassign hoc_argassign #define assign hoc_assign #define assstr hoc_assstr -#define begin hoc_begin #define bltin hoc_bltin #define call hoc_call #define call_ob_proc hoc_call_ob_proc diff --git a/test/cover/checkresult.py b/test/cover/checkresult.py index b73c1948cd..66da19c5b5 100644 --- a/test/cover/checkresult.py +++ b/test/cover/checkresult.py @@ -42,6 +42,7 @@ def __call__(self, key, value, tol=0.0): if type(value) == type(h.Vector): # actually hoc.HocObject # Convert to list to keep the `equal` method below simple value = list(value) + # Hand-rolled comparison that uses `tol` for arithmetic values # buried inside lists of lists. def equal(a, b): diff --git a/test/cover/test_netcvode.py b/test/cover/test_netcvode.py index dbe3273130..105340cc5c 100644 --- a/test/cover/test_netcvode.py +++ b/test/cover/test_netcvode.py @@ -12,6 +12,7 @@ cv = h.CVode() pc = h.ParallelContext() + # remove address info from cv.debug_event output def debug_event_filter(s): s = re.sub(r"cvode_0x[0-9abcdef]* ", "cvode_0x... ", s) diff --git a/test/gjtests/test_par_gj.py b/test/gjtests/test_par_gj.py index d70c321333..59e89f7549 100644 --- a/test/gjtests/test_par_gj.py +++ b/test/gjtests/test_par_gj.py @@ -61,9 +61,7 @@ def mkcells(pc, ngids): assert nranks <= ngids for gid in range(ngids): - if gid % nranks == myrank: - cell = MyCell() nc = h.NetCon(cell.soma(0.5)._ref_v, None, sec=cell.soma) pc.set_gid2node(gid, myrank) @@ -101,7 +99,6 @@ def mkgjs(pc, ngids): ggid = 2e6 ## gap junction id range is intended to not overlap with gid range for gid in range(0, ngids, 2): - # source gid: all even gids src = gid # destination gid: all odd gids @@ -128,7 +125,6 @@ def mkgjs(pc, ngids): def main(): - parser = argparse.ArgumentParser(description="Parallel transfer test.") parser.add_argument( "--sparse-partrans", diff --git a/test/parallel_tests/test_bas.py b/test/parallel_tests/test_bas.py index 6c2d38bdaf..4c5cf4de3b 100644 --- a/test/parallel_tests/test_bas.py +++ b/test/parallel_tests/test_bas.py @@ -335,7 +335,6 @@ def compare_dicts(dict1, dict2): def test_bas(): - # h.execute1(...) does not call mpi_abort on failure assert h.execute1("1/0") == 0 assert h.execute1("2/0", 0) == 0 # no error message printed diff --git a/test/pynrn/test_fast_imem.py b/test/pynrn/test_fast_imem.py index 564737cc02..8f6bbe763a 100644 --- a/test/pynrn/test_fast_imem.py +++ b/test/pynrn/test_fast_imem.py @@ -256,7 +256,6 @@ def print_fast_imem(): def test_fastimem_corenrn(): - if not coreneuron_available(): return diff --git a/test/pynrn/test_hoc_po.py b/test/pynrn/test_hoc_po.py index abb1f6b8b9..5d7dfadc85 100644 --- a/test/pynrn/test_hoc_po.py +++ b/test/pynrn/test_hoc_po.py @@ -164,6 +164,7 @@ def test_2(): # BBSaveState for mixed (hoc and python cells) Ring. + # some helpers copied from ../parallel_tests/test_bas.py def subprocess_run(cmd): subprocess.run(cmd, shell=True).check_returncode() diff --git a/test/pynrn/test_nrnste.py b/test/pynrn/test_nrnste.py index d5bf746ab8..bfdf533ed5 100644 --- a/test/pynrn/test_nrnste.py +++ b/test/pynrn/test_nrnste.py @@ -51,7 +51,6 @@ def model(): def test_ste(): - m1 = model() # one state ste with two self transitions var = m1["s"](0.5)._ref_v diff --git a/test/pynrn/test_partrans.py b/test/pynrn/test_partrans.py index 8ee420565d..f0a6bd6662 100644 --- a/test/pynrn/test_partrans.py +++ b/test/pynrn/test_partrans.py @@ -59,6 +59,7 @@ def expect_error(callable, args, sec=None): ks.gmax(0) ks.erev(0) + # Cell with enough nonsense stuff to exercise transfer possibilities. class Cell: def __init__(self): @@ -186,7 +187,6 @@ def check_values(): def test_partrans(): - # no transfer targets or sources. mkmodel(4) run() diff --git a/test/pynrn/test_template_err.py b/test/pynrn/test_template_err.py index 61a2951670..4ed7c0aafb 100644 --- a/test/pynrn/test_template_err.py +++ b/test/pynrn/test_template_err.py @@ -3,7 +3,6 @@ def test_template_err(): - h( """ begintemplate TestTemplateErr1 diff --git a/test/rxd/3d/test_soma_outlines.py b/test/rxd/3d/test_soma_outlines.py index a35082022f..89607849d0 100644 --- a/test/rxd/3d/test_soma_outlines.py +++ b/test/rxd/3d/test_soma_outlines.py @@ -32,7 +32,7 @@ def __init__(self, shift=(0, 0, 0)): for i in range(sec.n3d()) ] sec.pt3dclear() - for (x, y, z, diam) in pts: + for x, y, z, diam in pts: sec.pt3dadd(x + sx, y + sy, z + sz, diam) yield (h, rxd, data, save_path, Cell) diff --git a/test/rxd/conftest.py b/test/rxd/conftest.py index 77d315f98d..79760b06df 100644 --- a/test/rxd/conftest.py +++ b/test/rxd/conftest.py @@ -1,7 +1,9 @@ +import ctypes +import gc import os.path as osp + import numpy import pytest -import gc from .testutils import collect_data @@ -77,7 +79,7 @@ def neuron_nosave_instance(neuron_import): rxd.rxd.rxd_include_node_flux1D(0, None, None, None) rxd.species._has_1d = False rxd.species._has_3d = False - rxd.rxd._zero_volume_indices = numpy.ndarray(0, dtype=numpy.int_) + rxd.rxd._zero_volume_indices = numpy.ndarray(0, dtype=ctypes.c_long) rxd.set_solve_type(dimension=1)