-
Notifications
You must be signed in to change notification settings - Fork 13
Description
What is the idea?
Add caching logic to avoid re-downloading wheels that are already present in the target directory.
Why is this needed?
Currently, the find_and_fetch function in downloader.py unconditionally downloads wheels from PyPI every time it's called, even if the wheel file already exists in the target directory. This wastes bandwidth and time, especially when repeatedly working with the same packages.
What should happen?
The find_and_fetch function should check if the target wheel file already exists before attempting to download it. If the file exists, it should skip the download and return the existing path.
The implementation would add a simple check:
target_path = target / filename
if not target_path.exists():
download(link.url, target_path)
return target_path
Additional Context
The relevant code is in conda_pypi/downloader.py lines 72-74. While conda's download function may have its own caching mechanisms, adding an explicit check at the conda-pypi level would provide more predictable behavior and avoid unnecessary network calls.