Skip to content

Commit

Permalink
Merge pull request #862 from pangeo-data/pep621-compliance
Browse files Browse the repository at this point in the history
Adopt PEP621 and src layout, support Python3.12, drop Python3.8
  • Loading branch information
Zeitsperre authored Jul 5, 2024
2 parents 831d109 + ab3b619 commit 61b3254
Show file tree
Hide file tree
Showing 78 changed files with 239 additions and 247 deletions.
26 changes: 16 additions & 10 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,36 @@ jobs:
benchmark:
if: ${{ contains( github.event.pull_request.labels.*.name, 'run-benchmark') && github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
name: Linux
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
env:
ASV_DIR: "./asv_bench"

defaults:
run:
shell: bash -l {0}
strategy:
matrix:
python-version: ["3.10"]
steps:
# We need the full repo to avoid this issue
# https://github.com/actions/checkout/issues/23
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
- name: Set up conda (micromamba)
uses: mamba-org/setup-micromamba@v1
with:
# installer-url: https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh
installer-url: https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
environment-name: climpred-benchmarks
cache-environment: true
create-args: >-
python=${{ matrix.python-version }}
conda
- name: Setup some dependencies
shell: bash -l {0}
- name: Set Up Dependencies
run: |
pip install asv
python -m pip install asv
sudo apt-get update -y
- name: Run benchmarks
shell: bash -l {0}
id: benchmark
env:
OPENBLAS_NUM_THREADS: 1
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/climpred_installs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,42 +25,44 @@ jobs:
keyword: "[skip-ci]"

install-climpred-complete: # Installs climpred on various OS.
name: Install climpred[complete], ${{ matrix.os }}
name: Install climpred[complete], ${{ matrix.os }}, Python${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
needs: detect-ci-trigger
if: needs.detect-ci-trigger.outputs.triggered == 'false'
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.9"]
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -e .[complete]
python -c "import climpred"
install-climpred: # Installs climpred on various OS.
name: Install climpred, ${{ matrix.os }}
name: Install climpred, ${{ matrix.os }}, Python${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
needs: detect-ci-trigger
if: needs.detect-ci-trigger.outputs.triggered == 'false'
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.9"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches and tags.
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -e .
Expand Down
38 changes: 27 additions & 11 deletions .github/workflows/climpred_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ jobs:
keyword: "[skip-ci]"

minimum-test: # Runs testing suite with minimal dependencies
name: Test minimum dependencies, Python3.9
name: Test minimum dependencies, Python${{ matrix.python-version }}
runs-on: ubuntu-latest
needs: detect-ci-trigger
if: needs.detect-ci-trigger.outputs.triggered == 'false'
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -45,7 +48,7 @@ jobs:
environment-name: climpred-minimum-tests
cache-environment: true
create-args: >-
python=3.9
python=${{ matrix.python-version }}
conda
- name: Install climpred
run: |
Expand Down Expand Up @@ -75,16 +78,22 @@ jobs:
strategy:
fail-fast: false
matrix:
env: [""]
include:
- env: "climpred-maximum-tests"
python-version: "3.9"
extras: "esmpy=*=mpi*" # Ensures MPI works with version of esmpy.
os: ubuntu-latest
- env: "climpred-maximum-tests"
python-version: "3.10"
extras: "esmpy=*=mpi*" # Ensures MPI works with version of esmpy.
os: ubuntu-latest
- env: "climpred-maximum-tests-upstream"
python-version: "3.11"
extras: "esmpy=*=mpi*" # Ensures MPI works with version of esmpy.
os: ubuntu-latest
- env: "climpred-maximum-tests"
python-version: "3.12"
extras: "esmpy" # MPI is not supported in lastest esmpy conda packages for Python3.12
os: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -96,10 +105,11 @@ jobs:
environment-file: ci/requirements/maximum-tests.yml
environment-name: climpred-maximum-tests
cache-environment: true
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
cache-environment-key: "${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{ env.TODAY }}-${{ hashFiles(env.CONDA_ENV_FILE) }}"
create-args: >-
python=${{matrix.python-version}}
conda
python=${{ matrix.python-version }}
${{ matrix.extras }}
- name: Install climpred[complete]
run: |
python -m pip install -e .[complete]
Expand Down Expand Up @@ -128,11 +138,14 @@ jobs:
fail_ci_if_error: false

doctest: # tests all docstrings
name: Doctests, Python3.9
runs-on: "ubuntu-latest"
name: Doctests, Python${{ matrix.python-version }}
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
python-version: ["3.9"]
steps:
- uses: actions/checkout@v4
- name: Setup conda (micromamba)
Expand All @@ -142,7 +155,7 @@ jobs:
environment-name: climpred-maximum-tests
cache-environment: true
create-args: >-
python=3.9
python=${{ matrix.python-version }}
conda
- name: Install climpred[complete]
run: |
Expand All @@ -156,14 +169,17 @@ jobs:
conda list
- name: Run doctests
run: |
python -m pytest --doctest-modules climpred --ignore climpred/tests
python -m pytest --doctest-modules src/climpred --ignore src/climpred/tests
notebooks: # Checks that pre-compiled notebooks in docs still work.
name: Notebooks, Python3.9
name: Notebooks, Python${{ matrix.python-version }}
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
python-version: ["3.9"]
steps:
- uses: actions/checkout@v4
- name: Set up conda (micromamba)
Expand All @@ -173,7 +189,7 @@ jobs:
environment-name: climpred-docs
cache-environment: true
create-args: >-
python=3.9
python=${{ matrix.python-version }}
conda
- name: Install climpred
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-production-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Python3
uses: actions/setup-python@v5
with:
python-version: '3.x'
python-version: "3.x"
- name: Install packaging libraries
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-staging-testpypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Set up Python3
uses: actions/setup-python@v5
with:
python-version: '3.x'
python-version: "3.x"
- name: Install packaging libraries
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upstream-dev-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
keyword: "[test-upstream]"

upstream-dev:
name: upstream-dev
name: upstream-dev, Python${{ matrix.python-version }}
runs-on: ubuntu-latest
needs: detect-ci-trigger
if: |
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ asv_bench/.asv/
# VS Code
.vscode/

# PyCharm
.idea/

# dask
dask-worker-space

# End of https://www.gitignore.io/api/python
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ repos:
exclude: '.ipynb|asv.conf.json'
- id: trailing-whitespace

- repo: https://github.com/pappasam/toml-sort
rev: v0.23.1
hooks:
- id: toml-sort-fix

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.4.2
hooks:
Expand All @@ -30,6 +35,7 @@ repos:
rev: 7.1.0
hooks:
- id: flake8
args: [ '--max-line-length=93', '--extend-ignore=W503' ]

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ Internals/Minor Fixes
- Fixed some issues with the documentation build to address rendering errors and reduce the number of warnings on ReadTheDocs. (pr:`843`) `Trevor James Smith`_
- Fixed some issues with the typing hints of classes functions. (pr:`850`) `Trevor James Smith`_
- Fixed several issues with incompatible dependency configurations in the CI and addressed a few deprecations. (pr:`861`) `Trevor James Smith`_
- `climpred` has adopted `PEP 621 <https://peps.python.org/pep-0621/>`_ for specifying project metadata. (pr:`862`) `Trevor James Smith`_
- `climpred` now uses the `src layout <https://packaging.python.org/en/latest/discussions/src-layout-vs-flat-layout/>`_ for the package file structure. (pr:`862`) `Trevor James Smith`_
- Drop ``python<=3.8`` support. (:pr:`862`) `Trevor James Smith`_.

climpred v2.4.0 (2023-11-09)
============================
Expand Down Expand Up @@ -224,7 +227,6 @@ Data variables:
using :py:func:`~climpred.reference.compute_persistence_from_first_lead`.
(:issue:`637`, :pr:`706`) `Aaron Spring`_.


Internals/Minor Fixes
---------------------
- Reduce dependencies. (:pr:`686`) `Aaron Spring`_.
Expand Down Expand Up @@ -1038,6 +1040,7 @@ Documentation
- Add page for `publications <publications.html>`_ and
`helpful links <helpful-links.html>`_. (:pr:`270`) `Riley X. Brady`_.


climpred v1.1.0 (2019-09-23)
============================

Expand Down Expand Up @@ -1072,6 +1075,7 @@ Documentation
- Add scope of package to docs for clarity for users and developers. (:pr:`235`)
`Riley X. Brady`_.


climpred v1.0.1 (2019-07-04)
============================

Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. image:: https://i.imgur.com/HPOdOsR.png

Verification of weather and climate forecasts.
Verification of weather and climate forecasts

..
Table version of badges inspired by pySTEPS.
Expand Down Expand Up @@ -128,7 +128,7 @@ You can install the latest release of ``climpred`` using ``pip`` or ``conda``:

.. code-block:: bash
pip install climpred[complete]
python -m pip install climpred[complete]
.. code-block:: bash
Expand All @@ -141,7 +141,7 @@ repository or installing directly from GitHub:
git clone https://github.com/pangeo-data/climpred.git
cd climpred
pip install . --upgrade
python -m pip install . --upgrade
.. code-block:: bash
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies:
- importlib-metadata <8.0.0 # Pin needed for esmpy compatibility. See: https://github.com/pangeo-data/xESMF/issues/374
- nc-time-axis >=1.4.0
- numba >=0.52
- numpy >=1.25.0
- numpy >=1.25.0,<2.0.0 # Pin below v2.0.0 until xclim supports it.
- xclim
- xesmf
- xrft
8 changes: 4 additions & 4 deletions ci/requirements/maximum-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ channels:
- conda-forge
- nodefaults
dependencies:
- python >=3.9
- python >=3.9,<3.13
- bias_correction
- cftime >=1.5.0
- coveralls
- dask-core
- eofs
- esmpy =*=mpi* # Ensures MPI works with version of esmpy.
# - esmpy =*=mpi* # Ensures MPI works with version of esmpy. # Commented out for CI testing.
- h5netcdf
- importlib-metadata <8.0.0 # Pin needed for esmpy compatibility. See: https://github.com/pangeo-data/xESMF/issues/374
- importlib-metadata <8.0.0 # Pin needed for esmpy compatibility. See: https://github.com/pangeo-data/xESMF/issues/374
- matplotlib-base
- nc-time-axis >=1.4.0
- numpy >=1.25.0
- numpy >=1.25.0,<2.0.0 # Pin below v2.0.0 until xclim supports it.
- pip
- pooch
- pytest <8.0.0
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/minimum-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
- nodefaults
dependencies:
- python >=3.9,<3.10
- python >=3.9,<3.13
- cftime >=1.5.0
- coveralls
- dask-core
Expand Down
Loading

0 comments on commit 61b3254

Please sign in to comment.