Repository: kornia/kornia

Issue:
Drop python 3.7 support 
## 🚀 Feature
Stop supporting py37 (in June)

## Motivation
The end of life for [Python 3.7 will be 2023-06-27](https://devguide.python.org/versions/)

## Pitch
1. Update the `requires-python` on [pyproject.toml](https://github.com/kornia/kornia/tree/master/pyproject.toml) to be ">=3.8"
1. Run pre-commit for all files `pre-commit run --all-files` -- Ruff will run the pyupgrade rules/schematics to upgrade the codebase syntax to 3.8 
1. Update the [CONTRIBUTING.md](https://github.com/kornia/kornia/blob/master/CONTRIBUTING.md)
1.  Update the [.devcontainer](https://github.com/kornia/kornia/tree/master/.devcontainer) and [docker](https://github.com/kornia/kornia/tree/master/docker)
1. Update the [CI's](https://github.com/kornia/kornia/tree/master/.github)
1. Update the [readthedocs.yml](https://github.com/kornia/kornia/blob/master/readthedocs.yml)
1. Fix TODO or FIXME related comments

check the  #1971 as an example
______________________________________________________________________

#### Consider also contributing to Kornia universe projects :)

<sub>

- [**Tutorials**](https://github.com/kornia/tutorials): our repository containing the tutorials.

</sub>



Discussion:

Resolving patch:
diff --git a/kornia/feature/defmo.py b/kornia/feature/defmo.py
--- a/kornia/feature/defmo.py
+++ b/kornia/feature/defmo.py
@@ -246,9 +246,7 @@ def forward(self, latent: Tensor) -> Tensor:
         renders = []
         for ki in range(times.shape[1]):
             t_tensor = (
-                # TODO: replace by after deprecate pytorch 1.6
-                # times[list(range(times.shape[0])), ki]
-                times[[x for x in range(times.shape[0])], ki]  # skipcq: PYL-R1721
+                times[list(range(times.shape[0])), ki]
                 .unsqueeze(-1)
                 .unsqueeze(-1)
                 .unsqueeze(-1)
diff --git a/kornia/feature/mkd.py b/kornia/feature/mkd.py
--- a/kornia/feature/mkd.py
+++ b/kornia/feature/mkd.py
@@ -143,9 +143,10 @@ def forward(self, x: Tensor) -> Tensor:
         if not len(x.shape) == 4 or x.shape[1] != 1:
             raise ValueError(f"Invalid input shape, we expect Bx1xHxW. Got: {x.shape}")
 
-        # TODO: unify the two lines below when pytorch 1.6 support is dropped
-        emb0: Tensor = torch.jit.annotate(Tensor, self.emb0)
-        emb0 = emb0.to(x).repeat(x.size(0), 1, 1, 1)
+        if not isinstance(self.emb0, Tensor):
+            raise TypeError(f"Emb0 type is not a Tensor. Got {type(x)}")
+
+        emb0 = self.emb0.to(x).repeat(x.size(0), 1, 1, 1)
         frange = self.frange.to(x) * x
         emb1 = torch.cos(frange)
         emb2 = torch.sin(frange)


Test patch:
diff --git a/.github/workflows/scheduled_test_cpu_half.yml b/.github/workflows/scheduled_test_cpu_half.yml
--- a/.github/workflows/scheduled_test_cpu_half.yml
+++ b/.github/workflows/scheduled_test_cpu_half.yml
@@ -20,6 +20,6 @@ jobs:
     uses: ./.github/workflows/tests.yml
     with:
       os: ${{ matrix.os }}
-      python-version: '["3.8", , "3.10"]' # "3.7", "3.9"
+      python-version: '["3.8", , "3.10"]' # "3.9"
       pytorch-version:  '["2.0.0"]' # '["1.9.1", "1.10.2", "1.11.0", "1.12.1", "1.13.1"]'
       pytorch-dtype: 'float16'
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -4,7 +4,7 @@ on:
       python-version:
         required: false
         type: string
-        default: '["3.7"]'
+        default: '["3.8"]'
       pytorch-version:
         required: false
         type: string