diff --git a/.github/workflows/docs-conda.yml b/.github/workflows/docs-conda.yml index 75dede37da..7f71014fbf 100644 --- a/.github/workflows/docs-conda.yml +++ b/.github/workflows/docs-conda.yml @@ -27,6 +27,8 @@ jobs: - python-version: 3.11 os: macOS - python-version: 3.12 + os: Windows + - python-version: 3.13 os: macOS steps: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 8806e70b38..42e52cf864 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -27,10 +27,10 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.10', 3.11] + python-version: ['3.10', 3.11, 3.12] check-links: [false] include: - - python-version: 3.12 + - python-version: 3.13 check-links: true outputs: doc-version: ${{ steps.build-docs.outputs.doc-version }} @@ -72,7 +72,7 @@ jobs: - name: Download doc build uses: actions/download-artifact@v4 with: - name: Linux-3.11-docs + name: Linux-3.13-docs path: ./docs/build/html # This overrides the version "dev" with the proper version if we're building off a diff --git a/.github/workflows/tests-conda.yml b/.github/workflows/tests-conda.yml index 3bde08225c..794bf857d5 100644 --- a/.github/workflows/tests-conda.yml +++ b/.github/workflows/tests-conda.yml @@ -28,11 +28,13 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.10', 3.12] + python-version: ['3.10', 3.13] os: [macOS, Windows] include: - python-version: 3.11 os: Windows + - python-version: 3.12 + os: macOS steps: - name: Checkout source diff --git a/.github/workflows/tests-pypi.yml b/.github/workflows/tests-pypi.yml index 788d1a6665..3c0cd9ce2c 100644 --- a/.github/workflows/tests-pypi.yml +++ b/.github/workflows/tests-pypi.yml @@ -25,7 +25,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.10', 3.11, 3.12] + python-version: ['3.10', 3.11, 3.12, 3.13] dep-versions: [Latest] no-extras: [''] include: @@ -34,7 +34,7 @@ jobs: - python-version: '3.10' dep-versions: Minimum no-extras: 'No Extras' - - python-version: 3.12 + - python-version: 3.13 dep-versions: Latest no-extras: 'No Extras' diff --git a/.github/workflows/unstable-builds.yml b/.github/workflows/unstable-builds.yml index 2ca542212c..a9d3ce483f 100644 --- a/.github/workflows/unstable-builds.yml +++ b/.github/workflows/unstable-builds.yml @@ -33,7 +33,7 @@ jobs: need-extras: true type: test version-file: Prerelease - python-version: 3.12 + python-version: 3.13 - name: Run tests id: tests @@ -72,7 +72,7 @@ jobs: with: type: doc version-file: Prerelease - python-version: 3.12 + python-version: 3.13 - name: Build docs id: build diff --git a/docs/conf.py b/docs/conf.py index 37f8c5fe97..09b1678849 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -519,12 +519,15 @@ def linkcode_resolve(domain, info): else: linespec = "" - fn = os.path.relpath(fn, start=os.path.dirname(metpy.__file__)) - - if "+" in metpy.__version__: - return f"https://github.com/Unidata/MetPy/blob/main/src/metpy/{fn}{linespec}" + if 'metpy' in fn: + fn = os.path.relpath(fn, start=os.path.dirname(metpy.__file__)) + + if "+" in metpy.__version__: + return f"https://github.com/Unidata/MetPy/blob/main/src/metpy/{fn}{linespec}" + else: + return ( + f"https://github.com/Unidata/MetPy/blob/" + f"v{metpy.__version__}/src/metpy/{fn}{linespec}" + ) else: - return ( - f"https://github.com/Unidata/MetPy/blob/" - f"v{metpy.__version__}/src/metpy/{fn}{linespec}" - ) + return None diff --git a/pyproject.toml b/pyproject.toml index 123fa9bcbf..2838f96003 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,6 +17,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Atmospheric Science", "Intended Audience :: Science/Research", diff --git a/src/metpy/calc/tools.py b/src/metpy/calc/tools.py index 4f856184b6..3f5af337c5 100644 --- a/src/metpy/calc/tools.py +++ b/src/metpy/calc/tools.py @@ -6,6 +6,7 @@ import functools from inspect import Parameter, signature from operator import itemgetter +import textwrap import numpy as np @@ -982,32 +983,35 @@ def wrapper(f, **kwargs): def _add_grid_params_to_docstring(docstring: str, orig_includes: dict) -> str: """Add documentation for some dynamically added grid parameters to the docstring.""" - other_params = docstring.find('Other Parameters') - blank = docstring.find('\n\n', other_params) + other_params = 'Other Parameters' + other_ind = docstring.find(other_params) + indent = docstring.find('-', other_ind) - other_ind - len(other_params) - 1 # -1 for \n + blank = docstring.find('\n\n', other_ind) entries = { 'longitude': """ - longitude : `pint.Quantity`, optional - Longitude of data. Optional if `xarray.DataArray` with latitude/longitude coordinates - used as input. Also optional if parallel_scale and meridional_scale are given. If - otherwise omitted, calculation will be carried out on a Cartesian, rather than - geospatial, grid. Keyword-only argument.""", +longitude : `pint.Quantity`, optional + Longitude of data. Optional if `xarray.DataArray` with latitude/longitude coordinates + used as input. Also optional if parallel_scale and meridional_scale are given. If + otherwise omitted, calculation will be carried out on a Cartesian, rather than + geospatial, grid. Keyword-only argument.""", 'latitude': """ - latitude : `pint.Quantity`, optional - Latitude of data. Optional if `xarray.DataArray` with latitude/longitude coordinates - used as input. Also optional if parallel_scale and meridional_scale are given. If - otherwise omitted, calculation will be carried out on a Cartesian, rather than - geospatial, grid. Keyword-only argument.""", +latitude : `pint.Quantity`, optional + Latitude of data. Optional if `xarray.DataArray` with latitude/longitude coordinates + used as input. Also optional if parallel_scale and meridional_scale are given. If + otherwise omitted, calculation will be carried out on a Cartesian, rather than + geospatial, grid. Keyword-only argument.""", 'crs': """ - crs : `pyproj.crs.CRS`, optional - Coordinate Reference System of data. Optional if `xarray.DataArray` with MetPy CRS - used as input. Also optional if parallel_scale and meridional_scale are given. If - otherwise omitted, calculation will be carried out on a Cartesian, rather than - geospatial, grid. Keyword-only argument.""" +crs : `pyproj.crs.CRS`, optional + Coordinate Reference System of data. Optional if `xarray.DataArray` with MetPy CRS + used as input. Also optional if parallel_scale and meridional_scale are given. If + otherwise omitted, calculation will be carried out on a Cartesian, rather than + geospatial, grid. Keyword-only argument.""" } return ''.join([docstring[:blank], - *(entries[p] for p, included in orig_includes.items() if not included), + *(textwrap.indent(entries[p], ' ' * indent) + for p, included in orig_includes.items() if not included), docstring[blank:]])