From 2672eb4862694cc265e1e38ce80c1764aa498810 Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Tue, 18 Jul 2023 15:58:53 +0200 Subject: [PATCH 1/5] 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. --- build-constraints.txt | 5 +---- pyproject.toml | 3 ++- requirements.txt | 3 ++- setup.cfg | 7 +++++-- spacy/tests/package/test_requirements.py | 3 ++- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/build-constraints.txt b/build-constraints.txt index c1e82f1b074..5540d634d69 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 dcb5cf10d18..c611c6c1c93 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 f5050fee2b1..25c03056a5d 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 048bb37197e..01b12c049bd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -32,9 +32,11 @@ project_urls = zip_safe = false include_package_data = true python_requires = >=3.6 +# NOTE: setup_requires no longer used and will be removed in spaCy v4 setup_requires = cython>=0.25,<3.0 - numpy>=1.15.0 + numpy>=1.15.0; python_version < "3.9" + numpy>=1.25.0; python_version >= "3.9" # We also need our Cython packages here to compile against cymem>=2.0.2,<2.1.0 preshed>=3.0.2,<3.1.0 @@ -57,7 +59,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 9e83d5fb1f3..5ba85b8a1ba 100644 --- a/spacy/tests/package/test_requirements.py +++ b/spacy/tests/package/test_requirements.py @@ -4,8 +4,8 @@ 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", @@ -22,6 +22,7 @@ def test_build_dependencies(): ] # ignore language-specific packages that shouldn't be installed by all libs_ignore_setup = [ + "numpy", "fugashi", "natto-py", "pythainlp", From 4306f516bc4a6b3437b5393ff1b6b6ae54957d2d Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Tue, 18 Jul 2023 17:05:54 +0200 Subject: [PATCH 2/5] Turn off fail-fast --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f177fbcb679..2954c5c245f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -49,7 +49,7 @@ jobs: name: Test needs: Validate strategy: - fail-fast: true + fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] python_version: ["3.11"] From 94ef5d3fde837c634d0a7b59abdb1bbf3754489c Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Tue, 18 Jul 2023 17:30:45 +0200 Subject: [PATCH 3/5] Revert "Turn off fail-fast" This reverts commit 4306f516bc4a6b3437b5393ff1b6b6ae54957d2d. --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2954c5c245f..f177fbcb679 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -49,7 +49,7 @@ jobs: name: Test needs: Validate strategy: - fail-fast: false + fail-fast: true matrix: os: [ubuntu-latest, windows-latest, macos-latest] python_version: ["3.11"] From 4f2a777a7c0dd2fd4a92edfe90448b407805b57f Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Tue, 18 Jul 2023 17:30:59 +0200 Subject: [PATCH 4/5] Update for python 3.6 --- setup.cfg | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 01b12c049bd..da14a6c8d83 100644 --- a/setup.cfg +++ b/setup.cfg @@ -32,11 +32,13 @@ project_urls = zip_safe = false include_package_data = true python_requires = >=3.6 -# NOTE: setup_requires no longer used and will be removed in spaCy v4 +# NOTE: This section is superseded by pyproject.toml will be removed in spaCy v4 setup_requires = cython>=0.25,<3.0 - numpy>=1.15.0; python_version < "3.9" - numpy>=1.25.0; python_version >= "3.9" + # 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 preshed>=3.0.2,<3.1.0 From ac8e82d9bbad8c6f2a689ffd128e512783821368 Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Fri, 21 Jul 2023 13:35:47 +0200 Subject: [PATCH 5/5] Fix typo --- setup.cfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index da14a6c8d83..d94c9c73bee 100644 --- a/setup.cfg +++ b/setup.cfg @@ -32,7 +32,8 @@ project_urls = zip_safe = false include_package_data = true python_requires = >=3.6 -# NOTE: This section is superseded by pyproject.toml will be removed in spaCy v4 +# 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