[build-system] requires = [ # setuptools 61+ required for pyproject.toml support "setuptools>=61", ] build-backend = "setuptools.build_meta" # https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ [project] name = "torchgeo" description = "TorchGeo: datasets, samplers, transforms, and pre-trained models for geospatial data" readme = "README.md" requires-python = ">=3.10" license = {file = "LICENSE"} authors = [ {name = "Adam J. Stewart", email = "ajstewart426@gmail.com"}, ] maintainers = [ {name = "Adam J. Stewart", email = "ajstewart426@gmail.com"}, {name = "Caleb Robinson", email = "Caleb.Robinson@microsoft.com"}, {name = "Isaac Corley", email = "isaac.corley@my.utsa.edu"}, {name = "Nils Lehmann", email = "n.lehmann@tum.de"}, {name = "Ashwin Nair", email = "ashnair0007@gmail.com"}, ] keywords = ["pytorch", "deep learning", "machine learning", "remote sensing", "satellite imagery", "earth observation", "geospatial"] classifiers = [ "Development Status :: 3 - Alpha", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering :: Artificial Intelligence", "Topic :: Scientific/Engineering :: GIS", ] dependencies = [ # einops 0.3+ required for einops.repeat "einops>=0.3", # fiona 1.8.21+ required for Python 3.10 wheels "fiona>=1.8.21", # kornia 0.7.3+ required for instance segmentation support in AugmentationSequential "kornia>=0.7.3", # lightly 1.4.5+ required for LARS optimizer # lightly 1.4.26 is incompatible with the version of timm required by smp # https://github.com/microsoft/torchgeo/issues/1824 "lightly>=1.4.5,!=1.4.26", # lightning 2+ required for LightningCLI args + sys.argv support # lightning 2.3 contains known bugs related to YAML parsing # https://github.com/Lightning-AI/pytorch-lightning/issues/19977 "lightning[pytorch-extra]>=2,!=2.3.*", # matplotlib 3.5+ required for Python 3.10 wheels "matplotlib>=3.5", # numpy 1.21.2+ required by Python 3.10 wheels "numpy>=1.21.2", # pandas 1.3.3+ required for Python 3.10 wheels "pandas>=1.3.3", # pillow 8.4+ required for Python 3.10 wheels "pillow>=8.4", # pyproj 3.3+ required for Python 3.10 wheels "pyproj>=3.3", # rasterio 1.3+ required for Python 3.10 wheels "rasterio>=1.3", # rtree 1+ required for Python 3.10 wheels "rtree>=1", # segmentation-models-pytorch 0.2+ required for smp.losses module "segmentation-models-pytorch>=0.2", # shapely 1.8+ required for Python 3.10 wheels "shapely>=1.8", # timm 0.4.12 required by segmentation-models-pytorch "timm>=0.4.12", # torch 1.13+ required by torchvision "torch>=1.13", # torchmetrics 0.10+ required for binary/multiclass/multilabel classification metrics "torchmetrics>=0.10", # torchvision 0.14+ required for torchvision.models.swin_v2_b "torchvision>=0.14", ] dynamic = ["version"] [project.optional-dependencies] datasets = [ # h5py 3.6+ required for Python 3.10 wheels "h5py>=3.6", # laspy 2+ required for laspy.read "laspy>=2", # opencv-python 4.5.4+ required for Python 3.10 wheels "opencv-python>=4.5.4", # pycocotools 2.0.7+ required for wheels "pycocotools>=2.0.7", # pyvista 0.34.2+ required to avoid ImportError in CI "pyvista>=0.34.2", # scikit-image 0.19+ required for Python 3.10 wheels "scikit-image>=0.19", # scipy 1.7.2+ required for Python 3.10 wheels "scipy>=1.7.2", ] docs = [ # ipywidgets 7+ required by nbsphinx "ipywidgets>=7", # nbsphinx 0.8.5 fixes bug with nbformat attributes "nbsphinx>=0.8.5", # release versions missing files, must install from master "pytorch-sphinx-theme", # 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", ] style = [ # mypy 0.900+ required for pyproject.toml support "mypy>=0.900", # ruff 0.2+ required for [ruff.lint] "ruff>=0.2", ] tests = [ # nbmake 1.3.3+ required for variable mocking "nbmake>=1.3.3", # pytest 7.3+ required for tmp_path_retention_policy "pytest>=7.3", # pytest-cov 4+ required for pytest 7.2+ compatibility "pytest-cov>=4", ] all = [ "torchgeo[datasets,docs,style,tests]", ] [project.scripts] torchgeo = "torchgeo.main:main" [project.urls] Homepage = "https://github.com/microsoft/torchgeo" Documentation = "https://torchgeo.readthedocs.io" # https://coverage.readthedocs.io/en/latest/config.html [tool.coverage.report] # Ignore warnings for overloads # https://github.com/nedbat/coveragepy/issues/970#issuecomment-612602180 exclude_also = [ "@overload", ] show_missing = true [tool.coverage.run] source_pkgs = ["torchgeo"] # https://mypy.readthedocs.io/en/stable/config_file.html [tool.mypy] # Import discovery ignore_missing_imports = true exclude = "(build|data|dist|docs/.*|images|logo|.*logs|output|requirements)/" # Disallow dynamic typing (TODO: work in progress) disallow_any_unimported = false disallow_any_expr = false disallow_any_decorated = false disallow_any_explicit = false disallow_any_generics = true disallow_subclassing_any = true # Untyped definitions and calls disallow_untyped_calls = true disallow_untyped_defs = true disallow_incomplete_defs = true disallow_untyped_decorators = true # Configuring warnings warn_redundant_casts = true warn_unused_ignores = true warn_no_return = true warn_return_any = true warn_unreachable = true # Miscellaneous strictness flags strict_equality = true strict = true # Configuring error messages pretty = true # Miscellaneous warn_unused_configs = true [tool.pytest.ini_options] # Skip slow tests by default addopts = "-m 'not slow'" # https://docs.pytest.org/en/latest/how-to/capture-warnings.html filterwarnings = [ # Warnings raised by dependencies of dependencies, out of our control # https://github.com/Cadene/pretrained-models.pytorch/issues/221 "ignore:.* is deprecated and will be removed in Pillow 10:DeprecationWarning:pretrainedmodels.datasets.utils", # https://github.com/pytorch/vision/pull/5898 "ignore:.* is deprecated and will be removed in Pillow 10:DeprecationWarning:torchvision.transforms.functional_pil", "ignore:.* is deprecated and will be removed in Pillow 10:DeprecationWarning:torchvision.transforms._functional_pil", # https://github.com/huggingface/pytorch-image-models/pull/1256 "ignore:.* is deprecated and will be removed in Pillow 10:DeprecationWarning:timm.data", # https://github.com/pytorch/pytorch/issues/72906 # https://github.com/pytorch/pytorch/pull/69823 "ignore:distutils Version classes are deprecated. Use packaging.version instead:DeprecationWarning", "ignore:The distutils package is deprecated and slated for removal in Python 3.12:DeprecationWarning:torch.utils.tensorboard", # https://github.com/Lightning-AI/torchmetrics/issues/2121 # https://github.com/Lightning-AI/torchmetrics/pull/2137 "ignore:The distutils package is deprecated and slated for removal in Python 3.12:DeprecationWarning:torchmetrics.utilities.imports", # https://github.com/Lightning-AI/lightning/issues/13256 # https://github.com/Lightning-AI/lightning/pull/13261 "ignore:torch.distributed._sharded_tensor will be deprecated:DeprecationWarning:torch.distributed._sharded_tensor", # https://github.com/Lightning-AI/lightning/issues/13989 "ignore:SelectableGroups dict interface is deprecated. Use select.:DeprecationWarning:lightning.pytorch.trainer.connectors.callback_connector", # https://github.com/Lightning-AI/lightning/issues/14594 "ignore:To copy construct from a tensor, it is recommended to use:UserWarning:lightning.pytorch.core.module", # https://github.com/rasterio/rasterio/issues/1742 # https://github.com/rasterio/rasterio/pull/1753 "ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated:DeprecationWarning:rasterio.crs", # https://github.com/pytorch/pytorch/issues/60053 # https://github.com/pytorch/pytorch/pull/60059 "ignore:Named tensors and all their associated APIs are an experimental feature and subject to change:UserWarning:torch.nn.functional", # https://github.com/tensorflow/tensorboard/issues/5798 "ignore:Call to deprecated create function:DeprecationWarning:tensorboard.compat.proto", # https://github.com/treebeardtech/nbmake/issues/68 'ignore:The \(fspath. py.path.local\) argument to NotebookFile is deprecated:pytest.PytestDeprecationWarning:nbmake.pytest_plugin', # https://github.com/pytorch/pytorch/pull/24929 "ignore:Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0:UserWarning:torch.nn.functional", # https://github.com/scikit-image/scikit-image/issues/6663 # https://github.com/scikit-image/scikit-image/pull/6637 "ignore:`np.bool8` is a deprecated alias for `np.bool_`.:DeprecationWarning:skimage.util.dtype", # https://github.com/lanpa/tensorboardX/pull/677 "ignore:ANTIALIAS is deprecated and will be removed in Pillow 10:DeprecationWarning:tensorboardX.summary", # https://github.com/Lightning-AI/lightning/issues/16756 "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 "ignore:torch.is_autocast_cpu_enabled\\(\\) is deprecated.:DeprecationWarning:kornia.utils.helpers", # https://github.com/pytorch/pytorch/pull/129239 "ignore:You are using `torch.load` with `weights_only=False`:FutureWarning", # Expected warnings # Lightning warns us about using num_workers=0, but it's faster on macOS "ignore:The .*dataloader.* does not have many workers which may be a bottleneck:UserWarning:lightning", "ignore:The .*dataloader.* does not have many workers which may be a bottleneck:lightning.fabric.utilities.warnings.PossibleUserWarning:lightning", # Lightning warns us about using the CPU when GPU/MPS is available "ignore:GPU available but not used.:UserWarning", "ignore:MPS available but not used.:UserWarning", # Lightning warns us if TensorBoard is not installed "ignore:Starting from v1.9.0, `tensorboardX` has been removed as a dependency of the `lightning.pytorch` package:UserWarning", # https://github.com/Lightning-AI/lightning/issues/18545 "ignore:LightningCLI's args parameter is intended to run from within Python like if it were from the command line.:UserWarning", # https://github.com/kornia/kornia/pull/1663 "ignore:`RandomGaussianBlur` has changed its behavior and now randomly sample sigma for both axes.:DeprecationWarning", # https://github.com/pytorch/pytorch/pull/111576 "ignore:Skipping device Apple Paravirtual device that does not support Metal 2.0:UserWarning", # Unexpected warnings, worth investigating # https://github.com/pytest-dev/pytest/issues/11461 "ignore::pytest.PytestUnraisableExceptionWarning", ] markers = [ "slow: marks tests as slow", ] norecursedirs = [ ".ipynb_checkpoints", "data", "__pycache__", ] testpaths = [ "tests", "docs/tutorials", ] tmp_path_retention_policy = "failed" # https://docs.astral.sh/ruff/settings/ [tool.ruff] extend-include = ["*.ipynb"] fix = true [tool.ruff.format] quote-style = "single" skip-magic-trailing-comma = true [tool.ruff.lint] extend-select = ["ANN", "D", "I", "RUF", "UP"] ignore = ["ANN101", "ANN102", "ANN401"] [tool.ruff.lint.per-file-ignores] "docs/**" = ["ANN", "D"] "experiments/**" = ["D"] "tests/**" = ["D"] [tool.ruff.lint.isort] split-on-trailing-comma = false [tool.ruff.lint.pydocstyle] convention = "google" # https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html [tool.setuptools.dynamic] version = {attr = "torchgeo.__version__"} [tool.setuptools.package-data] torchgeo = ["py.typed"] [tool.setuptools.packages.find] include = ["torchgeo*"]