diff --git a/pyproject.toml b/pyproject.toml index c3479b5c6..f27a28bf4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,5 +3,16 @@ requires = [ "setuptools", "versioneer", "wheel", - "oldest-supported-numpy" + "oldest-supported-numpy ; python_version < '3.9'", + # Comments on numpy build requirement range: + # + # 1. >=2.0.x is the numpy requirement for wheel builds for distribution + # on PyPI - building against 2.x yields wheels that are also + # ABI-compatible with numpy 1.x at runtime. + # 2. Note that building against numpy 1.x works fine too - users and + # redistributors can do this by installing the numpy version they like + # and disabling build isolation. + # 3. The <2.3 upper bound is for matching the numpy deprecation policy, + # it should not be loosened + "numpy>=2.0.0rc1<2.3 ; python_version >= '3.9'", ] diff --git a/setup.py b/setup.py index c6d8fee4d..222a1b6e2 100644 --- a/setup.py +++ b/setup.py @@ -196,7 +196,10 @@ def get_long_description(): install_requires=["numpy"], extras_require={"doc": ["numpydoc", "sphinx", "gitpython"]}, cmdclass=cmdclass, - setup_requires=["numpy"], + setup_requires=[ + "oldest-supported-numpy ; python_version < '3.9'", + "numpy>=2.0.0rc1 ; python_version >= '3.9'" + ], ext_modules=prepare_modules(), zip_safe=False, )