From bcb959ab2da5ae199b750d518d7cf7ee487e2235 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Sun, 1 Sep 2024 12:06:26 +0200 Subject: [PATCH] 0.6.0 release (#2265) * 0.6.0 release * Fix versionadded * Update docs on ruff * EuroCrops: consistent citation message * Attempt to remove fully qualified type hints * Silence test warnings * Undo digital typhoon changes * Undo sphinx req changes * Automatically delete downloaded models after successful tests to avoid OOM * Silence mypy warning * Skip dependabot in auto-generated release notes --- .github/release.yml | 2 +- docs/conf.py | 3 +-- docs/user/contributing.rst | 6 +++--- pyproject.toml | 5 ++++- tests/conftest.py | 6 ++++++ torchgeo/__init__.py | 2 +- torchgeo/datamodules/digital_typhoon.py | 5 ++++- torchgeo/datamodules/geonrw.py | 2 +- torchgeo/datasets/eurocrops.py | 5 +++-- torchgeo/datasets/levircd.py | 2 -- torchgeo/trainers/byol.py | 4 ++-- torchgeo/trainers/segmentation.py | 4 ++-- 12 files changed, 28 insertions(+), 18 deletions(-) diff --git a/.github/release.yml b/.github/release.yml index 76caf0a585e..8ca5b59679c 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ changelog: exclude: authors: - - dependabot[bot] + - app/dependabot categories: - title: Backwards-incompatible changes labels: diff --git a/docs/conf.py b/docs/conf.py index ec721bfff9d..4078970c2e4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -50,8 +50,7 @@ # This pattern also affects html_static_path and html_extra_path. exclude_patterns = ['_build'] -# Sphinx 3.0+ required for: -# autodoc_typehints_description_target = "documented" +# Sphinx 4.0+ required for autodoc_typehints_description_traget needs_sphinx = '4.0' nitpicky = True diff --git a/docs/user/contributing.rst b/docs/user/contributing.rst index 91b8b4d3ab4..2d5b173cc15 100644 --- a/docs/user/contributing.rst +++ b/docs/user/contributing.rst @@ -88,7 +88,7 @@ These tests require `pytest `_ and `pytest-c Linters ------- -In order to remain `PEP-8 `_ compliant and maintain a high-quality codebase, we use a couple of linting tools: +In order to remain `PEP-8 `_ compliant and maintain a high-quality codebase, we use a few linting tools: * `ruff `_ for code formatting * `mypy `_ for static type analysis @@ -98,8 +98,8 @@ These tools should be used from the root of the project to ensure that our confi .. code-block:: console - $ ruff check $ ruff format + $ ruff check Mypy won't fix your code for you, but will warn you about potential issues with your code: @@ -164,7 +164,7 @@ The resulting HTML files can be found in ``_build/html``. Open ``index.html`` in Tutorials --------- -TorchGeo has a number of tutorials included in the documentation that can be run in `Google Colab `_. These Jupyter notebooks are tested before each release to make sure that they still run properly. To test these locally, install `pytest `_ and `nbmake `_ and run: +TorchGeo has a number of tutorials included in the documentation that can be run in `Lightning Studios `_ and `Google Colab `_. These Jupyter notebooks are tested before each release to make sure that they still run properly. To test these locally, install `pytest `_ and `nbmake `_ and run: .. code-block:: console diff --git a/pyproject.toml b/pyproject.toml index 97d326961de..3a2c2319ee6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -103,7 +103,7 @@ docs = [ "nbsphinx>=0.8.5", # release versions missing files, must install from master "pytorch-sphinx-theme", - # sphinx 4+ required for autodoc_typehints_description_target = documented + # sphinx 4+ required for autodoc_typehints_description_target # sphinx 6+ is incompatible with pytorch-sphinx-theme # https://github.com/pytorch/pytorch_sphinx_theme/issues/175 "sphinx>=4,<6", @@ -226,12 +226,15 @@ filterwarnings = [ "ignore:Deprecated call to `pkg_resources.declare_namespace:DeprecationWarning", "ignore:pkg_resources is deprecated as an API.:DeprecationWarning:lightning_utilities.core.imports", "ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated:DeprecationWarning:jsonargparse", + "ignore:`ModuleAvailableCache` is a special case of `RequirementCache`.:DeprecationWarning:lightning.fabric.plugins.environments.xla", # https://github.com/pytorch/pytorch/issues/110549 "ignore:allow_ops_in_compiled_graph failed to import torch:ImportWarning:einops", # https://github.com/rr-/docstring_parser/pull/82 "ignore:ast.* is deprecated and will be removed in Python 3.14:DeprecationWarning:docstring_parser.attrdoc", # https://github.com/python/cpython/pull/102953 "ignore:Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata:DeprecationWarning:torchgeo.datasets.utils", + "ignore:Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata:DeprecationWarning:torchgeo.datasets.digital_typhoon", + "ignore:Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata:DeprecationWarning:torchvision.datasets.utils", # https://github.com/kornia/kornia/pull/2967 "ignore:`torch.cuda.amp.custom_fwd\\(args...\\)` is deprecated.:FutureWarning:kornia.feature.lightglue", # https://github.com/kornia/kornia/pull/2981 diff --git a/tests/conftest.py b/tests/conftest.py index 7d622c3977c..1f5c09a8bb0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. +from pathlib import Path from typing import Any import pytest @@ -16,3 +17,8 @@ def load(*args: Any, progress: bool = False, **kwargs: Any) -> Any: @pytest.fixture def load_state_dict_from_url(monkeypatch: MonkeyPatch) -> None: monkeypatch.setattr(torchvision.models._api, 'load_state_dict_from_url', load) + + +@pytest.fixture(autouse=True) +def torch_hub(tmp_path: Path) -> None: + torch.hub.set_dir(tmp_path) # type: ignore[no-untyped-call] diff --git a/torchgeo/__init__.py b/torchgeo/__init__.py index 5574da2f7eb..8b36139d831 100644 --- a/torchgeo/__init__.py +++ b/torchgeo/__init__.py @@ -11,4 +11,4 @@ """ __author__ = 'Adam J. Stewart' -__version__ = '0.6.0.dev0' +__version__ = '0.6.0' diff --git a/torchgeo/datamodules/digital_typhoon.py b/torchgeo/datamodules/digital_typhoon.py index 11874aba8de..ce799bf3d52 100644 --- a/torchgeo/datamodules/digital_typhoon.py +++ b/torchgeo/datamodules/digital_typhoon.py @@ -16,7 +16,10 @@ class DigitalTyphoonDataModule(NonGeoDataModule): - """Digital Typhoon Data Module.""" + """Digital Typhoon Data Module. + + .. versionadded:: 0.6 + """ valid_split_types = ('time', 'typhoon_id') diff --git a/torchgeo/datamodules/geonrw.py b/torchgeo/datamodules/geonrw.py index 8540b8276c2..c67753673ac 100644 --- a/torchgeo/datamodules/geonrw.py +++ b/torchgeo/datamodules/geonrw.py @@ -21,7 +21,7 @@ class GeoNRWDataModule(NonGeoDataModule): Implements 80/20 train/val splits based on city locations. See :func:`setup` for more details. - .. versionadded: 0.6 + .. versionadded:: 0.6 """ def __init__( diff --git a/torchgeo/datasets/eurocrops.py b/torchgeo/datasets/eurocrops.py index cb5bb2a5bc5..d2087e4b38d 100644 --- a/torchgeo/datasets/eurocrops.py +++ b/torchgeo/datasets/eurocrops.py @@ -31,8 +31,9 @@ class EuroCrops(VectorDataset): is tagged with a "EC_hcat_n" attribute indicating the harmonized crop name grown within the polygon in the year associated with the shapefile. - If you use this dataset in your research, please follow the citation guidelines at - https://github.com/maja601/EuroCrops#reference. + If you use this dataset in your research, please follow the citation guidelines at: + + * https://github.com/maja601/EuroCrops#reference. .. versionadded:: 0.6 """ diff --git a/torchgeo/datasets/levircd.py b/torchgeo/datasets/levircd.py index e664365ab2d..fdff569dc19 100644 --- a/torchgeo/datasets/levircd.py +++ b/torchgeo/datasets/levircd.py @@ -329,8 +329,6 @@ class LEVIRCDPlus(LEVIRCDBase): If you use this dataset in your research, please cite the following paper: * https://arxiv.org/abs/2107.09244 - - .. versionchanged:: 0.6 """ url = 'https://drive.google.com/file/d/1JamSsxiytXdzAIk6VDVWfc-OsX-81U81' diff --git a/torchgeo/trainers/byol.py b/torchgeo/trainers/byol.py index 38aac522b9d..6cd4f50f8c5 100644 --- a/torchgeo/trainers/byol.py +++ b/torchgeo/trainers/byol.py @@ -122,8 +122,8 @@ class BackboneWrapper(nn.Module): * The output of the encoding layer is passed through the projection head * The forward call returns the output of the projection head - .. versionchanged 0.4: Name changed from *EncoderWrapper* to - *BackboneWrapper*. + .. versionchanged:: 0.4 + Name changed from *EncoderWrapper* to *BackboneWrapper*. """ def __init__( diff --git a/torchgeo/trainers/segmentation.py b/torchgeo/trainers/segmentation.py index afd71521002..9eccda2f0f8 100644 --- a/torchgeo/trainers/segmentation.py +++ b/torchgeo/trainers/segmentation.py @@ -77,7 +77,7 @@ class and used with 'ce' loss. were renamed to *model*, *backbone*, and *weights*. .. versionadded:: 0.5 - The *class_weights*, *freeze_backbone*, and *freeze_decoder* parameters. + The *class_weights*, *freeze_backbone*, and *freeze_decoder* parameters. .. versionchanged:: 0.5 The *weights* parameter now supports WeightEnums and checkpoint paths. @@ -85,7 +85,7 @@ class and used with 'ce' loss. *lr* and *patience*. .. versionchanged:: 0.6 - The *ignore_index* parameter now works for jaccard loss. + The *ignore_index* parameter now works for jaccard loss. """ self.weights = weights super().__init__(ignore='weights')