🐍 Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
Clean up metadata and fix requirements (#2232)
João Gustavo A. Amorimbd0881a30a8e
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex 1cea150d7..43eef7800 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -10,6 +10,7 @@ repos:- id: end-of-file-fixer- id: trailing-whitespace- id: check-yaml+ - id: requirements-txt-fixer- id: pretty-format-jsonexclude: ^$|.devcontainer@@ -17,14 +18,6 @@ repos:rev: "0.9.1"hooks:- id: pyproject-fmt- args:- - --indent- - "4"-- - repo: https://github.com/abravalheri/validate-pyproject- rev: v0.12.1- hooks:- - id: validate-pyproject- repo: https://github.com/psf/blackrev: 23.1.0diff --git a/kornia/__init__.py b/kornia/__init__.pyindex 67c10fa72..dc164505a 100644--- a/kornia/__init__.py+++ b/kornia/__init__.py@@ -13,11 +13,4 @@ from kornia.testing import xla_is_availablefrom kornia.utils import eye_like, vec_like, create_meshgrid, image_to_tensor, tensor_to_image# Version variable-import sys--if sys.version_info >= (3, 8): # pragma: >=3.8 cover- import importlib.metadata as importlib_metadata-else: # pragma: <3.8 cover- import importlib_metadata--__version__ = importlib_metadata.version('kornia')+__version__ = "0.6.11.dev"diff --git a/kornia/utils/_compat.py b/kornia/utils/_compat.pyindex 45a20abaf..fcac28497 100644--- a/kornia/utils/_compat.py+++ b/kornia/utils/_compat.py@@ -1,9 +1,8 @@from typing import TYPE_CHECKING, Callable, ContextManager, List, Optional, Tuple, TypeVarimport torch-from torch import Tensor-from packaging import version+from torch import Tensordef torch_version() -> str:diff --git a/packaging/README.rst b/packaging/README.rstdeleted file mode 100644index df72f09eb..000000000--- a/packaging/README.rst+++ /dev/null@@ -1,22 +0,0 @@-Building Kornia packages for release-====================================--Wheels---------Linux-#####--In order to generate wheels define ```KORNIA_BUILD_VERSION```.--.. code:: bash-- KORNIA_BUILD_VERSION=0.x.x ./build_wheel.sh--This will produce a ```*whl``` file under ```OUT_DIR```, by default to ```/tmp```.-You can upload the wheels using `Twine <https://pypi.org/project/twine/>`_--.. code:: bash-- cd /tmp/remote- python3 -m twine upload *.whldiff --git a/packaging/build_wheel.sh b/packaging/build_wheel.shdeleted file mode 100755index 936bfab94..000000000--- a/packaging/build_wheel.sh+++ /dev/null@@ -1,24 +0,0 @@-#!/bin/bash -ex--## NOTE: define KORNIA_BUILD_VERSION each release-## KORNIA_BUILD_VERSION=0.3.0-## PYTORCH_VERSION=1.5.0--export OUT_DIR="/tmp/remote"--# move to project root and create the wheel-cd /tmp-rm -rf kornia/-git clone https://github.com/kornia/kornia.git--cd /tmp/kornia-git checkout v$KORNIA_BUILD_VERSION-python3 setup.py clean-python3 setup.py bdist_wheel--mkdir -p $OUT_DIR-cp dist/*.whl $OUT_DIR/--## upload-## NOTE: to upload install twine-## Example: python3 -m twine upload dist/*diff --git a/pyproject.toml b/pyproject.tomlindex 2347e225b..ebfdf9b5a 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -1,164 +1,123 @@-[build-system]-build-backend = "setuptools.build_meta"-requires = [- "setuptools>=61.2",-]-[project]name = "kornia"-version = "0.6.11.dev"description = "Open Source Differentiable Computer Vision Library for PyTorch"-[project.readme]-file = "README.md"-content-type = "text/markdown"-keywords = [- "computer vision",- "deep learning",- "pytorch",+ "computer vision",+ "deep learning",+ "pytorch",]license = {text = "Apache-2.0"}authors = [{name = "Edgar Riba", email = "[email protected]"}]requires-python = ">=3.7"classifiers = [- "Development Status :: 4 - Beta",- "Environment :: Console",- "Environment :: GPU",- "Intended Audience :: Developers",- "Intended Audience :: Education",- "Intended Audience :: Information Technology",- "Intended Audience :: Science/Research",- "License :: OSI Approved :: Apache Software License",- "Natural Language :: English",- "Operating System :: OS Independent",- "Programming Language :: Python :: 3",- "Programming Language :: Python :: 3 :: Only",- "Topic :: Scientific/Engineering :: Artificial Intelligence",- "Topic :: Scientific/Engineering :: Image Processing",- "Topic :: Software Development :: Libraries",-]-dependencies = [- "packaging",- "torch>=1.9.1",-]-[project.optional-dependencies]-dev = [- "isort",- "kornia-rs==0.0.8",- "mypy[reports]",- "numpy",- "opencv-python",- "pre-commit>=2",- "pydocstyle",- "pytest==7.2.1",- "pytest-cov==4",- "scipy",+ "Development Status :: 4 - Beta",+ "Environment :: Console",+ "Environment :: GPU",+ "Intended Audience :: Developers",+ "Intended Audience :: Education",+ "Intended Audience :: Information Technology",+ "Intended Audience :: Science/Research",+ "License :: OSI Approved :: Apache Software License",+ "Natural Language :: English",+ "Operating System :: OS Independent",+ "Programming Language :: Python :: 3",+ "Programming Language :: Python :: 3 :: Only",+ "Topic :: Scientific/Engineering :: Artificial Intelligence",+ "Topic :: Scientific/Engineering :: Image Processing",+ "Topic :: Software Development :: Libraries",]-docs = [- "furo",- "matplotlib",- "opencv-python",- "PyYAML<6.1.0,>=5.1",- "sphinx>=4",- "sphinx-autodoc-defaultargs",- "sphinx-autodoc-typehints",- "sphinx-copybutton>=0.3",- "sphinx-design",- "sphinx-rtd-theme>0.5",- "sphinxcontrib-bibtex",- "sphinxcontrib-gtagjs",- "sphinxcontrib-youtube",- "torchvision",-]-x = [- "accelerate==0.16",+dynamic = [+ "dependencies",+ "optional-dependencies",+ "readme",+ "version",][project.urls]-"Bug Tracker" = "https://github.com/kornia/kornia/issues"-Documentation = "https://kornia.readthedocs.io/en/latest"-Download = "https://github.com/kornia/kornia"-Homepage = "https://www.kornia.org"-"Source Code" = "https://github.com/kornia/kornia"+ "Bug Tracker" = "https://github.com/kornia/kornia/issues"+ Documentation = "https://kornia.readthedocs.io/en/latest"+ Download = "https://github.com/kornia/kornia"+ Homepage = "https://www.kornia.org"+ "Source Code" = "https://github.com/kornia/kornia"++[build-system]+build-backend = "setuptools.build_meta"+requires = [+ "setuptools>=61.2",+][tool.setuptools]-zip-safe = true-license-files = ["LICENSE"]-include-package-data = false+ zip-safe = true+ license-files = ["LICENSE"]+ include-package-data = false++[tool.setuptools.dynamic]+ dependencies = {file = ["requirements/requirements.txt"]}+ version = {attr = "kornia.__version__"}+ readme = {file = ["README.md"], content-type = "text/markdown"}++ [tool.setuptools.dynamic.optional-dependencies]+ dev = {file = "requirements/requirements-dev.txt"}+ docs = {file = ["requirements/requirements-docs.txt"]}+ x = {file = ["requirements/requirements-x.txt"]}[tool.setuptools.packages.find]exclude = ["docs*",- "test",- "test.*",+ "test*","examples*",]namespaces = false[tool.setuptools.package-data]-kornia = ["py.typed"]+ kornia = ["py.typed"][tool.black]-line-length = 120-skip-string-normalization = true-skip-magic-trailing-comma = true+ line-length = 120+ skip-string-normalization = true+ skip-magic-trailing-comma = true[tool.isort]-multi_line_output=3-include_trailing_comma = true-line_length = 120-profile = "black"-known_first_party = [- "examples",- "kornia",- "tests",-]-skip_glob = []-skip = [- "kornia/__init__.py"-]+ multi_line_output=3+ include_trailing_comma = true+ line_length = 120+ profile = "black"+ known_first_party = ["examples", "kornia","test"]+ skip_glob = []+ skip = ["kornia/__init__.py"][tool.pytest.ini_options]-norecursedirs = [- ".git",- ".github",- "dist",- "build",-]-addopts = "--color=yes"-markers = [+ addopts = "--color=yes"+ testpaths = ["test"]+ markers =["jit: mark a test as torchscript test","grad: mark a test as gradcheck test",- "nn: mark a test as module test",+ "nn: mark a test as module test"]-testpaths = ["test"][tool.coverage.report]exclude_lines = [- "pragma: no cover",- "def __repr__",- "if self.debug:",- "raise",- "if 0:",- "if __name__ == .__main__.:",+ "pragma: no cover",+ "def __repr__",+ "if self.debug:",+ "raise",+ "if 0:",+ "if __name__ == .__main__.:",][tool.mypy]-files = ["kornia/"]-pretty = true-check_untyped_defs = true-disallow_any_generics = true-disallow_incomplete_defs = true-show_error_codes = true-ignore_missing_imports = true-no_implicit_optional = true-warn_unused_ignores = true-warn_redundant_casts = true+ files = ["kornia/"]+ pretty = true+ check_untyped_defs = true+ disallow_any_generics = true+ disallow_incomplete_defs = true+ show_error_codes = true+ ignore_missing_imports = true+ no_implicit_optional = true+ warn_unused_ignores = true+ warn_redundant_casts = true[tool.distutils.bdist_wheel]-universal = true--[tool.aliases]-test = "pytest"+ universal = true[tool.pydocstyle]match = '.*\.py'diff --git a/requirements/requirements-dev.txt b/requirements/requirements-dev.txtnew file mode 100644index 000000000..04edb8d2b--- /dev/null+++ b/requirements/requirements-dev.txt@@ -0,0 +1,10 @@+isort+kornia-rs==0.0.8+mypy[reports]+numpy+opencv-python+pre-commit>=2+pydocstyle+pytest==7.2.1+pytest-cov==4+scipydiff --git a/requirements/requirements-docs.txt b/requirements/requirements-docs.txtnew file mode 100644index 000000000..651d56e7e--- /dev/null+++ b/requirements/requirements-docs.txt@@ -0,0 +1,13 @@+furo+matplotlib+opencv-python+PyYAML>=5.1+sphinx>=4+sphinx-autodoc-defaultargs+sphinx-autodoc-typehints+sphinx-copybutton>=0.3+sphinx-design+sphinxcontrib-bibtex+sphinxcontrib-gtagjs+sphinxcontrib-youtube+torchvisiondiff --git a/requirements/requirements-x.txt b/requirements/requirements-x.txtnew file mode 100644index 000000000..8526bb438--- /dev/null+++ b/requirements/requirements-x.txt@@ -0,0 +1 @@+accelerate==0.16diff --git a/requirements/requirements.txt b/requirements/requirements.txtnew file mode 100644index 000000000..e14e8c983--- /dev/null+++ b/requirements/requirements.txt@@ -0,0 +1,2 @@+packaging+torch>=1.9.1diff --git a/test/augmentation/test_auto_operation.py b/test/augmentation/test_auto_operation.pyindex dac5ab87b..cfb8b0741 100644--- a/test/augmentation/test_auto_operation.py+++ b/test/augmentation/test_auto_operation.py@@ -1,5 +1,4 @@import inspect-from test.augmentation.test_container import reproducibility_testfrom typing import Listimport pytest@@ -14,6 +13,7 @@ from kornia.augmentation.auto.trivial_augment import TrivialAugmentfrom kornia.augmentation.container import AugmentationSequentialfrom kornia.geometry.bbox import bbox_to_maskfrom kornia.testing import assert_close+from test.augmentation.test_container import reproducibility_testdef _find_all_ops() -> List[OperationBase]:diff --git a/test/color/test_hls.py b/test/color/test_hls.pyindex 86615c1ca..b01bc1c9d 100644--- a/test/color/test_hls.py+++ b/test/color/test_hls.py@@ -3,11 +3,11 @@ import warningsimport pytestimport torch+from packaging import versionfrom torch.autograd import gradcheckimport korniafrom kornia.testing import BaseTester-from packaging import versionclass TestRgbToHls(BaseTester):diff --git a/test/color/test_raw.py b/test/color/test_raw.pyindex 3e84d6bb4..04f1f1545 100644--- a/test/color/test_raw.py+++ b/test/color/test_raw.py@@ -2,12 +2,12 @@ import warningsimport pytestimport torch+from packaging import versionfrom torch.autograd import gradcheckimport korniafrom kornia.testing import BaseTester # test utilsfrom kornia.testing import assert_close-from packaging import versionclass TestRawToRgb(BaseTester):diff --git a/test/enhance/test_histogram.py b/test/enhance/test_histogram.pyindex f34249cd3..431fe21ff 100644--- a/test/enhance/test_histogram.py+++ b/test/enhance/test_histogram.py@@ -1,11 +1,11 @@import pytestimport torch+from packaging import versionfrom torch.autograd import gradcheckimport korniaimport kornia.testing as utils # test utilsfrom kornia.testing import assert_close-from packaging import versionclass TestImageHistogram2d:diff --git a/test/nerf/test_data_utils.py b/test/nerf/test_data_utils.pyindex 4953bfd7a..96e9e9d42 100755--- a/test/nerf/test_data_utils.py+++ b/test/nerf/test_data_utils.py@@ -1,11 +1,10 @@-from test.nerf.test_rays import create_four_cameras-import torchfrom kornia.core import Devicefrom kornia.geometry.camera import PinholeCamerafrom kornia.nerf.data_utils import ImageTensors, RayDataset, instantiate_ray_dataloaderfrom kornia.testing import assert_close+from test.nerf.test_rays import create_four_camerasdef create_random_images_for_cameras(cameras: PinholeCamera) -> ImageTensors:diff --git a/test/nerf/test_nerf_solver.py b/test/nerf/test_nerf_solver.pyindex 8b18c3bb4..2f04dfd2c 100755--- a/test/nerf/test_nerf_solver.py+++ b/test/nerf/test_nerf_solver.py@@ -1,10 +1,9 @@-from test.nerf.test_data_utils import create_random_images_for_cameras, create_red_images_for_cameras-from test.nerf.test_rays import create_four_cameras, create_one_camera-import torchfrom kornia.nerf.nerf_solver import NerfSolverfrom kornia.testing import assert_close+from test.nerf.test_data_utils import create_random_images_for_cameras, create_red_images_for_cameras+from test.nerf.test_rays import create_four_cameras, create_one_cameraclass TestNerfSolver: