Skip to content

Commit

Permalink
Merge pull request #1993 from TylerADavis/tyler_oldest_numpy
Browse files Browse the repository at this point in the history
Switch to use oldest_supported_numpy for build-time requirements
  • Loading branch information
takluyver committed Nov 10, 2021
2 parents dfb29a0 + f09cabe commit b6e3047
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 24 deletions.
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

0 comments on commit b6e3047

Please sign in to comment.