diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index e1ed2ab9c..8b681c4b3 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -53,17 +53,23 @@ jobs: python-version: ${{ matrix.python-version }} channels: conda-forge channel-priority: strict - if: ${{ runner.os == 'Windows' }} + if: ${{ runner.os == 'Windows' && matrix.python-version == '3.7' }} - name: Install conda dependencies (Windows) run: | - conda install 'fiona==1.8.21' 'rasterio==1.2.10' + conda install 'rasterio==1.2.10' conda list conda info - if: ${{ runner.os == 'Windows' }} - - name: Install pip dependencies + if: ${{ runner.os == 'Windows' && matrix.python-version == '3.7' }} + - name: Install pip dependencies (3.8+) run: | pip install -r requirements/required.txt -r requirements/datasets.txt -r requirements/tests.txt pip list + if: ${{ matrix.python-version != '3.7' }} + - name: Install pip dependencies (3.7) + run: | + pip install -r requirements/required.old -r requirements/datasets.old -r requirements/tests.txt + pip list + if: ${{ matrix.python-version == '3.7' }} - name: Run pytest checks run: pytest --cov=torchgeo --cov-report=xml - name: Report coverage @@ -85,7 +91,7 @@ jobs: - name: Install pip dependencies run: | pip install cython numpy==1.17.2 # needed by pycocotools - pip install -r requirements/min + pip install -r requirements/min.old pip list - name: Run pytest checks run: pytest --cov=torchgeo --cov-report=xml diff --git a/requirements/README.md b/requirements/README.md new file mode 100644 index 000000000..b5476f308 --- /dev/null +++ b/requirements/README.md @@ -0,0 +1,9 @@ +This directory contains several files that document the versions of our dependencies used in CI. These are not hard requirements for using TorchGeo. + +### Managed by dependabot + +All files with a `.txt` extension are managed by dependabot and should not be manually edited unless you need to add or remove a dependency. + +### Not managed by dependabot + +All files with a `.old` extension are not managed by dependabot. They document the minimum version of our dependencies that we support, or older versions required for versions of Python that the numpy ecosystem no longer supports. See [NEP-29](https://numpy.org/neps/nep-0029-deprecation_policy.html) for more information on the numpy deprecation timeline. See https://github.com/dependabot/dependabot-core/issues/5299 and https://github.com/dependabot/dependabot-core/issues/5300 for why these dependencies have to be in separate files with a different file extension. diff --git a/requirements/datasets.old b/requirements/datasets.old new file mode 100644 index 000000000..5ef1d70f6 --- /dev/null +++ b/requirements/datasets.old @@ -0,0 +1,14 @@ +# datasets +h5py==3.6.0 +laspy==2.2.0 +open3d==0.14.1;python_version<'3.10' +opencv-python==4.6.0.66 +pandas==1.4.3;python_version>='3.8' +pandas==1.3.5;python_version=='3.7' +pycocotools==2.0.4 +radiant-mlhub==0.5.1;python_version>='3.8' +radiant-mlhub==0.4.1;python_version=='3.7' +rarfile==4.0 +scipy==1.8.1;python_version>='3.8' +scipy==1.7.3;python_version=='3.7' +zipfile-deflate64==0.2.0 diff --git a/requirements/datasets.txt b/requirements/datasets.txt index 4c63b518a..04e9e7f3b 100644 --- a/requirements/datasets.txt +++ b/requirements/datasets.txt @@ -1,18 +1,11 @@ -# This file is managed by dependabot and should not be manually edited unless you need -# to add or remove a dependency. It documents the version of our dependencies used in -# CI, these are not hard requirements for using TorchGeo. - # datasets h5py==3.6.0 laspy==2.2.0 open3d==0.14.1;python_version<'3.10' opencv-python==4.6.0.66 pandas==1.4.3;python_version>='3.8' -pandas==1.3.5;python_version=='3.7' pycocotools==2.0.4 radiant-mlhub==0.5.1;python_version>='3.8' -radiant-mlhub==0.4.1;python_version=='3.7' rarfile==4.0 scipy==1.8.1;python_version>='3.8' -scipy==1.7.3;python_version=='3.7' zipfile-deflate64==0.2.0 diff --git a/requirements/docs.txt b/requirements/docs.txt index 29e4cd14d..95fcca3f4 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -1,7 +1,3 @@ -# This file is managed by dependabot and should not be manually edited unless you need -# to add or remove a dependency. It documents the version of our dependencies used in -# CI, these are not hard requirements for using TorchGeo. - # docs ipywidgets==7.7.1 nbsphinx==0.8.9 diff --git a/requirements/min b/requirements/min.old similarity index 86% rename from requirements/min rename to requirements/min.old index d67d9d17b..63286e6e1 100644 --- a/requirements/min +++ b/requirements/min.old @@ -1,6 +1,3 @@ -# This file is not managed by dependabot. It documents the minimum version of our -# dependencies that is supported. - # setup setuptools==42.0.0 diff --git a/requirements/required.old b/requirements/required.old new file mode 100644 index 000000000..7fc46aea9 --- /dev/null +++ b/requirements/required.old @@ -0,0 +1,28 @@ +# setup +setuptools==62.6.0 + +# install +einops==0.4.1 +fiona==1.9a2 +kornia==0.6.5 +matplotlib==3.5.2 +numpy==1.23.0;python_version>='3.8' +numpy==1.21.6;python_version=='3.7' +omegaconf==2.2.2 +packaging==21.3 +pillow==9.2.0 +protobuf==3.20.1 +pyproj==3.3.1;python_version>='3.8' +pyproj==3.2.0;python_version=='3.7' +pytorch-lightning==1.6.4 +rasterio==1.3b3;python_version>='3.8' +rasterio==1.2.10;python_version=='3.7' +rtree==1.0.0 +scikit-learn==1.1.1;python_version>='3.8' +scikit-learn==1.0.2;python_version=='3.7' +segmentation-models-pytorch==0.2.1 +shapely==1.8.2 +timm==0.4.12 +torch==1.12.0 +torchmetrics==0.9.2 +torchvision==0.13.0 diff --git a/requirements/required.txt b/requirements/required.txt index 8bfeca47e..37082f475 100644 --- a/requirements/required.txt +++ b/requirements/required.txt @@ -1,29 +1,21 @@ -# This file is managed by dependabot and should not be manually edited unless you need -# to add or remove a dependency. It documents the version of our dependencies used in -# CI, these are not hard requirements for using TorchGeo. - # setup setuptools==62.6.0 # install einops==0.4.1 -fiona==1.8.21 +fiona==1.9a2 kornia==0.6.5 matplotlib==3.5.2 numpy==1.23.0;python_version>='3.8' -numpy==1.21.6;python_version=='3.7' omegaconf==2.2.2 packaging==21.3 pillow==9.2.0 protobuf==3.20.1 pyproj==3.3.1;python_version>='3.8' -pyproj==3.2.0;python_version=='3.7' pytorch-lightning==1.6.4 -rasterio==1.3b3;python_version=='3.10' and platform_system != 'Windows' -rasterio==1.2.10;python_version<='3.9' or platform_system == 'Windows' +rasterio==1.3b3;python_version>='3.8' rtree==1.0.0 scikit-learn==1.1.1;python_version>='3.8' -scikit-learn==1.0.2;python_version=='3.7' segmentation-models-pytorch==0.2.1 shapely==1.8.2 timm==0.4.12 diff --git a/requirements/style.txt b/requirements/style.txt index 81efc10d6..e1627fbec 100644 --- a/requirements/style.txt +++ b/requirements/style.txt @@ -1,10 +1,6 @@ -# This file is managed by dependabot and should not be manually edited unless you need -# to add or remove a dependency. It documents the version of our dependencies used in -# CI, these are not hard requirements for using TorchGeo. - # style black[jupyter]==22.6.0 -flake8==4.0.1;python_version=='3.10' +flake8==4.0.1 isort[colors]==5.10.1 pydocstyle[toml]==6.1.1 pyupgrade==2.34.0 diff --git a/requirements/tests.txt b/requirements/tests.txt index 9ad25b2d6..c00bc6aae 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -1,7 +1,3 @@ -# This file is managed by dependabot and should not be manually edited unless you need -# to add or remove a dependency. It documents the version of our dependencies used in -# CI, these are not hard requirements for using TorchGeo. - # tests mypy==0.961 nbmake==1.3.0 diff --git a/torchgeo/datasets/openbuildings.py b/torchgeo/datasets/openbuildings.py index 7d8cd869a..44342426b 100644 --- a/torchgeo/datasets/openbuildings.py +++ b/torchgeo/datasets/openbuildings.py @@ -16,6 +16,7 @@ import rasterio import shapely import shapely.wkt as wkt import torch +from packaging.version import parse from rasterio.crs import CRS from rtree.index import Index, Property @@ -384,8 +385,16 @@ class OpenBuildings(VectorDataset): """ x = json.dumps(shapely.geometry.mapping(wkt.loads(x))) x = json.loads(x.replace("'", '"')) + import fiona + + if parse(fiona.__version__) >= parse("1.9a1"): + import fiona.model + + geom = fiona.model.Geometry(**x) + else: + geom = x transformed: Dict[str, Any] = fiona.transform.transform_geom( - self._source_crs.to_dict(), self._crs.to_dict(), x + self._source_crs.to_dict(), self._crs.to_dict(), geom ) return transformed