From 72d1981bac217abbf69ab684f4e45c052757d04a Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Wed, 21 Jun 2023 10:05:27 -0300 Subject: [PATCH 1/4] use setup-micromamba --- .github/workflows/deploy-docs.yml | 26 +++++++++++------------ .github/workflows/tarball-tests.yml | 16 ++++++--------- .github/workflows/tests.yml | 32 ++++++++++++++--------------- 3 files changed, 35 insertions(+), 39 deletions(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 8076b41..2e02d22 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -14,28 +14,28 @@ jobs: - uses: actions/checkout@v3 - name: Setup Micromamba - uses: mamba-org/provision-with-micromamba@v16 + uses: mamba-org/setup-micromamba@v1 with: - environment-file: false + environment-name: TEST + init-shell: bash + create-args: >- + python=3 numpy --file requirements-dev.txt --channel conda-forge - - name: Create environment + - name: Install gsw shell: bash -l {0} - run: > - micromamba create --name TEST python=3 numpy --file requirements-dev.txt --channel conda-forge - && micromamba activate TEST - && pip install -e . --no-deps --force-reinstall + run: | + python -m pip install -e . --no-deps --force-reinstall - name: Build documentation shell: bash -l {0} - run: | - micromamba activate TEST + run: > set -e - pushd docs - make clean html linkcheck - popd + && pushd docs + && make clean html linkcheck + && popd - name: GitHub Pages action - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') + if: success() && github.event_name == 'release' uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tarball-tests.yml b/.github/workflows/tarball-tests.yml index 3644644..ad08095 100644 --- a/.github/workflows/tarball-tests.yml +++ b/.github/workflows/tarball-tests.yml @@ -12,20 +12,16 @@ jobs: - uses: actions/checkout@v3 - name: Setup Micromamba - uses: mamba-org/provision-with-micromamba@v16 + uses: mamba-org/setup-micromamba@v1 with: - environment-file: false - - - name: Create environment - shell: bash -l {0} - run: > - micromamba create --name TEST python=3 python-build numpy --file requirements-dev.txt --channel conda-forge - && micromamba activate TEST + environment-name: TEST + init-shell: bash + create-args: >- + python=3 python-build numpy --file requirements-dev.txt --channel conda-forge - name: Tarball shell: bash -l {0} run: > - micromamba activate TEST - && python -m build --skip-dependency-check --sdist --wheel . + python -m build --skip-dependency-check --sdist --wheel . && check-manifest --verbose && twine check dist/* diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f956a30..2a3c341 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,39 +10,39 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11"] os: [windows-latest, ubuntu-latest, macos-latest] # Oldest one based on NEP-29 and latest one. # See https://numpy.org/neps/nep-0029-deprecation_policy.html - numpy-version: ["1.21", "1.23"] + numpy-version: ["1.22", "1.25"] exclude: - python-version: "3.11" - numpy-version: "1.21" + numpy-version: "1.22" fail-fast: false steps: - uses: actions/checkout@v3 - - name: Setup Micromamba - uses: mamba-org/provision-with-micromamba@v16 + - name: Setup Micromamba Python ${{ matrix.python-version }} numpy ${{ matrix.numpy-version }} + uses: mamba-org/setup-micromamba@v1 with: - environment-file: false + environment-name: TEST + init-shell: bash + create-args: >- + python=${{ matrix.python-version }} python-build numpy=${{ matrix.numpy-version }} --file requirements-dev.txt --channel conda-forge - - name: Python ${{ matrix.python-version }} numpy ${{ matrix.numpy-version }} + - name: Install gsw shell: bash -l {0} - run: > - micromamba create --name TEST python=${{ matrix.python-version }} python-build numpy=${{ matrix.numpy-version }} --file requirements-dev.txt --channel conda-forge - && micromamba activate TEST - && python -m pip install -e . --no-deps --no-build-isolation --force-reinstall + run: | + python -m pip install -e . --no-deps --force-reinstall - name: Debug shell: bash -l {0} - run: > - micromamba activate TEST - && python -c "import numpy; print(f'Running numpy {numpy.__version__}')" + run: | + python -c "import numpy; print(f'Running numpy {numpy.__version__}')" - name: Tests shell: bash -l {0} - run: > + run: | micromamba activate TEST - && pytest -s -rxs -v gsw/tests + pytest -s -rxs -v gsw/tests From 26a2c54bcece87c8b52f7c1f33ced82910ca712d Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Wed, 21 Jun 2023 10:05:30 -0300 Subject: [PATCH 2/4] update pre-commits --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d66864e..2ef1350 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ repos: - id: check-added-large-files - repo: https://github.com/codespell-project/codespell - rev: v2.2.4 + rev: v2.2.5 hooks: - id: codespell exclude: > @@ -19,13 +19,13 @@ repos: - --ignore-words-list=nin,preformed,wih, - repo: https://github.com/tox-dev/pyproject-fmt - rev: 0.9.2 + rev: 0.12.1 hooks: - id: pyproject-fmt - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.260 + rev: v0.0.274 hooks: - id: ruff From 9ea9506d4d6d4de559e3281f9259cb602aef7182 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Wed, 21 Jun 2023 10:05:42 -0300 Subject: [PATCH 3/4] run pre-commit --- gsw/geostrophy.py | 6 ++---- pyproject.toml | 46 +++++++++++++++++++++++----------------------- 2 files changed, 25 insertions(+), 27 deletions(-) diff --git a/gsw/geostrophy.py b/gsw/geostrophy.py index 847ac02..bbc6211 100644 --- a/gsw/geostrophy.py +++ b/gsw/geostrophy.py @@ -176,12 +176,10 @@ def distance(lon, lat, p=0, axis=-1): earth_radius = 6371e3 if not lon.shape == lat.shape: - raise ValueError('lon, lat shapes must match; found %s, %s' - % (lon.shape, lat.shape)) + raise ValueError(f'lon, lat shapes must match; found {lon.shape}, {lat.shape}') if not (lon.ndim in (1, 2) and lon.shape[axis] > 1): raise ValueError('lon, lat must be 1-D or 2-D with more than one point' - ' along axis; found shape %s and axis %s' - % (lon.shape, axis)) + ' along axis; found shape {} and axis {}'.format(lon.shape, axis)) if lon.ndim == 1: one_d = True # xarray requires expand_dims() rather than [newaxis, :] diff --git a/pyproject.toml b/pyproject.toml index a738f0e..a5edfdc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,17 +18,17 @@ authors = [ ] requires-python = ">=3.8" classifiers = [ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Science/Research", - "Operating System :: OS Independent", - "License :: OSI Approved :: BSD License", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Topic :: Scientific/Engineering", + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Scientific/Engineering", ] dynamic = [ "readme", @@ -58,18 +58,6 @@ write_to = "gsw/_version.py" write_to_template = "__version__ = '{version}'" tag_regex = "^(?Pv)?(?P[^\\+]+)(?P.*)?$" -[tool.check-manifest] -ignore = [ - "*.yml", - ".coveragerc", - "docs", - "docs/*", - "*.enc", - "tools", - "tools/*", - "gsw/_version.py", -] - [tool.ruff] select = [ "A", # flake8-builtins @@ -104,3 +92,15 @@ exclude = [ "gsw/_utilities.py" = [ "B904", # Within an ``except`` clause, raise exceptions with ``raise ... from err`` ] + +[tool.check-manifest] +ignore = [ + "*.yml", + ".coveragerc", + "docs", + "docs/*", + "*.enc", + "tools", + "tools/*", + "gsw/_version.py", +] From 850e85a86a4f37fc8dcbe1eb5064e6fd0b08e05b Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Wed, 21 Jun 2023 10:09:12 -0300 Subject: [PATCH 4/4] no longer needed --- MANIFEST.in | 1 - 1 file changed, 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 4fa7475..e9f1f90 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -15,7 +15,6 @@ global-exclude *.so exclude *.yml exclude *.yaml -exclude *.enc exclude .gitignore exclude .isort.cfg exclude .zenodo.json