summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2021-08-18 08:59:51 -0600
committerGitHub <noreply@github.com>2021-08-18 08:59:51 -0600
commitf520fc17373023598f6ee11d9770faf5bdd13e4d (patch)
treef4e19d3a13664e0d37f7609d76c9b89dadcb5b44
parent89aa26f6b3c07666dc10b488786f4878660e07ea (diff)
parent0f1aea6959df0831d1e9c72854cfc1db3b2fa327 (diff)
downloadnumpy-f520fc17373023598f6ee11d9770faf5bdd13e4d.tar.gz
Merge pull request #19665 from charris/drop-python3.7
MAINT: Drop Python3.7 from supported versions.
-rw-r--r--.github/workflows/build_test.yml26
-rw-r--r--azure-pipelines.yml65
-rw-r--r--doc/release/upcoming_changes/19655.change.rst4
-rw-r--r--numpy/__init__.py94
-rw-r--r--numpy/core/src/multiarray/alloc.c5
-rw-r--r--numpy/tests/test_public_api.py18
-rwxr-xr-xsetup.py7
7 files changed, 89 insertions, 130 deletions
diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml
index 7743e4493..950294fe8 100644
--- a/.github/workflows/build_test.yml
+++ b/.github/workflows/build_test.yml
@@ -56,7 +56,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- python-version: [3.7, 3.9, 3.10.0-rc.1]
+ python-version: [3.9, 3.10.0-rc.1]
steps:
- uses: actions/checkout@v2
with:
@@ -202,18 +202,18 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }}
- uses: ./.github/actions
- pypy37:
- needs: [smoke_test]
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- with:
- submodules: recursive
- fetch-depth: 0
- - uses: actions/setup-python@v2
- with:
- python-version: pypy-3.7-v7.3.4
- - uses: ./.github/actions
+ #pypy37:
+ #needs: [smoke_test]
+ #runs-on: ubuntu-latest
+ #steps:
+ #- uses: actions/checkout@v2
+ #with:
+ #submodules: recursive
+ #fetch-depth: 0
+ #- uses: actions/setup-python@v2
+ #with:
+ #python-version: pypy-3.7-v7.3.4
+ #- uses: ./.github/actions
sdist:
needs: [smoke_test]
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 03571aed2..9348d5bb0 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -241,17 +241,6 @@ stages:
strategy:
maxParallel: 6
matrix:
- # Python37 32 bit fast tested in InitialTest stage.
- Python37-64bit-full:
- PYTHON_VERSION: '3.7'
- PYTHON_ARCH: 'x64'
- TEST_MODE: full
- BITS: 64
- #PyPy37-64bit-full:
- # PYTHON_VERSION: 'PyPy3.7'
- # PYTHON_ARCH: 'x64'
- # TEST_MODE: fast
- # BITS: 64
Python38-32bit-fast:
PYTHON_VERSION: '3.8'
PYTHON_ARCH: 'x86'
@@ -278,33 +267,6 @@ stages:
- template: azure-steps-windows.yml
- - job: Linux_gcc48
- pool:
- # ubuntu-20.04 does not provide a gcc-4.8 package
- vmImage: 'ubuntu-18.04'
- steps:
- - script: |
- sudo apt update
- sudo apt install python3.7
- sudo apt install python3.7-dev
- if ! `gcc-4.8 2>/dev/null`; then
- sudo apt install gcc-4.8
- fi
- displayName: 'add gcc 4.8'
- - script: |
- # python3 has no setuptools, so install one to get us going
- python3.7 -m pip install --user --upgrade pip 'setuptools<49.2.0'
- python3.7 -m pip install --user -r test_requirements.txt
- CPPFLAGS='' CC=gcc-4.8 F77=gfortran-5 F90=gfortran-5 \
- python3.7 runtests.py --debug-info --mode=full -- -rsx --junitxml=junit/test-results.xml
- displayName: 'Run gcc4.8 Build / Tests'
- - task: PublishTestResults@2
- condition: succeededOrFailed()
- inputs:
- testResultsFiles: '**/test-*.xml'
- failTaskOnFailedTests: true
- testRunTitle: 'Publish test results for gcc 4.8'
-
- job: Linux_conda
pool:
vmImage: 'ubuntu-20.04'
@@ -333,3 +295,30 @@ stages:
failTaskOnFailedTests: true
testRunTitle: 'Publish test results for conda installation'
+
+ #- job: Linux_gcc48
+ #pool:
+ ## ubuntu-20.04 does not provide a gcc-4.8 package
+ #vmImage: 'ubuntu-18.04'
+ #steps:
+ #- script: |
+ #sudo apt update
+ #sudo apt install python3.7
+ #sudo apt install python3.7-dev
+ #if ! `gcc-4.8 2>/dev/null`; then
+ #sudo apt install gcc-4.8
+ #fi
+ #displayName: 'add gcc 4.8'
+ #- script: |
+ ## python3 has no setuptools, so install one to get us going
+ #python3.7 -m pip install --user --upgrade pip 'setuptools<49.2.0'
+ #python3.7 -m pip install --user -r test_requirements.txt
+ #CPPFLAGS='' CC=gcc-4.8 F77=gfortran-5 F90=gfortran-5 \
+ #python3.7 runtests.py --debug-info --mode=full -- -rsx --junitxml=junit/test-results.xml
+ #displayName: 'Run gcc4.8 Build / Tests'
+ #- task: PublishTestResults@2
+ #condition: succeededOrFailed()
+ #inputs:
+ #testResultsFiles: '**/test-*.xml'
+ #failTaskOnFailedTests: true
+ #testRunTitle: 'Publish test results for gcc 4.8'
diff --git a/doc/release/upcoming_changes/19655.change.rst b/doc/release/upcoming_changes/19655.change.rst
new file mode 100644
index 000000000..2c2315dd2
--- /dev/null
+++ b/doc/release/upcoming_changes/19655.change.rst
@@ -0,0 +1,4 @@
+Python 3.7 is no longer supported
+---------------------------------
+Python support has been dropped. This is rather strict, there are
+changes that require Python >=3.8.
diff --git a/numpy/__init__.py b/numpy/__init__.py
index 8546238ec..27bedb6c1 100644
--- a/numpy/__init__.py
+++ b/numpy/__init__.py
@@ -270,70 +270,54 @@ else:
oldnumeric = 'removed'
numarray = 'removed'
- if sys.version_info[:2] >= (3, 7):
- # module level getattr is only supported in 3.7 onwards
- # https://www.python.org/dev/peps/pep-0562/
- def __getattr__(attr):
- # Warn for expired attributes, and return a dummy function
- # that always raises an exception.
- try:
- msg = __expired_functions__[attr]
- except KeyError:
- pass
- else:
- warnings.warn(msg, DeprecationWarning, stacklevel=2)
-
- def _expired(*args, **kwds):
- raise RuntimeError(msg)
-
- return _expired
-
- # Emit warnings for deprecated attributes
- try:
- val, msg = __deprecated_attrs__[attr]
- except KeyError:
- pass
- else:
- warnings.warn(msg, DeprecationWarning, stacklevel=2)
- return val
-
- # Importing Tester requires importing all of UnitTest which is not a
- # cheap import Since it is mainly used in test suits, we lazy import it
- # here to save on the order of 10 ms of import time for most users
- #
- # The previous way Tester was imported also had a side effect of adding
- # the full `numpy.testing` namespace
- if attr == 'testing':
- import numpy.testing as testing
- return testing
- elif attr == 'Tester':
- from .testing import Tester
- return Tester
-
- raise AttributeError("module {!r} has no attribute "
- "{!r}".format(__name__, attr))
-
- def __dir__():
- return list(globals().keys() | {'Tester', 'testing'})
+ def __getattr__(attr):
+ # Warn for expired attributes, and return a dummy function
+ # that always raises an exception.
+ try:
+ msg = __expired_functions__[attr]
+ except KeyError:
+ pass
+ else:
+ warnings.warn(msg, DeprecationWarning, stacklevel=2)
- else:
- # We don't actually use this ourselves anymore, but I'm not 100% sure that
- # no-one else in the world is using it (though I hope not)
- from .testing import Tester
+ def _expired(*args, **kwds):
+ raise RuntimeError(msg)
- # We weren't able to emit a warning about these, so keep them around
- globals().update({
- k: v
- for k, (v, msg) in __deprecated_attrs__.items()
- })
+ return _expired
+ # Emit warnings for deprecated attributes
+ try:
+ val, msg = __deprecated_attrs__[attr]
+ except KeyError:
+ pass
+ else:
+ warnings.warn(msg, DeprecationWarning, stacklevel=2)
+ return val
+
+ # Importing Tester requires importing all of UnitTest which is not a
+ # cheap import Since it is mainly used in test suits, we lazy import it
+ # here to save on the order of 10 ms of import time for most users
+ #
+ # The previous way Tester was imported also had a side effect of adding
+ # the full `numpy.testing` namespace
+ if attr == 'testing':
+ import numpy.testing as testing
+ return testing
+ elif attr == 'Tester':
+ from .testing import Tester
+ return Tester
+
+ raise AttributeError("module {!r} has no attribute "
+ "{!r}".format(__name__, attr))
+
+ def __dir__():
+ return list(globals().keys() | {'Tester', 'testing'})
# Pytest testing
from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
del PytestTester
-
def _sanity_check():
"""
Quick sanity checks for common bugs caused by environment.
diff --git a/numpy/core/src/multiarray/alloc.c b/numpy/core/src/multiarray/alloc.c
index 887deff53..e74056736 100644
--- a/numpy/core/src/multiarray/alloc.c
+++ b/numpy/core/src/multiarray/alloc.c
@@ -3,11 +3,6 @@
#include "structmember.h"
#include <pymem.h>
-/* public api in 3.7 */
-#if PY_VERSION_HEX < 0x03070000
-#define PyTraceMalloc_Track _PyTraceMalloc_Track
-#define PyTraceMalloc_Untrack _PyTraceMalloc_Untrack
-#endif
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE
diff --git a/numpy/tests/test_public_api.py b/numpy/tests/test_public_api.py
index 3fa2edd8f..ad04f5cec 100644
--- a/numpy/tests/test_public_api.py
+++ b/numpy/tests/test_public_api.py
@@ -52,22 +52,8 @@ def test_numpy_namespace():
'show_config': 'numpy.__config__.show',
'who': 'numpy.lib.utils.who',
}
- if sys.version_info < (3, 7):
- # These built-in types are re-exported by numpy.
- builtins = {
- 'bool': 'builtins.bool',
- 'complex': 'builtins.complex',
- 'float': 'builtins.float',
- 'int': 'builtins.int',
- 'long': 'builtins.int',
- 'object': 'builtins.object',
- 'str': 'builtins.str',
- 'unicode': 'builtins.str',
- }
- allowlist = dict(undocumented, **builtins)
- else:
- # after 3.7, we override dir to not show these members
- allowlist = undocumented
+ # We override dir to not show these members
+ allowlist = undocumented
bad_results = check_dir(np)
# pytest gives better error messages with the builtin assert than with
# assert_equal
diff --git a/setup.py b/setup.py
index 826610466..245c23676 100755
--- a/setup.py
+++ b/setup.py
@@ -30,8 +30,9 @@ import re
# Python supported version checks. Keep right after stdlib imports to ensure we
# get a sensible error for older Python versions
+# This needs to be changed to 3.8 for 1.22 release, but 3.7 is needed for LGTM.
if sys.version_info[:2] < (3, 7):
- raise RuntimeError("Python version >= 3.7 required.")
+ raise RuntimeError("Python version >= 3.8 required.")
import versioneer
@@ -90,9 +91,9 @@ License :: OSI Approved :: BSD License
Programming Language :: C
Programming Language :: Python
Programming Language :: Python :: 3
-Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
+Programming Language :: Python :: 3.10
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: Implementation :: CPython
Topic :: Software Development
@@ -405,7 +406,7 @@ def setup_package():
test_suite='pytest',
version=versioneer.get_version(),
cmdclass=cmdclass,
- python_requires='>=3.7',
+ python_requires='>=3.8',
zip_safe=False,
entry_points={
'console_scripts': f2py_cmds