🐍 Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
Update setup to declarative metadata (#1885)
João Gustavo A. Amorime0eeac46ad88
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfileindex a4f634adf..33c4081ce 100644--- a/.devcontainer/Dockerfile+++ b/.devcontainer/Dockerfile@@ -12,11 +12,6 @@ RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/l# https://exerror.com/importerror-libgl-so-1-cannot-open-shared-object-file-no-such-file-or-directory/RUN apt-get update && apt install -y libgl1-mesa-glx-# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.-COPY requirements/ /tmp/pip-tmp/requirements/-COPY docs/requirements.txt /tmp/pip-tmp/docs/-RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements/dev.txt && rm -rf /tmp/pip-tmp-# [Optional] Uncomment this section to install additional OS packages.# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \# && apt-get -y install --no-install-recommends <your-package-list-here>diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.ymlindex aa5ecc9ef..f25bb36a8 100644--- a/.github/workflows/docs.yml+++ b/.github/workflows/docs.yml@@ -22,8 +22,7 @@ jobs:- name: Install dependenciesshell: bash -l {0}run: |- pip install -r docs/requirements.txt- pip install .+ pip install .[docs]- name: Build Documentationshell: bash -l {0}run: make build-docsdiff --git a/.github/workflows/format.yml b/.github/workflows/format.ymlindex 0e5a063de..a82498b0a 100644--- a/.github/workflows/format.yml+++ b/.github/workflows/format.yml@@ -16,7 +16,7 @@ jobs:- name: Install dependenciesrun: |pip install torch --find-links https://download.pytorch.org/whl/cpu/torch_stable.html- pip install -r requirements/dev.txt+ pip install .[dev]python setup.py develop --user- name: Run linter@@ -29,7 +29,7 @@ jobs:- name: Install dependenciesrun: |pip install torch --find-links https://download.pytorch.org/whl/cpu/torch_stable.html- pip install -r requirements/dev.txt+ pip install .[dev]python setup.py develop --user- name: Run doctestdiff --git a/.github/workflows/test_typing.yml b/.github/workflows/test_typing.ymlindex 28bcb1d7c..1ac2eab09 100644--- a/.github/workflows/test_typing.yml+++ b/.github/workflows/test_typing.yml@@ -33,7 +33,7 @@ jobs:run: |conda install curl -c conda-forgeconda install pytorch cpuonly -c pytorch-lts- pip install .[all]+ pip install .[dev,x]- name: Run Testsshell: bash -l {0}run: pytest -v --cov=kornia --cov-report xml --mypy kornia/ -m mypydiff --git a/.github/workflows/tests_cpu.yml b/.github/workflows/tests_cpu.ymlindex 4710a8354..882ab336e 100644--- a/.github/workflows/tests_cpu.yml+++ b/.github/workflows/tests_cpu.yml@@ -34,7 +34,7 @@ jobs:run: |conda install curl -c conda-forgeconda install pytorch=${{ matrix.pytorch-version }} cpuonly -c pytorch- pip install .[all]+ pip install .[dev,x]- name: Run Testsshell: bash -l {0}run: pytest -v --device cpu --dtype float32,float64 --cov=kornia --cov-report xml ./test --mypydiff --git a/.github/workflows/tests_cuda.yml b/.github/workflows/tests_cuda.ymlindex 6acf016fc..96095dc57 100644--- a/.github/workflows/tests_cuda.yml+++ b/.github/workflows/tests_cuda.yml@@ -23,7 +23,7 @@ jobs:run: |# NOTE: pytorch image does not include gitconda install -c anaconda git- pip install .[all]+ pip install .[dev,x]- name: Run Testsshell: bash -l {0}run: pytest -v --device cuda --dtype float32,float64 ./testdiff --git a/.github/workflows/tests_lts.yml b/.github/workflows/tests_lts.ymlindex c25af4da6..3627aafe4 100644--- a/.github/workflows/tests_lts.yml+++ b/.github/workflows/tests_lts.yml@@ -33,7 +33,7 @@ jobs:run: |conda install curl -c conda-forgeconda install pytorch cpuonly -c pytorch-lts- pip install .[all]+ pip install .[dev,x]- name: Run Testsshell: bash -l {0}run: pytest -v --device cpu --dtype float32,float64 --cov=kornia --cov-report xml ./test --mypydiff --git a/.github/workflows/tests_nightly.yml b/.github/workflows/tests_nightly.ymlindex b25a75b1a..2c2394840 100644--- a/.github/workflows/tests_nightly.yml+++ b/.github/workflows/tests_nightly.yml@@ -28,7 +28,7 @@ jobs:run: |conda install curl -c conda-forgeconda install pytorch cpuonly -c pytorch-nightly- pip install .[all]+ pip install .[dev,x]- name: Run Testsshell: bash -l {0}run: pytest -v --device cpu --dtype float32,float64 ./test --flake8 --mypydiff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex 21733dc22..0aebbaeae 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -16,6 +16,12 @@ repos:- id: pretty-format-jsonexclude: ^$|.devcontainer+ - repo: https://github.com/asottile/setup-cfg-fmt+ rev: v2.0.0+ hooks:+ - id: setup-cfg-fmt++- repo: https://github.com/psf/blackrev: 22.8.0hooks:diff --git a/docs/requirements.txt b/docs/requirements.txtdeleted file mode 100644index e83797ac3..000000000--- a/docs/requirements.txt+++ /dev/null@@ -1,17 +0,0 @@-# docs requirements-torch-torchvision-opencv-python-matplotlib-# sphinx-sphinx>=4.0-sphinx_rtd_theme>0.5-sphinxcontrib-bibtex-sphinxcontrib-youtube-sphinx-autodoc-typehints>=1.0-sphinx-copybutton>=0.3-sphinx-autodoc-defaultargs-sphinxcontrib-gtagjs-PyYAML>=5.1,<6.1.0-furo-sphinx-designdiff --git a/kornia/__init__.py b/kornia/__init__.pyindex d21a2087b..67c10fa72 100644--- a/kornia/__init__.py+++ b/kornia/__init__.py@@ -1,6 +1,3 @@-# import the version variable-from ._version import __version__-# NOTE: kornia filters and geometry must go first since are the core of the library# and by changing the import order you might get into a circular dependencies issue.from . import filters@@ -14,3 +11,13 @@ from . import augmentation, color, contrib, core, enhance, feature, io, losses,from kornia.constants import pifrom 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')diff --git a/kornia/_version.py b/kornia/_version.pydeleted file mode 100644index 234feafcd..000000000--- a/kornia/_version.py+++ /dev/null@@ -1 +0,0 @@-__version__ = "0.6.8-dev"diff --git a/pytest.ini b/pytest.inideleted file mode 100644index 57ad24500..000000000--- a/pytest.ini+++ /dev/null@@ -1,5 +0,0 @@-[pytest]-markers =- jit: mark a test as torchscript test- grad: mark a test as gradcheck test- nn: mark a test as module testdiff --git a/readthedocs.yml b/readthedocs.ymlindex 5b4e0add0..6b3a28f82 100644--- a/readthedocs.yml+++ b/readthedocs.yml@@ -3,6 +3,6 @@ version: 2python:version: 3.7install:- - requirements: docs/requirements.txt- - method: pippath: .+ extra_requirements:+ - docsdiff --git a/requirements/dev.txt b/requirements/dev.txtdeleted file mode 100644index 59f227323..000000000--- a/requirements/dev.txt+++ /dev/null@@ -1,13 +0,0 @@-pytest==7.1.3-flake8==5.0.4-pytest-cov==3.0.0-pytest-mypy==0.9.1-pydocstyle-pre-commit>=2.0-isort-numpy-scipy-opencv-python-kornia_rs==0.0.5; python_version>="3.7"--r ../docs/requirements.txt--r ./x.txt # kornia[x]diff --git a/requirements/x.txt b/requirements/x.txtdeleted file mode 100644index e0262de11..000000000--- a/requirements/x.txt+++ /dev/null@@ -1,2 +0,0 @@-accelerate==0.12.0-dataclasses; python_version<"3.7"diff --git a/setup.cfg b/setup.cfgindex 8eee8b016..30404829b 100644--- a/setup.cfg+++ b/setup.cfg@@ -1,5 +1,95 @@+[metadata]+name = kornia+version = 0.6.8-dev+description = Open Source Differentiable Computer Vision Library for PyTorch+long_description = file: README.md+long_description_content_type = text/markdown+url = https://www.kornia.org+author = Edgar Riba+author_email = [email protected]+license = Apache-2.0+license_file = LICENSE+license_files = LICENSE+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+download_url = https://github.com/kornia/kornia+keywords = computer vision, deep learning, pytorch+project_urls =+ Bug Tracker = https://github.com/kornia/kornia/issues+ Documentation = https://kornia.readthedocs.io/en/latest+ Source Code = https://github.com/kornia/kornia++[options]+packages = find:+install_requires =+ packaging+ torch>=1.8.1+python_requires = >=3.6+setup_requires =+ pytest-runner+tests_require =+ pytest+zip_safe = True++[options.packages.find]+exclude =+ docs*+ test+ test.*+ examples*++[options.extras_require]+dev =+ flake8==5.0.4+ isort+ numpy+ opencv-python+ pre-commit>=2.0+ pydocstyle+ pytest==7.1.3+ pytest-cov==3.0.0+ pytest-mypy==0.9.1+ scipy+ kornia-rs==0.0.5;python_version>="3.7"+docs =+ PyYAML>=5.1,<6.1.0+ furo+ matplotlib+ opencv-python+ sphinx>=4.0+ sphinx-autodoc-defaultargs+ sphinx-autodoc-typehints>=1.0+ sphinx-copybutton>=0.3+ sphinx-design+ sphinx-rtd-theme>0.5+ sphinxcontrib-bibtex+ sphinxcontrib-gtagjs+ sphinxcontrib-youtube+ torch+ torchvision+x =+ accelerate==0.12.0+ dataclasses;python_version<"3.7"++[bdist_wheel]+universal = True+[aliases]-test=pytest+test = pytest[tool:pytest]norecursedirs =@@ -10,12 +100,10 @@ norecursedirs =addopts =--strict--color=yes--[bdist_wheel]-universal=1--[metadata]-license_file = LICENSE+markers =+ jit: mark a test as torchscript test+ grad: mark a test as gradcheck test+ nn: mark a test as module test[flake8]max-line-length = 120@@ -38,7 +126,14 @@ ignore_missing_imports = True[pydocstyle]match = .*\.py-ignore = D105,D107,D203,D204,D213,D406,D407+ignore =+ D105+ D107+ D203+ D204+ D213+ D406+ D407[coverage:report]exclude_lines =@@ -48,15 +143,3 @@ exclude_lines =raiseif 0:if __name__ == .__main__.:--[isort]-line_length = 120-known_first_party =- examples- kornia- tests-order_by_type = False-# 3 - Vertical Hanging Indent-multi_line_output = 3-include_trailing_comma = True-skip=kornia/__init__.pydiff --git a/setup.py b/setup.pyindex 9776a261f..f8aba1c98 100644--- a/setup.py+++ b/setup.py@@ -1,6 +1,4 @@# Welcome to the Kornia setup.py.-#-import reimport sys# Make sure that kornia is running on Python 3.6.0 or later@@ -10,87 +8,6 @@ if sys.version_info < (3, 6, 0):raise RuntimeError("Kornia requires Python 3.6.0 or later.")-from setuptools import find_packages, setup+from setuptools import setup--def find_version(file_path: str) -> str:- version_file = open(file_path).read()- version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)- if not version_match:- raise RuntimeError(f"Unable to find version string in {file_path}")- return version_match.group(1)---VERSION = find_version("kornia/_version.py")---# NOTE: kornia MUST only require PyTorch-requirements = ['torch>=1.8.1', 'packaging']--# open readme file and set long description-with open("README.md", encoding="utf-8") as fh:- long_description = fh.read()---def load_requirements(filename: str):- with open(filename) as f:- return [x.strip() for x in f.readlines() if "-r" != x[0:2]]---requirements_extras = {"x": load_requirements("requirements/x.txt"), "dev": load_requirements("requirements/dev.txt")}-requirements_extras["all"] = requirements_extras["x"] + requirements_extras["dev"]---if __name__ == '__main__':- setup(- name='kornia',- version=VERSION,- author='Edgar Riba',- author_email='[email protected]',- url='https://www.kornia.org',- download_url='https://github.com/kornia/kornia',- license='Apache License 2.0',- description='Open Source Differentiable Computer Vision Library for PyTorch',- long_description=long_description,- long_description_content_type='text/markdown',- python_requires='>=3.6',- setup_requires=['pytest-runner'],- tests_require=['pytest'],- packages=find_packages(exclude=('docs', 'test', 'examples')),- package_data={"kornia": ["py.typed"]},- data_files=[('', ['requirements/x.txt', 'requirements/dev.txt'])],- zip_safe=True,- install_requires=requirements,- extras_require=requirements_extras,- keywords=['computer vision', 'deep learning', 'pytorch'],- project_urls={- "Bug Tracker": "https://github.com/kornia/kornia/issues",- "Documentation": "https://kornia.readthedocs.io/en/latest",- "Source Code": "https://github.com/kornia/kornia",- },- classifiers=[- 'Environment :: GPU',- 'Environment :: Console',- 'Natural Language :: English',- # How mature is this project? Common values are- # 3 - Alpha, 4 - Beta, 5 - Production/Stable- 'Development Status :: 4 - Beta',- # Indicate who your project is intended for- 'Intended Audience :: Developers',- 'Intended Audience :: Education',- 'Intended Audience :: Science/Research',- 'Intended Audience :: Information Technology',- 'Topic :: Software Development :: Libraries',- 'Topic :: Scientific/Engineering :: Artificial Intelligence',- 'Topic :: Scientific/Engineering :: Image Processing',- # Pick your license as you wish- 'License :: OSI Approved :: Apache Software License',- 'Operating System :: OS Independent',- # Specify the Python versions you support here. In particular, ensure- # that you indicate whether you support Python 2, Python 3 or both.- 'Programming Language :: Python :: 3',- 'Programming Language :: Python :: 3.6',- 'Programming Language :: Python :: 3.7',- 'Programming Language :: Python :: 3.8',- ],- )+setup()diff --git a/setup_dev_env.sh b/setup_dev_env.shindex 29fddcd7d..324c11f50 100755--- a/setup_dev_env.sh+++ b/setup_dev_env.sh@@ -67,9 +67,9 @@ source $conda_bin_dir/activate $dev_env_dir/envs/venvconda install pytorch=$pytorch_version torchvision $cuda_toolkit $pytorch_mode -c $pytorch_channel# install testing dependencies-pip install -r requirements/dev.txt+pip install -e .[dev,x]-# install documentation dependencies-pip install -r docs/requirements.txt+# install docs dependencies+pip install -e .[docs]conda deactivate # close the `venv` environment