nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: conda-incubator/grayskull
Pull request #402 (2022-10-11 16:19:31)

Update pre-commit


Patch:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index f5a816d..e1c4210 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,7 +1,7 @@
 exclude: docs
 repos:
 -   repo: https://github.com/psf/black
-    rev: 22.6.0
+    rev: 22.10.0
     hooks:
     -   id: black
         args: [--safe, --quiet]
diff --git a/grayskull/config.py b/grayskull/config.py
index 0c35764..1d80625 100644
--- a/grayskull/config.py
+++ b/grayskull/config.py
@@ -18,6 +18,7 @@ class Configuration:
             PyVer(3, 8),
             PyVer(3, 9),
             PyVer(3, 10),
+            PyVer(3, 11),
         ]
     )
     py_cf_supported: List[PyVer] = field(
@@ -27,6 +28,7 @@ class Configuration:
             PyVer(3, 8),
             PyVer(3, 9),
             PyVer(3, 10),
+            PyVer(3, 11),
         ]
     )
     is_strict_cf: bool = False
diff --git a/grayskull/strategy/py_base.py b/grayskull/strategy/py_base.py
index 33fd6dc..762da74 100644
--- a/grayskull/strategy/py_base.py
+++ b/grayskull/strategy/py_base.py
@@ -143,11 +143,12 @@ def get_name_version_from_requires_dist(string_parse: str) -> Tuple[str, str]:
 
 
 def generic_py_ver_to(
-    metadata: dict, config, is_selector: bool = False
+    metadata: dict, config: Configuration, is_selector: bool = False
 ) -> Optional[str]:  # sourcery no-metrics
     """Generic function which abstract the parse of the requires_python
     present in the PyPi metadata. Basically it can generate the selectors
     for Python or the constrained version if it is a `noarch: python` python package"""
+    # TODO: Refactor the entire function to use LooseVersion instead of custom PyVer
     if not metadata.get("requires_python"):
         return None
     req_python = re.findall(
@@ -158,7 +159,9 @@ def generic_py_ver_to(
         return None
 
     py_ver_enabled = config.get_py_version_available(req_python)
-    small_py3_version = config.get_oldest_py3_version(list(py_ver_enabled.keys()))
+    small_py3_version = config.get_oldest_py3_version(
+        [k for k, v in py_ver_enabled.items() if v]
+    )
     all_py = list(py_ver_enabled.values())
     if all(all_py):
         return None


Test patch:
diff --git a/tests/test_py_base.py b/tests/test_py_base.py
index 57baf36..d8a7e4e 100644
--- a/tests/test_py_base.py
+++ b/tests/test_py_base.py
@@ -1,7 +1,9 @@
 from grayskull.__main__ import create_python_recipe
+from grayskull.config import Configuration
 from grayskull.strategy.py_base import (
     clean_deps_for_conda_forge,
     ensure_pep440,
+    generic_py_ver_to,
     update_requirements_with_pin,
 )
 from grayskull.utils import PyVer
@@ -42,3 +44,11 @@ def test_clean_deps_for_conda_forge_remove_py_selector():
     assert clean_deps_for_conda_forge(
         ["dulwich >=0.19.3  # [py>=35]"], PyVer(3, 6)
     ) == ["dulwich >=0.19.3"]
+
+
+def test_python_requires_upper_bound():
+    py_ver = generic_py_ver_to(
+        {"requires_python": ">=3.7,<=3.10"},
+        Configuration(name="algviz", is_strict_cf=False),
+    )
+    assert py_ver == ">=3.7,<3.11"