From 1f3d23d28598beaa458a01d207e5e80660f94b8f Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Fri, 2 Feb 2024 14:00:29 -0700 Subject: [PATCH] CI updates and add Python 3.11 remove Python 3.7 and 3.8 (#213) * add Python 3.11 * update CI and add back in nightly testing * add dependabot * add macOS M1 build to CI and remove numpy version exclude * fix typo * fix conda for M1 * clean up CI conda envs * update environment files and references in contributing guidelines * add Windows to CI * try the another Windows build script * try the another Windows build script * try using old windows env * fix typo * fix typo * remove windows from CI --- .github/dependabot.yml | 7 ++++ .github/workflows/ci.yml | 35 +++++++++---------- .readthedocs.yml | 21 +++++++++++ build_envs/environment.yml | 20 +++++++++++ build_envs/platform-specific/README.md | 3 ++ .../linux.yml} | 4 +-- build_envs/platform-specific/macos_arm64.yml | 21 +++++++++++ .../macos_x64.yml} | 4 +-- .../windows.yml} | 4 +-- doc/source/contrib.rst | 21 ++--------- setup.py | 6 ++-- 11 files changed, 101 insertions(+), 45 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .readthedocs.yml create mode 100644 build_envs/environment.yml create mode 100644 build_envs/platform-specific/README.md rename build_envs/{Linux.yml => platform-specific/linux.yml} (91%) create mode 100644 build_envs/platform-specific/macos_arm64.yml rename build_envs/{Darwin.yml => platform-specific/macos_x64.yml} (91%) rename build_envs/{Win64.yml => platform-specific/windows.yml} (91%) diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..bad6ba3 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: + - package-ecosystem: 'github-actions' + directory: '/' + schedule: + # Check for updates once a week + interval: 'weekly' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc83483..a5d721e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,13 +3,11 @@ on: push: pull_request: workflow_dispatch: - # schedule: - # - cron: '0 0 * * *' # Daily “At 00:00” + schedule: + - cron: '0 0 * * *' # Daily “At 00:00” jobs: test: - # if: | - # github.repository == 'NCAR/wrf-python' name: Python (${{ matrix.python-version }}, ${{ matrix.os }}) runs-on: ${{ matrix.os }} defaults: @@ -19,32 +17,33 @@ jobs: strategy: fail-fast: false matrix: - os: [ "ubuntu-latest", "macos-latest"] - python-version: [ "3.7", "3.8", "3.9", "3.10" ] + os: [ "ubuntu-latest", "macos-latest", "macos-14" ] + python-version: [ "3.9", "3.10", "3.11" ] steps: - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.9.1 + uses: styfle/cancel-workflow-action@0.11.0 with: access_token: ${{ github.token }} - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: token: ${{ github.token }} - name: Conda setup uses: conda-incubator/setup-miniconda@v2 + if: matrix.os != 'macos-14' with: - activate-environment: wrf_python_build python-version: ${{ matrix.python-version }} - channels: conda-forge, ncar - - name: Conda install (Darwin) - if: matrix.os == 'macos-latest' - run: | - conda env update --file build_envs/Darwin.yml --prune - - name: Conda install (Linux) - if: matrix.os == 'ubuntu-latest' - run: | - conda env update --file build_envs/Linux.yml --prune + channels: conda-forge + environment-file: build_envs/environment.yml + - name: Conda setup (macOS M1) + uses: conda-incubator/setup-miniconda@v2 + if: matrix.os == 'macos-14' + with: + installer-url: https://github.com/conda-forge/miniforge/releases/download/23.11.0-0/Mambaforge-23.11.0-0-MacOSX-arm64.sh + python-version: ${{ matrix.python-version }} + channels: conda-forge + environment-file: build_envs/environment.yml - name: Build WRF-Python run: | cd build_scripts diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..d059c2c --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,21 @@ +# .readthedocs.yml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +build: + os: "ubuntu-20.04" + tools: + python: "mambaforge-4.10" + jobs: + post_create_environment: + - python -m pip install --no-cache-dir . + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: doc/source/conf.py + +conda: + environment: build_envs/environment.yml diff --git a/build_envs/environment.yml b/build_envs/environment.yml new file mode 100644 index 0000000..8b46c24 --- /dev/null +++ b/build_envs/environment.yml @@ -0,0 +1,20 @@ +# Create full conda environment for development, including some useful tools +name: wrf_python_build +channels: + - conda-forge +dependencies: + - python>=3.9, <3.12 + - compilers + - basemap + - cartopy + - jupyter + - matplotlib + - netcdf4 + - numpy + - pycodestyle + - setuptools + - sphinx + - sphinx_rtd_theme + - wrapt + - xarray + diff --git a/build_envs/platform-specific/README.md b/build_envs/platform-specific/README.md new file mode 100644 index 0000000..de69662 --- /dev/null +++ b/build_envs/platform-specific/README.md @@ -0,0 +1,3 @@ +These platform specific environment files are included here for reference only and not actively tested or maintained. + +We have moved to a single environment file (../environment.yml) for all platforms. diff --git a/build_envs/Linux.yml b/build_envs/platform-specific/linux.yml similarity index 91% rename from build_envs/Linux.yml rename to build_envs/platform-specific/linux.yml index f0609d8..c348960 100644 --- a/build_envs/Linux.yml +++ b/build_envs/platform-specific/linux.yml @@ -3,7 +3,7 @@ name: wrf_python_build channels: - conda-forge dependencies: - - python=3 + - python<3.12 - basemap - cartopy - gcc_linux-64 @@ -11,7 +11,7 @@ dependencies: - jupyter - matplotlib - netcdf4 - - numpy!=1.24.3 + - numpy - pycodestyle - setuptools - sphinx diff --git a/build_envs/platform-specific/macos_arm64.yml b/build_envs/platform-specific/macos_arm64.yml new file mode 100644 index 0000000..2e475f0 --- /dev/null +++ b/build_envs/platform-specific/macos_arm64.yml @@ -0,0 +1,21 @@ +# Create full conda environment for development, including some useful tools +name: wrf_python_build +channels: + - conda-forge +dependencies: + - python<3.12 + - basemap + - cartopy + - clang_osx-arm64 + - gfortran_osx-arm64 + - jupyter + - matplotlib + - netcdf4 + - numpy + - pycodestyle + - setuptools + - sphinx + - sphinx_rtd_theme + - wrapt + - xarray + diff --git a/build_envs/Darwin.yml b/build_envs/platform-specific/macos_x64.yml similarity index 91% rename from build_envs/Darwin.yml rename to build_envs/platform-specific/macos_x64.yml index 3ea338f..2415ebe 100644 --- a/build_envs/Darwin.yml +++ b/build_envs/platform-specific/macos_x64.yml @@ -3,7 +3,7 @@ name: wrf_python_build channels: - conda-forge dependencies: - - python=3 + - python<3.12 - basemap - cartopy - clang_osx-64 @@ -11,7 +11,7 @@ dependencies: - jupyter - matplotlib - netcdf4 - - numpy!=1.24.3 + - numpy - pycodestyle - setuptools - sphinx diff --git a/build_envs/Win64.yml b/build_envs/platform-specific/windows.yml similarity index 91% rename from build_envs/Win64.yml rename to build_envs/platform-specific/windows.yml index 82b3ea0..1053db0 100644 --- a/build_envs/Win64.yml +++ b/build_envs/platform-specific/windows.yml @@ -4,14 +4,14 @@ channels: - conda-forge - msys2 dependencies: - - python=3 + - python<3.12 - basemap - cartopy - jupyter - m2w64-toolchain - matplotlib - netcdf4 - - numpy!=1.24.3 + - numpy - pycodestyle - setuptools - sphinx diff --git a/doc/source/contrib.rst b/doc/source/contrib.rst index 0f96d18..d11fa76 100644 --- a/doc/source/contrib.rst +++ b/doc/source/contrib.rst @@ -294,28 +294,13 @@ contributing is: git remote add ncar https://github.com/ncar/wrf-python.git -- To create the development environment, you'll need to run the appropriate - command below for your operating system. - - OSX: - - .. code:: - - conda env create -f build_envs/Darwin.yml - - Linux: - - .. code:: - - conda env create -f build_envs/Linux.yml - - Win64: +- To create the development environment, you'll need to run the command below: .. code:: - conda env create -f build_envs/Win64.yml + conda env create -f build_envs/environment.yml - Note: For Win64, you will also need VS2015 installed on your system. + Note: For Windows, you will also need Visual Studio installed on your system. - Activate your conda environment. diff --git a/setup.py b/setup.py index 3dbeaf3..9c38c9a 100755 --- a/setup.py +++ b/setup.py @@ -103,9 +103,9 @@ "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Fortran", - "Programming Language :: Python :: 3.7", - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Scientific/Engineering :: Atmospheric Science", "Topic :: Software Development", "Operating System :: POSIX",