From 5888afa8840fc73afe09d45745c69de0b7828328 Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Mon, 24 Jul 2023 10:32:56 +0200 Subject: [PATCH] Update numpy build constraints for numpy 1.25 (#12839) * Update numpy build constraints for numpy 1.25 Starting in numpy 1.25 (see https://github.com/numpy/numpy/releases/tag/v1.25.0), the numpy C API is backwards-compatible by default. For python 3.9+, we should be able to drop the specific numpy build requirements and use `numpy>=1.25`, which is currently backwards-compatible to `numpy>=1.19`. In the future, the python <3.9 requirements could be dropped and the lower numpy pin could correspond to the oldest supported version for the current lower python pin. * Turn off fail-fast * Revert "Turn off fail-fast" This reverts commit 4306f516bc4a6b3437b5393ff1b6b6ae54957d2d. * Update for python 3.6 * Fix typo --- build-constraints.txt | 5 +---- pyproject.toml | 3 ++- requirements.txt | 3 ++- setup.cfg | 8 +++++++- spacy/tests/package/test_requirements.py | 3 ++- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/build-constraints.txt b/build-constraints.txt index c1e82f1b0..5540d634d 100644 --- a/build-constraints.txt +++ b/build-constraints.txt @@ -3,7 +3,4 @@ numpy==1.15.0; python_version<='3.7' and platform_machine!='aarch64' numpy==1.19.2; python_version<='3.7' and platform_machine=='aarch64' numpy==1.17.3; python_version=='3.8' and platform_machine!='aarch64' numpy==1.19.2; python_version=='3.8' and platform_machine=='aarch64' -numpy==1.19.3; python_version=='3.9' -numpy==1.21.3; python_version=='3.10' -numpy==1.23.2; python_version=='3.11' -numpy; python_version>='3.12' +numpy>=1.25.0; python_version>='3.9' diff --git a/pyproject.toml b/pyproject.toml index dcb5cf10d..c611c6c1c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,8 @@ requires = [ "preshed>=3.0.2,<3.1.0", "murmurhash>=0.28.0,<1.1.0", "thinc>=8.1.8,<8.2.0", - "numpy>=1.15.0", + "numpy>=1.15.0; python_version < '3.9'", + "numpy>=1.25.0; python_version >= '3.9'", ] build-backend = "setuptools.build_meta" diff --git a/requirements.txt b/requirements.txt index 2123ae976..9e787a223 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,8 @@ pathy>=0.10.0 smart-open>=5.2.1,<7.0.0 weasel>=0.1.0,<0.2.0 # Third party dependencies -numpy>=1.15.0 +numpy>=1.15.0; python_version < "3.9" +numpy>=1.19.0; python_version >= "3.9" requests>=2.13.0,<3.0.0 tqdm>=4.38.0,<5.0.0 pydantic>=1.7.4,!=1.8,!=1.8.1,<1.11.0 diff --git a/setup.cfg b/setup.cfg index 048bb3719..d94c9c73b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -32,8 +32,13 @@ project_urls = zip_safe = false include_package_data = true python_requires = >=3.6 +# NOTE: This section is superseded by pyproject.toml and will be removed in +# spaCy v4 setup_requires = cython>=0.25,<3.0 + # The newest supported pip for python 3.6 has bugs related to markers in + # this section, so this does not contain the same constraints as + # pyproject.toml numpy>=1.15.0 # We also need our Cython packages here to compile against cymem>=2.0.2,<2.1.0 @@ -57,7 +62,8 @@ install_requires = pathy>=0.10.0 smart-open>=5.2.1,<7.0.0 tqdm>=4.38.0,<5.0.0 - numpy>=1.15.0 + numpy>=1.15.0; python_version < "3.9" + numpy>=1.19.0; python_version >= "3.9" requests>=2.13.0,<3.0.0 pydantic>=1.7.4,!=1.8,!=1.8.1,<1.11.0 jinja2 diff --git a/spacy/tests/package/test_requirements.py b/spacy/tests/package/test_requirements.py index fab1e8218..ff07c5b45 100644 --- a/spacy/tests/package/test_requirements.py +++ b/spacy/tests/package/test_requirements.py @@ -4,8 +4,8 @@ from pathlib import Path def test_build_dependencies(): # Check that library requirements are pinned exactly the same across different setup files. - # TODO: correct checks for numpy rather than ignoring libs_ignore_requirements = [ + "numpy", "pytest", "pytest-timeout", "mock", @@ -23,6 +23,7 @@ def test_build_dependencies(): ] # ignore language-specific packages that shouldn't be installed by all libs_ignore_setup = [ + "numpy", "fugashi", "natto-py", "pythainlp",