Skip to content

Commit

Permalink
bump python to version 3.8 in conda env config files and mdtf_test ya…
Browse files Browse the repository at this point in the history
…ml (#415)

* bump python to version 3.8 in conda env config files and mdtf_test yaml
fix typo in conda_init.sh
bump other package versions in yamls to be consistent with base env

* update python 3.7 to python 3.8 in docs, requirements, and version checking

* replace call to (apparently) deprecated xarray.ufuncs.isnan with np.isnan in mixed_layer_depth.py
  • Loading branch information
wrongkindofdoctor authored Oct 20, 2022
1 parent 961e029 commit 5c0db2f
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ operating system(s) you ran your tests on.
**Checklist:**
- [ ] I have reviewed my own code to ensure that if follows the [POD development guidelines](https://mdtf-diagnostics.readthedocs.io/en/latest/sphinx/dev_guidelines.html)
- [ ] My branch is up-to-date with the NOAA-GFDL main branch, and all merge conflicts are resolved
- [ ] The scripts are written in Python 3.7 or above (preferred; required if funded by a CPO grant), NCL, or R
- [ ] The scripts are written in Python 3.8 or above (preferred; required if funded by a CPO grant), NCL, or R
- [ ] All of my scripts are in the diagnostics/[POD short name] subdirectory, and include a main_driver script, template html, and settings.jsonc file
- [ ] I have made corresponding changes to the documentation in the POD's doc/ subdirectory
- [ ] I have requested that the framework developers add packages required by my POD to the python3, NCL, or R environment yaml file if necessary, and my environment builds with `conda_env_setup.sh`
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mdtf_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
python-version: 3.7
python-version: 3.8
mamba-version: "*"
channels: conda-forge,defaults
- name: Verify miniconda
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ formats:

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
version: 3.8
install:
- requirements: doc/requirements.txt
- method: pip
Expand Down
2 changes: 1 addition & 1 deletion diagnostics/mixed_layer_depth/mixed_layer_depth.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def computemld(fieldso, fieldthetao):
) # units 'meters'

# set MLD to water depth where MLD is NaN
mld = mld.where(~xr.ufuncs.isnan(mld), bottom_depth)
mld = mld.where(~np.isnan(mld), bottom_depth)

return mld

Expand Down
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ def patched_parse(self):
# -- Options for intersphinx extension -----------------------------------------
# https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html
intersphinx_mapping = {
'python': ('https://docs.python.org/3.7', None),
'python': ('https://docs.python.org/3.8', None),
'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None),
'numpy': ('https://docs.scipy.org/doc/numpy/', None),
'xarray': ('https://xarray.pydata.org/en/stable/', None)
Expand Down
4 changes: 2 additions & 2 deletions doc/sphinx/dev_guidelines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ The framework itself is written in Python, and can call PODs written in any scri

- To achieve portability, the MDTF **cannot** accept PODs written in closed-source languages (e.g., MATLAB and IDL; try `Octave <https://www.gnu.org/software/octave/>`__ and `GDL <https://github.com/gnudatalanguage/gdl>`__ if possible). We also **cannot** accept PODs written in compiled languages (e.g., C or Fortran): installation would rapidly become impractical if users had to check compilation options for each POD.

- Python is strongly encouraged for new PODs; PODs funded through the CPO grant are requested to be developed in Python. Python version >= 3.7 is required. Official support for Python 2 was discontinued as of January 2020.
- Python is strongly encouraged for new PODs; PODs funded through the CPO grant are requested to be developed in Python. Python version >= 3.8 is required. Official support for Python 2 was discontinued as of January 2020.

- If your POD was previously developed in NCL or R (and development is *not* funded through a CPO grant), you do not need to re-write existing scripts in Python 3 if doing so is likely to introduce new bugs into stable code, especially if you’re unfamiliar with Python.

- If scripts were written in closed-source languages, translation to Python 3.7 or above is required.
- If scripts were written in closed-source languages, translation to Python 3.8 or above is required.

Preparation for POD implementation
----------------------------------
Expand Down
2 changes: 1 addition & 1 deletion doc/sphinx/dev_start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Installing dependencies via conda
Regardless of development language, we strongly recommend that developers use conda to manage their language and library versions. Note that Conda is not Python-specific, but allows coexisting versioned environments of most scripting languages, including, `R <https://anaconda.org/conda-forge/r-base>`__, `NCL <https://anaconda.org/conda-forge/ncl>`__, `Ruby <https://anaconda.org/conda-forge/ruby>`__, `PyFerret <https://anaconda.org/conda-forge/pyferret>`__, and more.


Python-based PODs should be written in Python 3.7 or newer. We provide a developer version of the python3_base environment (described below) that includes Jupyter and other developer-specific tools. This is not installed by default, and must be requested by passing the ``--all`` flag to the conda setup script:
Python-based PODs should be written in Python 3.8 or newer. We provide a developer version of the python3_base environment (described below) that includes Jupyter and other developer-specific tools. This is not installed by default, and must be requested by passing the ``--all`` flag to the conda setup script:

.. code-block:: console
Expand Down
4 changes: 2 additions & 2 deletions mdtf_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

import sys
# do version check before anything else
if sys.version_info.major != 3 or sys.version_info.minor < 7:
sys.exit("ERROR: The MDTF package requires python >= 3.7. Please check "
if sys.version_info.major != 3 or sys.version_info.minor < 8:
sys.exit("ERROR: The MDTF package requires python >= 3.8. Please check "
"which version of python is on your $PATH (e.g. with `which python`.)\n"
f"Attempted to run with following python version:\n{sys.version}")
# passed; continue with imports
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def run(self):
packages = find_packages()
setup(
name='MDTF-diagnostics',
version='3.0 beta 4',
version='3.0 beta 5',
description='Process-oriented diagnostics for weather and climate simulations',
license='LGPLv3',
long_description=long_description,
Expand All @@ -38,13 +38,13 @@ def run(self):
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
'Programming Language :: Python',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
],
scripts=[
'mdtf_framework.py'
],
packages=packages,
cmdclass={ # hook for post-install commands
cmdclass={ # hook for post-install commands
'develop': PostDevelopCommand,
'install': PostInstallCommand
}
Expand Down
2 changes: 1 addition & 1 deletion src/conda/_env_synthetic_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
- netCDF4=1.5.8
- cftime=1.3.0
- xarray>=2022.06.0
- setuptools >= 49.1
- setuptools>=49.1
- esmf=8.2.0
- esmpy=8.2.0
- xesmf=0.6.2
Expand Down
2 changes: 1 addition & 1 deletion src/conda/conda_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# NOTE this has only been tested with conda 4.7.10 and later; I know earlier
# versions had things in different places.

# parse aruments manually
# parse arguments manually
_TEMP_CONDA_ROOT=""
_TEMP_CONDA_EXE=""
_v=1
Expand Down
2 changes: 1 addition & 1 deletion src/conda/env_NCL_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge # NOTE: critical to give highest priority to conda-forge
- defaults
dependencies:
- python=3.7
- python=3.8
# - ncl=6.5 # has a font rendering issue fixed in 6.6
# - openblas=0.3.4 # otherwise ncl 6.5 installs but doesn't function on macs
- ncl=6.6.2
Expand Down
2 changes: 1 addition & 1 deletion src/conda/env_R_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
- defaults
dependencies:
- python=3.7
- python=3.8
- r-base
- r-akima
- r-colorramps
Expand Down
2 changes: 1 addition & 1 deletion src/conda/env_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:
# specify up to minor version number to provide a consistent environment for POD developers
# versions are current as of Jul 2020
# see https://docs.conda.io/projects/conda/en/latest/user-guide/concepts/pkg-specs.html
- python=3.7
- python=3.8
- ghostscript
- numpy=1.19
# - scipy=1.5.2
Expand Down
18 changes: 9 additions & 9 deletions src/conda/env_convective_transition_diag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ channels:
- conda-forge
- defaults
dependencies:
- python=3.7
- numpy=1.19
- scipy=1.5.2
- python=3.8
- numpy=1.22.3
- scipy=1.5.3
- netCDF4=1.5.4
- cftime=1.2
- xarray=0.16
- matplotlib=3.3
- cftime=1.3.0
- xarray>=0.20
- matplotlib>=3.3
- pandas<1.3
- cartopy=0.18
- numba = 0.51.2
- networkx = 2.3
- cartopy=0.20.0
- numba=0.51.2
- networkx=2.3
- jupyterlab
4 changes: 2 additions & 2 deletions src/conda/env_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ channels:
- defaults
dependencies:
# contents of python3_base
- python=3.7
- python=3.8
- numpy=1.19
- scipy=1.5.2
- scipy=1.5.3
- netCDF4=1.5.4
- cftime=1.2
- xarray=0.16
Expand Down
12 changes: 6 additions & 6 deletions src/conda/env_precip_buoy_diag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ channels:
- conda-forge
- defaults
dependencies:
- python=3.7
- cython=0.29.21
- xarray=0.16.2
- numpy=1.18.5
- python=3.8
- cython>=0.29
- xarray>=0.20
- numpy=1.22.3
- scipy=1.5.3
- matplotlib=3.3.3
- numba=0.52
- pandas
- dask
- pandas<1.3
- dask=2021.03.0
6 changes: 3 additions & 3 deletions src/conda/env_python3_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ dependencies:
# versions are current as of Jul 2020
# see https://docs.conda.io/projects/conda/en/latest/user-guide/concepts/pkg-specs.

- python=3.7
- python=3.8
- numpy=1.19
- scipy=1.5.2
- scipy=1.5.3
- netCDF4=1.5.8
- cftime>=1.6
- xarray>=0.20
Expand All @@ -30,7 +30,7 @@ dependencies:
- h5py=3.6.0
- intake-xarray=0.6.0
- nc-time-axis=1.4.1
- pyyaml >=6.0
- pyyaml>=6.0
- pip=22.0.4
- pip:
- cmocean
Expand Down
4 changes: 2 additions & 2 deletions src/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import sys
# do version check before importing other stuff
if sys.version_info[0] != 3 or sys.version_info[1] < 7:
sys.exit("ERROR: MDTF currently only supports python >= 3.7.*. Please check "
if sys.version_info[0] != 3 or sys.version_info[1] < 8:
sys.exit("ERROR: MDTF currently only supports python >= 3.8.*. Please check "
"which version is on your $PATH (e.g. with `which python`.)\n"
f"Attempted to run with following python version:\n{sys.version}")
# passed; continue with imports
Expand Down

0 comments on commit 5c0db2f

Please sign in to comment.