Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/unidata/metpy into corfidi
Browse files Browse the repository at this point in the history
  • Loading branch information
wx4stg committed Oct 31, 2023
2 parents 76a5da3 + f8d2115 commit 382d1da
Show file tree
Hide file tree
Showing 56 changed files with 909 additions and 282 deletions.
4 changes: 0 additions & 4 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
codecov:
notify:
after_n_builds: 9

coverage:
status:
patch:
Expand Down
42 changes: 27 additions & 15 deletions .github/actions/install-pypi/action.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: 'Install Using PyPI'
description: 'Setup environment and install using the PyPI-based toolchain'
inputs:
need-cartopy:
description: 'Whether Cartopy is needed'
required: true
default: 'true'
need-extras:
description: 'Whether to install the extras'
required: false
default: 'false'
type:
description: 'Whether test or doc build'
required: true
version-file:
description: 'Name of the version file to use for installation'
required: true
required: false
default: 'requirements.txt'
python-version:
description: 'What version of Python to use'
Expand All @@ -27,31 +27,43 @@ runs:
cache-dependency-path: |
ci/${{ inputs.type }}_requirements.txt
ci/${{ inputs.version-file }}
ci/extra_requirements.txt
# This installs the stuff needed to build and install Shapely and CartoPy from source.
- name: Install CartoPy build dependencies
if: ${{ inputs.need-cartopy == 'true' }}
if: ${{ inputs.need-extras == 'true' }}
shell: bash
run: sudo apt-get install libgeos-dev

- name: Disable Shapely Wheels
if: ${{ inputs.need-extras == 'true' }}
shell: bash
run: echo "PIP_NO_BINARY=shapely" >> $GITHUB_ENV

- name: Install dependencies
- name: Set dependency groups for install
shell: bash
run: python -m pip install -r ci/${{ inputs.type }}_requirements.txt -c ci/${{ inputs.version-file }}
run: |
if [[ ${{ inputs.need-extras }} == 'true' ]]
then
echo "DEP_GROUPS=${{ inputs.type }},extras" >> $GITHUB_ENV
else
echo "DEP_GROUPS=${{ inputs.type }}" >> $GITHUB_ENV
fi
- name: Install extra dependencies
if: ${{ inputs.need-cartopy == 'true' }}
- name: Install
shell: bash
run: python -m pip install -r ci/extra_requirements.txt -c ci/${{ inputs.version-file }}
run: >
python -m pip install .[${{ env.DEP_GROUPS }}]
-c ci/${{ inputs.version-file }} -c ci/${{ inputs.type }}_requirements.txt -c ci/extra_requirements.txt
- name: Install additional test tools
shell: bash
run: >
python -m pip install coverage
-c ci/${{ inputs.version-file }} -c ci/${{ inputs.type }}_requirements.txt -c ci/extra_requirements.txt
- name: Download Cartopy Maps
if: ${{ inputs.need-cartopy == 'true' }}
if: ${{ inputs.need-extras == 'true' }}
shell: bash
run: ci/download_cartopy_maps.py

- name: Install
shell: bash
run: python -m pip install -c ci/${{ inputs.version-file }} .
8 changes: 5 additions & 3 deletions .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ runs:
name: ${{ inputs.key }}-images
path: test_output/

- name: Upload coverage
if: ${{ always() && inputs.upload-coverage == 'true' }}
uses: codecov/codecov-action@v3
- name: Upload coverage artifact
if: ${{ inputs.upload-coverage == 'true' }}
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.key }}
path: coverage.xml
retention-days: 7
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ updates:
commit-message:
prefix: "CI: "
include: "scope"
groups:
flake8:
patterns:
- "flake8*"
- "pycodestyle"
- "pyflakes"

# Update GitHub Actions versions in workflows
- package-ecosystem: "github-actions"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/backport-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
if: github.event.pull_request.merged && contains( github.event.pull_request.labels.*.name, 'backport' )
steps:
- name: Checkout PR HEAD
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 100
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/cffcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out a copy of the repository
uses: actions/checkout@v3
with:
fetch-depth: 1
uses: actions/checkout@v4

- name: Check validity of CITATION.cff
uses: citation-file-format/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/docs-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,11 @@ jobs:
os: macOS

steps:
# We check out only a limited depth and then pull tags to save time
- name: Checkout source
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 100

- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
fetch-depth: 150
fetch-tags: true

- name: Install from Conda
uses: ./.github/actions/install-conda
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,15 @@ jobs:
doc-version: ${{ steps.build-docs.outputs.doc-version }}

steps:
# We check out only a limited depth and then pull tags to save time
- name: Checkout source
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 100

- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
fetch-depth: 150
fetch-tags: true

