When adding a private helper function that performs file I/O (or other expensive operations) and is called multiple times per invocation, it should be decorated with @functools.cache to avoid redundant work.\n\nThe function _get_current_python_version() in src/usethis/_integrations/environ/python.py was added without caching, even though it reads from disk and can be called up to three times per call to get_supported_minor_python_versions().\n\nWhen applying @functools.cache, the function must also be added to the clear_functools_caches autouse fixture in tests/conftest.py so the cache is cleared between tests.
We should explain this in the agent skills
When adding a private helper function that performs file I/O (or other expensive operations) and is called multiple times per invocation, it should be decorated with
@functools.cacheto avoid redundant work.\n\nThe function_get_current_python_version()insrc/usethis/_integrations/environ/python.pywas added without caching, even though it reads from disk and can be called up to three times per call toget_supported_minor_python_versions().\n\nWhen applying@functools.cache, the function must also be added to theclear_functools_cachesautouse fixture intests/conftest.pyso the cache is cleared between tests.We should explain this in the agent skills