From 0f78511979eda28eb5f6c3d9d9837ddc35e4c54c Mon Sep 17 00:00:00 2001 From: Marcel Stimberg Date: Thu, 22 Jun 2023 12:26:19 +0200 Subject: [PATCH] Update minimal Python/numpy requirements Follows NEP29 --- .github/workflows/publish_to_pypi.yml | 19 +++++++++++++++++-- docs_sphinx/introduction/release_notes.rst | 4 +++- pyproject.toml | 4 ++-- setup.py | 6 +++--- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish_to_pypi.yml b/.github/workflows/publish_to_pypi.yml index 4e7a56ae7..c7e98db52 100644 --- a/.github/workflows/publish_to_pypi.yml +++ b/.github/workflows/publish_to_pypi.yml @@ -2,7 +2,21 @@ name: Build and publish to TestPyPI or PyPI on: [push, pull_request] jobs: + get_python_versions: + name: "Determine Python versions" + runs-on: ubuntu-latest + outputs: + min-python: ${{ steps.nep29.outputs.min-python }} + max-python: ${{ steps.nep29.outputs.max-python }} + steps: + - name: "calculate versions according to NEP29" + id: nep29 + uses: mstimberg/github-calc-nep29@v0.5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + build: + needs: [get_python_versions] name: Build 🎡 on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: @@ -22,7 +36,7 @@ jobs: with: output-dir: dist env: - CIBW_PROJECT_REQUIRES_PYTHON: ">=3.7" + CIBW_PROJECT_REQUIRES_PYTHON: ">=${{ needs.get_python_versions.outputs.min-python }}" CIBW_ARCHS_WINDOWS: auto64 CIBW_ARCHS_MACOS: x86_64 universal2 CIBW_TEST_SKIP: '*_arm64 *_universal2:arm64' @@ -36,6 +50,7 @@ jobs: path: dist build-linux: + needs: [get_python_versions] name: Build ${{ matrix.arch }} 🎡 and source 📦 on Linux runs-on: ubuntu-latest strategy: @@ -65,7 +80,7 @@ jobs: with: output-dir: dist env: - CIBW_PROJECT_REQUIRES_PYTHON: ">=3.7" + CIBW_PROJECT_REQUIRES_PYTHON: ">=${{ needs.get_python_versions.outputs.min-python }}" CIBW_ARCHS_LINUX: ${{ matrix.arch }} CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 CIBW_SKIP: 'pp* *-musllinux_*' diff --git a/docs_sphinx/introduction/release_notes.rst b/docs_sphinx/introduction/release_notes.rst index 32a27ad60..c3e8253a9 100644 --- a/docs_sphinx/introduction/release_notes.rst +++ b/docs_sphinx/introduction/release_notes.rst @@ -5,7 +5,9 @@ Brian 2.5.2 ----------- This new minor release fixes incompatibility issues with the latest numpy release, and a number of other issues. To make it easier to contribute to Brian, we have now adopted a consistent code style and updated our infrastructure so -that the style gets enforced for all new code contributions (see :ref:`code_style` for details). +that the style gets enforced for all new code contributions (see :ref:`code_style` for details). Following +`NEP 29 `_, this release supports Python 3.9 & numpy 1.21 and +newer. New features ~~~~~~~~~~~~ diff --git a/pyproject.toml b/pyproject.toml index 5ee1c0102..87d9ae3d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ requires = [ build-backend = "setuptools.build_meta" [tool.black] -target-version = ['py38'] +target-version = ['py39'] include = '^/brian2/.*\.pyi?$' extend-exclude = '^/brian2/_version.py$' preview = true @@ -17,7 +17,7 @@ preview = true [tool.isort] atomic = true profile = "black" -py_version = "38" +py_version = "39" skip_gitignore = true # NOTE: isort has no "include" option, only "skip". extend_skip = ["brian2/_version.py"] diff --git a/setup.py b/setup.py index a6a6526ed..744d20656 100644 --- a/setup.py +++ b/setup.py @@ -157,7 +157,7 @@ def build_extension(self, ext): 'brian2.random': ['randomkit/randomkit.c', 'randomkit/randomkit.h'] }, - install_requires=['numpy>=1.17', + install_requires=['numpy>=1.21', 'cython>=0.29', 'sympy>=1.2', 'pyparsing', @@ -169,6 +169,7 @@ def build_extension(self, ext): setup_requires=['numpy>=1.10', 'setuptools>=24.2' ], + python_requires='>=3.9', cmdclass=versioneer.get_cmdclass({'build_ext': optional_build_ext}), provides=['brian2'], extras_require={'test': ['pytest', @@ -199,6 +200,5 @@ def build_extension(self, ext): 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Topic :: Scientific/Engineering :: Bio-Informatics' - ], - python_requires='>=3.7' + ] )