Skip to content

Commit 955a55e

Browse files
authored
NEP29: Set minimum required versions to NumPy 1.17+ and Python 3.7+ (#1074)
Start adopting NEP29 - Recommend Python and NumPy version support as a community policy standard, see https://numpy.org/neps/nep-0029-deprecation_policy.html. Bumps minimum supported NumPy version to 1.17 in the setup.py, requirements.txt and environment.yml files. Also set minimum required Python version to be 3.7+. * Modify CI test matrix to test on Numpy 1.17 and 1.20, Python 3.7 and 3.9 Test only on minimum and maximum supported versions according to NEP. I.e. minimum of NumPy 1.17 and Py3.7, maximum of NumPy 1.20 and Py3.9. This drops testing on the middle Python 3.8 version to conserve CI resources. * Add NumPy version to codecov reporting * Update website links of PyGMT deps to use https and official sources * Update MAINTENANCE.md to mention two Linux CI jobs are run in draft PRs * Place NEP29 dependencies policy in MAINTENANCE.md * List NumPy in compatibility version list on main README.rst page
1 parent 9ecb7d8 commit 955a55e

File tree

7 files changed

+57
-34
lines changed

7 files changed

+57
-34
lines changed

.github/workflows/ci_tests.yaml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ on:
2525

2626
jobs:
2727
test:
28-
name: ${{ matrix.os }} - Python ${{ matrix.python-version }}
28+
name: ${{ matrix.os }} - Python ${{ matrix.python-version }} / NumPy ${{ matrix.numpy-version }}
2929
runs-on: ${{ matrix.os }}
3030
strategy:
3131
fail-fast: false
3232
matrix:
33-
python-version: [3.7, 3.8, 3.9]
33+
python-version: [3.7, 3.9]
3434
os: [ubuntu-latest, macOS-latest, windows-latest]
3535
# Is it a draft Pull Request (true or false)?
3636
isDraft:
@@ -41,20 +41,24 @@ jobs:
4141
isDraft: true
4242
- os: windows-latest
4343
isDraft: true
44-
- os: ubuntu-latest
45-
python-version: 3.7
46-
isDraft: true
47-
- os: ubuntu-latest
48-
python-version: 3.8
49-
isDraft: true
44+
# - os: ubuntu-latest
45+
# python-version: 3.7
46+
# isDraft: true
47+
# Pair Python 3.7 with NumPy 1.17 and Python 3.9 with NumPy 1.20
48+
include:
49+
- python-version: 3.7
50+
numpy-version: '1.17'
51+
- python-version: 3.9
52+
numpy-version: '1.20'
5053
defaults:
5154
run:
5255
shell: bash -l {0}
5356

54-
# environmental variables used in coverage
57+
# Environment variables used by codecov
5558
env:
5659
OS: ${{ matrix.os }}
5760
PYTHON: ${{ matrix.python-version }}
61+
NUMPY: ${{ matrix.numpy-version }}
5862

5963
steps:
6064
# Cancel previous runs that are not completed
@@ -82,7 +86,8 @@ jobs:
8286
# Install GMT and other required dependencies from conda-forge
8387
- name: Install dependencies
8488
run: |
85-
conda install gmt=6.1.1 numpy pandas xarray netCDF4 packaging \
89+
conda install gmt=6.1.1 numpy=${{ matrix.numpy-version }} \
90+
pandas xarray netCDF4 packaging \
8691
codecov coverage[toml] dvc ipython make \
8792
pytest-cov pytest-mpl pytest>=6.0 \
8893
sphinx-gallery
@@ -138,5 +143,5 @@ jobs:
138143
uses: codecov/[email protected]
139144
with:
140145
file: ./coverage.xml # optional
141-
env_vars: OS,PYTHON
146+
env_vars: OS,PYTHON,NUMPY
142147
fail_ci_if_error: false

MAINTENANCE.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ If you want to make a contribution to the project, see the
1212
* [Reviewing and Merging Pull Requests](#reviewing-and-merging-pull-requests)
1313
* [Continuous Integration](#continuous-integration)
1414
* [Continuous Documentation](#continuous-documentation)
15+
* [Dependencies Policy](#dependencies-policy)
1516
* [Making a Release](#making-a-release)
1617
- [Updating the Changelog](#updating-the-changelog)
1718
- [Check the README Syntax](#check-the-readme-syntax)
@@ -77,8 +78,9 @@ There are 9 configuration files located in `.github/workflows`:
7778

7879
This is run on every commit to the *master* and Pull Request branches.
7980
It is also scheduled to run daily on the *master* branch.
80-
In draft Pull Requests, only one job (Linux + Python latest)
81-
is triggered to save on Continuous Integration resources.
81+
In draft Pull Requests, only two jobs on Linux (minimum NEP29 Python/NumPy versions
82+
and latest Python/NumPy versions) are triggered to save on Continuous Integration
83+
resources.
8284

8385
3. `ci_docs.yml` (Build documentation on Linux/macOS/Windows)
8486

@@ -135,6 +137,22 @@ The actual script `package.json` is used by Vercel to install the necessary pack
135137
build the documentation, copy the files to a 'public' folder and deploy that to the web,
136138
see https://vercel.com/docs/build-step.
137139

140+
141+
## Dependencies Policy
142+
143+
PyGMT has adopted [NEP29](https://numpy.org/neps/nep-0029-deprecation_policy)
144+
alongside the rest of the Scientific Python ecosystem, and therefore supports:
145+
146+
* All minor versions of Python released 42 months prior to the project,
147+
and at minimum the two latest minor versions.
148+
* All minor versions of NumPy released in the 24 months prior to the project,
149+
and at minimum the last three minor versions.
150+
151+
In `setup.py`, the `python_requires` variable should be set to the minimum
152+
supported version of Python. Minimum Python and NumPy version support should be
153+
adjusted upward on every major and minor release, but never on a patch release.
154+
155+
138156
## Making a Release
139157

140158
We try to automate the release process as much as possible.

README.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,15 @@ Documentation for other versions
229229
* `v0.1.0 <https://www.pygmt.org/v0.1.0>`__
230230
* `v0.0.1a0 <https://www.pygmt.org/0.0.1a0>`__
231231

232-
Compatibility with Python and GMT versions
233-
------------------------------------------
232+
Compatibility with GMT and Python/NumPy versions
233+
------------------------------------------------
234234

235-
======= ========== =========
236-
PyGMT GMT Python
237-
======= ========== =========
235+
======= ========== ========= =========
236+
PyGMT GMT Python NumPy
237+
======= ========== ========= =========
238+
0.4.x >=6.2.0 >=3.7 >=1.17.0
238239
0.3.x >=6.1.1 >=3.7
239240
0.2.1 >=6.1.1 >=3.6
240241
0.2.0 >=6.1.1 3.6 - 3.8
241242
0.1.x >=6.0.0 3.6 - 3.8
242-
======= ========== =========
243+
======= ========== ========= =========

doc/install.rst

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ Start by looking at the tutorials on our sidebar, good luck!
4646
Which Python?
4747
-------------
4848

49-
PyGMT is tested to run on **Python 3.7 or greater**. Older Python versions may
50-
work, but there is no guarantee that PyGMT will behave as expected.
49+
PyGMT is tested to run on **Python 3.7 or greater**.
5150

5251
We recommend using the `Anaconda <https://www.anaconda.com/distribution>`__
5352
Python distribution to ensure you have all dependencies installed and the
@@ -79,19 +78,17 @@ We recommend following the instructions further on to install GMT 6.
7978
Dependencies
8079
------------
8180

82-
PyGMT requires the following libraries:
81+
PyGMT requires the following libraries to be installed:
8382

84-
* `numpy <http://www.numpy.org/>`__
85-
* `pandas <https://pandas.pydata.org/>`__
86-
* `xarray <http://xarray.pydata.org/>`__
87-
* `netCDF4 <https://github.com/Unidata/netcdf4-python>`__
88-
* `packaging <https://pypi.org/project/packaging/>`__
83+
* `numpy <https://numpy.org>`__ (>= 1.17)
84+
* `pandas <https://pandas.pydata.org>`__
85+
* `xarray <https://xarray.pydata.org>`__
86+
* `netCDF4 <https://unidata.github.io/netcdf4-python>`__
87+
* `packaging <https://packaging.pypa.io>`__
8988

9089
The following are optional (but recommended) dependencies:
9190

92-
* `IPython <https://ipython.org/>`__: For embedding the figures in Jupyter
93-
notebooks.
94-
91+
* `IPython <https://ipython.org>`__: For embedding the figures in Jupyter notebooks.
9592

9693
Installing GMT and other dependencies
9794
-------------------------------------

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66
# Required dependencies
77
- pip
88
- gmt=6.1.1
9-
- numpy
9+
- numpy>=1.17
1010
- pandas
1111
- xarray
1212
- netCDF4

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Required packages
2-
numpy
2+
numpy>=1.17
33
pandas
44
xarray
55
netCDF4

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@
3030
"Programming Language :: Python :: 3.7",
3131
"Programming Language :: Python :: 3.8",
3232
"Programming Language :: Python :: 3.9",
33-
"License :: OSI Approved :: {}".format(LICENSE),
33+
f"License :: OSI Approved :: {LICENSE}",
3434
]
3535
PLATFORMS = "Any"
36-
INSTALL_REQUIRES = ["numpy", "pandas", "xarray", "netCDF4", "packaging"]
36+
PYTHON_REQUIRES = ">=3.7"
37+
INSTALL_REQUIRES = ["numpy>=1.17", "pandas", "xarray", "netCDF4", "packaging"]
3738
# Configuration for setuptools-scm
3839
SETUP_REQUIRES = ["setuptools_scm"]
3940
USE_SCM_VERSION = {"local_scheme": "node-and-date", "fallback_version": "unknown"}
@@ -57,6 +58,7 @@
5758
package_data=PACKAGE_DATA,
5859
classifiers=CLASSIFIERS,
5960
keywords=KEYWORDS,
61+
python_requires=PYTHON_REQUIRES,
6062
install_requires=INSTALL_REQUIRES,
6163
setup_requires=SETUP_REQUIRES,
6264
)

0 commit comments

Comments
 (0)