Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can/should pip download directly to target directory #8755

Closed
McSinyx opened this issue Aug 13, 2020 · 2 comments
Closed

Can/should pip download directly to target directory #8755

McSinyx opened this issue Aug 13, 2020 · 2 comments

Comments

@McSinyx
Copy link
Contributor

McSinyx commented Aug 13, 2020

Environment

  • pip version: ea10d0e
  • Python version: 3.8.5, but I think it is irrelevant
  • OS: Debian, but I think it is irrelevant

Description

Currently pip download (and pip wheel also I believe) download distributions to a temporary directory. I think this is to unpack sdists (and historically wheels as well), and probably it also has something to do with caching (I'm not really familiar with the caching mechanism and would love to know the answer).

# let's download to a tmp dir
from_path, content_type = _download_http_url(
link, downloader, temp_dir.path, hashes

Later these will be copied to the download_dir:

if download_dir:
if link.is_existing_dir():
logger.info('Link is a directory, ignoring download_dir')
elif local_file:
download_location = os.path.join(
download_dir, link.filename
)
if not os.path.exists(download_location):
shutil.copy(local_file.path, download_location)
download_path = display_path(download_location)
logger.info('Saved %s', download_path)
if self._download_should_save:
# Make a .zip of the source_dir we already created.
if link.is_vcs:
req.archive(self.download_dir)

I'm wondering is there any reason not to download, at least wheels, directly to the user-specified directory and avoid copying.

This was initially raised as a TODO in #8737 (comment) but was suggested by @chrahunt to be filed in a separate issue instead.

@triage-new-issues triage-new-issues bot added the S: needs triage Issues/PRs that need to be triaged label Aug 13, 2020
@uranusjr
Copy link
Member

IIRC download_dir is explicitly set to a non-temporary location in pip download and pip wheel contexts.

@McSinyx
Copy link
Contributor Author

McSinyx commented Sep 4, 2020

I'm closing this since as shown in GH-8827, we wouldn't want to download directly to target directory.

@McSinyx McSinyx closed this as completed Sep 4, 2020
@pradyunsg pradyunsg removed the S: needs triage Issues/PRs that need to be triaged label Feb 12, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants