From 955a55ed98e4aa7c88b9cea27429cd01c1a0d4c6 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Thu, 25 Mar 2021 10:14:17 +1300 Subject: [PATCH] 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 --- .github/workflows/ci_tests.yaml | 27 ++++++++++++++++----------- MAINTENANCE.md | 22 ++++++++++++++++++++-- README.rst | 13 +++++++------ doc/install.rst | 19 ++++++++----------- environment.yml | 2 +- requirements.txt | 2 +- setup.py | 6 ++++-- 7 files changed, 57 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 375a0a77904..b843210d0bd 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -25,12 +25,12 @@ on: jobs: test: - name: ${{ matrix.os }} - Python ${{ matrix.python-version }} + name: ${{ matrix.os }} - Python ${{ matrix.python-version }} / NumPy ${{ matrix.numpy-version }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - python-version: [3.7, 3.8, 3.9] + python-version: [3.7, 3.9] os: [ubuntu-latest, macOS-latest, windows-latest] # Is it a draft Pull Request (true or false)? isDraft: @@ -41,20 +41,24 @@ jobs: isDraft: true - os: windows-latest isDraft: true - - os: ubuntu-latest - python-version: 3.7 - isDraft: true - - os: ubuntu-latest - python-version: 3.8 - isDraft: true + # - os: ubuntu-latest + # python-version: 3.7 + # isDraft: true + # Pair Python 3.7 with NumPy 1.17 and Python 3.9 with NumPy 1.20 + include: + - python-version: 3.7 + numpy-version: '1.17' + - python-version: 3.9 + numpy-version: '1.20' defaults: run: shell: bash -l {0} - # environmental variables used in coverage + # Environment variables used by codecov env: OS: ${{ matrix.os }} PYTHON: ${{ matrix.python-version }} + NUMPY: ${{ matrix.numpy-version }} steps: # Cancel previous runs that are not completed @@ -82,7 +86,8 @@ jobs: # Install GMT and other required dependencies from conda-forge - name: Install dependencies run: | - conda install gmt=6.1.1 numpy pandas xarray netCDF4 packaging \ + conda install gmt=6.1.1 numpy=${{ matrix.numpy-version }} \ + pandas xarray netCDF4 packaging \ codecov coverage[toml] dvc ipython make \ pytest-cov pytest-mpl pytest>=6.0 \ sphinx-gallery @@ -138,5 +143,5 @@ jobs: uses: codecov/codecov-action@v1.2.2 with: file: ./coverage.xml # optional - env_vars: OS,PYTHON + env_vars: OS,PYTHON,NUMPY fail_ci_if_error: false diff --git a/MAINTENANCE.md b/MAINTENANCE.md index 9ccd9f4779b..d634044916f 100644 --- a/MAINTENANCE.md +++ b/MAINTENANCE.md @@ -12,6 +12,7 @@ If you want to make a contribution to the project, see the * [Reviewing and Merging Pull Requests](#reviewing-and-merging-pull-requests) * [Continuous Integration](#continuous-integration) * [Continuous Documentation](#continuous-documentation) +* [Dependencies Policy](#dependencies-policy) * [Making a Release](#making-a-release) - [Updating the Changelog](#updating-the-changelog) - [Check the README Syntax](#check-the-readme-syntax) @@ -77,8 +78,9 @@ There are 9 configuration files located in `.github/workflows`: This is run on every commit to the *master* and Pull Request branches. It is also scheduled to run daily on the *master* branch. - In draft Pull Requests, only one job (Linux + Python latest) - is triggered to save on Continuous Integration resources. + In draft Pull Requests, only two jobs on Linux (minimum NEP29 Python/NumPy versions + and latest Python/NumPy versions) are triggered to save on Continuous Integration + resources. 3. `ci_docs.yml` (Build documentation on Linux/macOS/Windows) @@ -135,6 +137,22 @@ The actual script `package.json` is used by Vercel to install the necessary pack build the documentation, copy the files to a 'public' folder and deploy that to the web, see https://vercel.com/docs/build-step. + +## Dependencies Policy + +PyGMT has adopted [NEP29](https://numpy.org/neps/nep-0029-deprecation_policy) +alongside the rest of the Scientific Python ecosystem, and therefore supports: + +* All minor versions of Python released 42 months prior to the project, + and at minimum the two latest minor versions. +* All minor versions of NumPy released in the 24 months prior to the project, + and at minimum the last three minor versions. + +In `setup.py`, the `python_requires` variable should be set to the minimum +supported version of Python. Minimum Python and NumPy version support should be +adjusted upward on every major and minor release, but never on a patch release. + + ## Making a Release We try to automate the release process as much as possible. diff --git a/README.rst b/README.rst index 7cf54a3bab0..253a367b873 100644 --- a/README.rst +++ b/README.rst @@ -229,14 +229,15 @@ Documentation for other versions * `v0.1.0 `__ * `v0.0.1a0 `__ -Compatibility with Python and GMT versions ------------------------------------------- +Compatibility with GMT and Python/NumPy versions +------------------------------------------------ -======= ========== ========= -PyGMT GMT Python -======= ========== ========= +======= ========== ========= ========= +PyGMT GMT Python NumPy +======= ========== ========= ========= +0.4.x >=6.2.0 >=3.7 >=1.17.0 0.3.x >=6.1.1 >=3.7 0.2.1 >=6.1.1 >=3.6 0.2.0 >=6.1.1 3.6 - 3.8 0.1.x >=6.0.0 3.6 - 3.8 -======= ========== ========= +======= ========== ========= ========= diff --git a/doc/install.rst b/doc/install.rst index 83587515034..b3a000b1143 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -46,8 +46,7 @@ Start by looking at the tutorials on our sidebar, good luck! Which Python? ------------- -PyGMT is tested to run on **Python 3.7 or greater**. Older Python versions may -work, but there is no guarantee that PyGMT will behave as expected. +PyGMT is tested to run on **Python 3.7 or greater**. We recommend using the `Anaconda `__ 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. Dependencies ------------ -PyGMT requires the following libraries: +PyGMT requires the following libraries to be installed: -* `numpy `__ -* `pandas `__ -* `xarray `__ -* `netCDF4 `__ -* `packaging `__ +* `numpy `__ (>= 1.17) +* `pandas `__ +* `xarray `__ +* `netCDF4 `__ +* `packaging `__ The following are optional (but recommended) dependencies: -* `IPython `__: For embedding the figures in Jupyter - notebooks. - +* `IPython `__: For embedding the figures in Jupyter notebooks. Installing GMT and other dependencies ------------------------------------- diff --git a/environment.yml b/environment.yml index 7c6b91a86d5..6942d6897f0 100644 --- a/environment.yml +++ b/environment.yml @@ -6,7 +6,7 @@ dependencies: # Required dependencies - pip - gmt=6.1.1 - - numpy + - numpy>=1.17 - pandas - xarray - netCDF4 diff --git a/requirements.txt b/requirements.txt index ffdf6724f8e..8f5a7863bf8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # Required packages -numpy +numpy>=1.17 pandas xarray netCDF4 diff --git a/setup.py b/setup.py index 45685e36ada..aacf552047a 100644 --- a/setup.py +++ b/setup.py @@ -30,10 +30,11 @@ "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", - "License :: OSI Approved :: {}".format(LICENSE), + f"License :: OSI Approved :: {LICENSE}", ] PLATFORMS = "Any" -INSTALL_REQUIRES = ["numpy", "pandas", "xarray", "netCDF4", "packaging"] +PYTHON_REQUIRES = ">=3.7" +INSTALL_REQUIRES = ["numpy>=1.17", "pandas", "xarray", "netCDF4", "packaging"] # Configuration for setuptools-scm SETUP_REQUIRES = ["setuptools_scm"] USE_SCM_VERSION = {"local_scheme": "node-and-date", "fallback_version": "unknown"} @@ -57,6 +58,7 @@ package_data=PACKAGE_DATA, classifiers=CLASSIFIERS, keywords=KEYWORDS, + python_requires=PYTHON_REQUIRES, install_requires=INSTALL_REQUIRES, setup_requires=SETUP_REQUIRES, )