Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to use oldest_supported_numpy for build-time requirements #1993

Merged
merged 6 commits into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions news/oldest-supported-numpy.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
New features
------------

* <news item>

Deprecations
------------

* <news item>

Exposing HDF5 functions
-----------------------

* <news item>

Bug fixes
---------

* <news item>

Building h5py
-------------

* h5py now requires the ``oldest-supported-numpy`` package at build time,
instead of maintaining its own list of the oldest supported NumPy versions.
The effect should be similar, but hopefully more reliable.

Development
-----------

* <news item>
10 changes: 9 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
[build-system]
# Further build requirements - like numpy & cython - come from setup.py via
# the PEP 517 interface.
requires = ["setuptools", "wheel"]
requires = [
"setuptools",
"wheel",
"oldest-supported-numpy",
"pkgconfig",
"Cython >=0.29; python_version<'3.8'",
"Cython >=0.29.14; python_version=='3.8'",
"Cython >=0.29.15; python_version>='3.9'",
]
build-backend = "setuptools.build_meta"
35 changes: 12 additions & 23 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
"""

from setuptools import Extension, setup
from distutils.cmd import Command
import sys
import os
import os.path as op

# Newer packaging standards may recommend removing the current dir from the
# path, add it back if needed.
Expand All @@ -24,35 +22,26 @@

VERSION = '3.5.0'

# Minimum supported versions of Numpy & Cython depend on the Python version
NUMPY_MIN_VERSIONS = [
# Numpy Python
('1.14.5', "=='3.7'"),
('1.17.5', "=='3.8'"),
('1.19.3', "=='3.9'"),
('1.21.3', ">='3.10'"),
]

# these are required to use h5py
RUN_REQUIRES = ["cached-property; python_version<'3.8'"] + [
f"numpy >={np_min}; python_version{py_condition}"
for np_min, py_condition in NUMPY_MIN_VERSIONS
RUN_REQUIRES = [
"cached-property; python_version<'3.8'",
# We only really aim to support NumPy & Python combinations for which
# there are wheels on PyPI (e.g. NumPy >=1.17.5 for Python 3.8).
# But we don't want to duplicate the information in oldest-supported-numpy
# here, and if you can build an older NumPy on a newer Python, h5py probably
# works (assuming you build it from source too).
# NumPy 1.14.5 is the first with wheels for Python 3.7, our minimum Python.
"numpy >=1.14.5",
]

# these are required to build h5py
# Packages needed to build h5py (in addition to static list in pyproject.toml)
# For packages we link to (numpy, mpi4py), we build against the oldest
# supported version; h5py wheels should then work with newer versions of these.
# Downstream packagers - e.g. Linux distros - can safely build with newer
# versions.
SETUP_REQUIRES = [
'pkgconfig',
"Cython >=0.29; python_version<'3.8'",
"Cython >=0.29.14; python_version=='3.8'",
"Cython >=0.29.15; python_version>='3.9'",
] + [
f"numpy =={np_min}; python_version{py_condition}"
for np_min, py_condition in NUMPY_MIN_VERSIONS
]
# TODO: setup_requires is deprecated in setuptools.
SETUP_REQUIRES = []

if setup_configure.mpi_enabled():
RUN_REQUIRES.append('mpi4py >=3.0.2')
Expand Down