From 58dc1529710a91eb75129a8c4c58d0445b0e87ae Mon Sep 17 00:00:00 2001 From: Ryan May Date: Wed, 14 Apr 2021 15:46:15 -0600 Subject: [PATCH 1/8] CI: Only deploy docs on Python 3.9 build This keeps us from deploying twice for each merge like we currently are. --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 8fe85d74ec..d65b0c2def 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -133,7 +133,7 @@ jobs: run: echo "DOC_VERSION=v$(python -c 'import metpy; print(metpy.__version__.rsplit(".", maxsplit=2)[0])')" >> $GITHUB_ENV - name: Upload to GitHub Pages - if: ${{ github.event_name != 'pull_request' && matrix.experimental == false }} + if: ${{ github.event_name != 'pull_request' && matrix.experimental == false && matrix.python-version == '3.9' }} uses: peaceiris/actions-gh-pages@v3.8.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} From def38d06f8e45a02f884f4e1c62c87443585f32e Mon Sep 17 00:00:00 2001 From: Ryan May Date: Wed, 14 Apr 2021 15:49:43 -0600 Subject: [PATCH 2/8] CI: Build and deploy docs on release This is in addition to doing it on merge to main, which will update the dev docs and for any released version. --- .github/workflows/docs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index d65b0c2def..7600a91e02 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -9,6 +9,7 @@ on: tags: - v[0-9]+.[0-9]+.[0-9]+ pull_request: + release: jobs: # From daf7d6c6618e0b47bb08e46bc287b89e33667436 Mon Sep 17 00:00:00 2001 From: Ryan May Date: Thu, 15 Apr 2021 12:16:41 -0600 Subject: [PATCH 3/8] CI: Add environment to upload to PyPI Set things up to use a GitHub environment for uploading to PyPI. This treats the upload to PyPI as a deployment, and restricts the PyPI token to this environment. Ideally, this would allow us to restrict the environment to our tagged releases, but unfortunately the "branch filter" rules only work on branches, not tags. This was motivated by CodeCov having a security breach. Our PyPI token doesn't seem to be at risk, but it was rotated anyway and this seems like a nice extra layer to put in the way of it accidentally being exposed/used. --- .github/workflows/release.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ec1a24b390..67d3cb1052 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,11 +8,14 @@ on: jobs: packages: name: Release Packages + environment: + name: PyPI + url: https://pypi.org/project/MetPy/ runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: - fetch-depth: 150 + fetch-depth: 10 - name: Get tags run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* From 5251a434a011cb00edc2dda95538d44c7305a199 Mon Sep 17 00:00:00 2001 From: Ryan May Date: Thu, 15 Apr 2021 12:19:20 -0600 Subject: [PATCH 4/8] CI: Tweak draft release action Releases can now optionally create a discussion topic when they are published, so go ahead and set that up when drafting the release. --- .github/workflows/draft-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml index 0b8b14edfc..37e652d155 100644 --- a/.github/workflows/draft-release.yml +++ b/.github/workflows/draft-release.yml @@ -52,7 +52,8 @@ jobs: tag_name: 'v' + milestone.title, name: milestone.title, draft: true, - body: body + body: body, + discussion_category_name: 'Announcements' }; const match = milestone.description.match(/branch:\s*([^\s]+)/); if (!!match) { From 7f568d191a591c0f82e67603eb2465934de8ab21 Mon Sep 17 00:00:00 2001 From: Ryan May Date: Tue, 11 Aug 2020 23:31:30 -0600 Subject: [PATCH 5/8] CI: Make sure flake8 erroring fails the workflow Need to enable pipefail so that if flake8 crashes, bash sets that as the error state. --- .github/workflows/linting.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 426b3ea757..e14ba645b2 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -31,6 +31,7 @@ jobs: env: REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | + set -o pipefail flake8 | reviewdog -f=pep8 -name=flake8 -reporter=github-check -filter-mode=nofilter - name: Run doc8 From af59eef2fbbfd3452f2665611bc0d206cf3f9703 Mon Sep 17 00:00:00 2001 From: Ryan May Date: Mon, 8 Mar 2021 16:39:46 -0700 Subject: [PATCH 6/8] DOC: Fix formula rendering in some docstrings Using relative_humidity in a formula makes for some bad latex equations--use rh instead. --- src/metpy/calc/thermo.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/metpy/calc/thermo.py b/src/metpy/calc/thermo.py index ec374e00e5..18c064d878 100644 --- a/src/metpy/calc/thermo.py +++ b/src/metpy/calc/thermo.py @@ -1542,10 +1542,10 @@ def mixing_ratio_from_relative_humidity(pressure, temperature, relative_humidity ----- Formula adapted from [Hobbs1977]_ pg. 74. - .. math:: w = (relative_humidity)(w_s) + .. math:: w = (rh)(w_s) * :math:`w` is mixing ratio - * :math:`relative_humidity` is relative humidity as a unitless ratio + * :math:`rh` is relative humidity as a unitless ratio * :math:`w_s` is the saturation mixing ratio .. versionchanged:: 1.0 @@ -1589,9 +1589,9 @@ def relative_humidity_from_mixing_ratio(pressure, temperature, mixing_ratio): ----- Formula based on that from [Hobbs1977]_ pg. 74. - .. math:: relative_humidity = \frac{w}{w_s} + .. math:: rh = \frac{w}{w_s} - * :math:`relative_humidity` is relative humidity as a unitless ratio + * :math:`rh` is relative humidity as a unitless ratio * :math:`w` is mixing ratio * :math:`w_s` is the saturation mixing ratio From e995194eec96f3f58c6bfd698feba50e6af197a1 Mon Sep 17 00:00:00 2001 From: Ryan May Date: Wed, 28 Apr 2021 16:06:27 -0600 Subject: [PATCH 7/8] DOC: Update the infrastructure guide Include informaton about the workflow managing versions on gh-pages. --- docs/devel/infrastructureguide.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/devel/infrastructureguide.rst b/docs/devel/infrastructureguide.rst index 7472508bac..8d4537833a 100644 --- a/docs/devel/infrastructureguide.rst +++ b/docs/devel/infrastructureguide.rst @@ -33,10 +33,13 @@ extension also makes these scripts available as Jupyter notebooks. The documentation is hosted on `GitHub Pages `_. The docs are built automatically and uploaded upon pushes or merges to GitHub. Commits to ``main`` end up in our development version docs, while commits to versioned branches will update the -docs for the corresponding version, which are located in the appropriately named subidrectory +docs for the corresponding version, which are located in the appropriately named subdirectory on the ``gh-pages`` branch. We only maintain docs at the minor level, not the bugfix one. The docs rely on the ``pydata-sphinx-theme`` package for styling the docs, which needs to be -installed for any local doc builds. +installed for any local doc builds. The ``gh-pages`` branch has a GitHub Actions workflow that +handles generating a ``versions.json`` file that controls what versions are displayed in the +selector on the website, as well as update the ``latest`` symlink that points to the latest +version of the docs. ----------- Other Tools From 47a4685f662e757072d391aadaaadf6ded47bf0c Mon Sep 17 00:00:00 2001 From: Ryan May Date: Wed, 28 Apr 2021 16:38:15 -0600 Subject: [PATCH 8/8] CI: Fix bad path to our local flake8 plugin --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 7a12ad5fed..312e9b56f2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -96,7 +96,7 @@ per-file-ignores = examples/*.py: D MPY001 T003 T001 [flake8:local-plugins] extension = MPY = flake8_metpy:MetPyChecker -paths = ./tools/flake8_metpy +paths = ./tools/flake8-metpy [tool:pytest] # https://github.com/matplotlib/pytest-mpl/issues/69