- name: Install using PyPI
uses: ./.github/actions/install-pypi
with:
need-cartopy: true
type: 'doc'
python-version: ${{ matrix.python-version }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
name: Flake8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python 3
uses: actions/setup-python@v4
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ jobs:
name: Build Release Packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 10

- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
fetch-tags: true

- name: Set up Python
id: setup
Expand Down Expand Up @@ -58,4 +56,4 @@ jobs:
cp packages-*/* dist/
- name: Publish Package
uses: pypa/[email protected].7
uses: pypa/[email protected].10
26 changes: 20 additions & 6 deletions .github/workflows/tests-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,11 @@ jobs:
os: [macOS, Windows]

steps:
# We check out only a limited depth and then pull tags to save time
- name: Checkout source
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 100

- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
fetch-depth: 150
fetch-tags: true

- name: Install from Conda
uses: ./.github/actions/install-conda
Expand All @@ -52,3 +49,20 @@ jobs:
with:
run-doctests: ${{ runner.os != 'Windows' }}
key: conda-${{ matrix.python-version }}-${{ runner.os }}

codecov:
name: CodeCov Upload
needs: CondaTests
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Download coverage artifacts
uses: actions/download-artifact@v3

- name: Upload coverage
uses: codecov/codecov-action@v3
with:
name: ${{ github.workflow }}
46 changes: 31 additions & 15 deletions .github/workflows/tests-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,23 @@ jobs:
fail-fast: false
matrix:
python-version: [3.9, '3.10', 3.11]
dep-versions: [requirements.txt]
dep-versions: [Latest]
no-extras: ['']
include:
- python-version: 3.9
dep-versions: Minimum
- python-version: 3.9
dep-versions: Minimum
no-extras: 'No Extras'
- python-version: 3.11
dep-versions: requirements.txt
no-extras: 'No Extras'

steps:
# We check out only a limited depth and then pull tags to save time
- name: Checkout source
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 100

- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
fetch-depth: 150
fetch-tags: true

- name: Generate minimum dependencies
if: ${{ matrix.dep-versions == 'Minimum' }}
Expand All @@ -55,26 +53,44 @@ jobs:
from pathlib import Path
# Read our pyproject.toml
config = tomllib.load(open('pyproject.toml', 'rb'))
config = tomllib.load(open('pyproject.toml', 'rb'))['project']
opt_deps = config['optional-dependencies']
# Generate a Minimum dependency file
with (Path('ci') / 'Minimum').open('wt') as out:
for dep in config['project']['dependencies']:
if dep:
for src, fname in [(config['dependencies'], 'requirements.txt'),
(opt_deps['test'], 'test_requirements.txt'), (opt_deps['extras'], 'extra_requirements.txt')]:
with (Path('ci') / fname).open('wt') as out:
for dep in src:
dep = dep.split(';')[0]
out.write(dep.replace('>=', '==') + '\n')
EOF
- name: Install from PyPI
uses: ./.github/actions/install-pypi
with:
need-cartopy: ${{ matrix.no-extras != 'No Extras' }}
need-extras: ${{ matrix.no-extras != 'No Extras' }}
type: 'test'
version-file: ${{ matrix.dep-versions }}
python-version: ${{ matrix.python-version }}

- name: Run tests
uses: ./.github/actions/run-tests
with:
run-doctests: ${{ matrix.dep-versions == 'requirements.txt' && matrix.no-extras != 'No Extras' }}
run-doctests: ${{ matrix.dep-versions == 'Latest' && matrix.no-extras != 'No Extras' }}
key: pypi-${{ matrix.python-version }}-${{ matrix.dep-versions }}-${{ matrix.no-extras }}-${{ runner.os }}

codecov:
needs: PyPITests
name: CodeCov Upload
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Download coverage artifacts
uses: actions/download-artifact@v3

- name: Upload coverage
uses: codecov/codecov-action@v3
with:
name: ${{ github.workflow }}
21 changes: 7 additions & 14 deletions .github/workflows/unstable-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@ jobs:
outputs:
result: ${{ steps.tests.outcome }}
steps:
# We check out only a limited depth and then pull tags to save time
- name: Checkout source
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 100

- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
fetch-depth: 150
fetch-tags: true

- name: Assemble test requirements
run: |
Expand All @@ -33,7 +30,7 @@ jobs:
- name: Install using PyPI
uses: ./.github/actions/install-pypi
with:
need-cartopy: true
need-extras: true
type: test
version-file: Prerelease
python-version: 3.11
Expand All @@ -59,14 +56,11 @@ jobs:
outputs:
result: ${{ steps.build.outcome }}
steps:
# We check out only a limited depth and then pull tags to save time
- name: Checkout source
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 100

- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
fetch-depth: 150
fetch-tags: true

- name: Assemble doc requirements
run: |
Expand All @@ -76,7 +70,6 @@ jobs:
- name: Install using PyPI
uses: ./.github/actions/install-pypi
with:
need-cartopy: true
type: doc
version-file: Prerelease
python-version: 3.11
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2008-2020, MetPy Developers
Copyright (c) 2008-2023, MetPy Developers
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
Loading

0 comments on commit 382d1da

Please sign in to comment.