Store Python 3.7 deps in separate files, use rasterio/fiona Windows wheels (#647)

* Store Python 3.7 deps in separate files, use rasterio/fiona Windows wheels

* Fix fiona 1.9 warning

* Fix import error

* Try again

* Expand obj kwargs

* Fiona still support Python 3.7

* Investigate segfaults

* Undo last commit
This commit is contained in:
Adam J. Stewart 2022-07-03 23:21:42 -07:00 коммит произвёл GitHub
Родитель 1495e8a54d
Коммит 79144be42f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
11 изменённых файлов: 75 добавлений и 39 удалений

16
.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

9
requirements/README.md Normal file
Просмотреть файл

@ -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.

14
requirements/datasets.old Normal file
Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

28
requirements/required.old Normal file
Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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