pypiuploader.download Module

Downloading packages to a directory.

class PackageDownloader(download_path=None)[source]

Bases: object

Downloads source distributions from PyPI to a directory.

Runs pip install command, e.g.:

>>> downloader = PackageDownloader('~/.packages')
>>> downloader.download(['mock', 'requests==1.2.1'])

Would run:

$ pip install -d ~/.packages mock requests==1.2.1

And this:

>>> downloader = PackageDownloader('~/.packages')
>>> downloader.download(requirements_file='requirements.txt')

Would run:

$ pip install -d ~/.packages -r requirements.txt
Parameters:download_path

Optional path to directory where the packages should be downloaded, will be set as download_path.

If doesn’t exist, will be created on download(). If not given, will create a temporary directory and update download_path on download().

download_path = None

Path to directory where the packages should be downloaded.

download(requirements=None, requirements_file=None, no_use_wheel=False)[source]

Download the packages using pip install command.

Either requirements or requirements_file must be given, otherwise raise ValueError.

Return a generator yielding full paths to the downloaded packages.

Parameters:
  • requirements – Optional list of packages names to download.
  • requirements_file – Optional path to a requirements file.
  • no_use_wheel – Do not find and prefer wheel archives, default to False. Corresponds to --no-use-wheel option from pip install.

Related Topics

This Page