File tree Expand file tree Collapse file tree
src/usethis/_integrations/environ Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33from __future__ import annotations
44
5+ import functools
6+
57from typing_extensions import assert_never
68
79from usethis ._backend .dispatch import get_backend
@@ -68,6 +70,7 @@ def get_supported_minor_python_versions() -> list[PythonVersion]:
6870 return versions
6971
7072
73+ @functools .cache
7174def _get_current_python_version () -> PythonVersion :
7275 """Get the inferred Python version for the current project.
7376
Original file line number Diff line number Diff line change 1010from usethis ._config import usethis_config
1111from usethis ._console import _cached_warn_print , get_icon_mode
1212from usethis ._file .pyproject_toml .io_ import PyprojectTOMLManager
13+ from usethis ._integrations .environ .python import _get_current_python_version
1314from usethis ._subprocess import call_subprocess
1415from usethis ._test import change_cwd , is_offline
1516from usethis ._tool .impl .spec .import_linter import _importlinter_warn_no_packages_found
@@ -27,6 +28,7 @@ def clear_functools_caches():
2728 _cached_warn_print .cache_clear ()
2829 get_icon_mode .cache_clear ()
2930 _importlinter_warn_no_packages_found .cache_clear ()
31+ _get_current_python_version .cache_clear ()
3032
3133
3234@pytest .fixture (scope = "session" )
You can’t perform that action at this time.
0 commit comments