Skip to content

mecfs_bio.build_system.wf.wf_downloader

URL download capability

Classes:

  • RobustWFDownloader

    Downloads via aria2 with retries, suitable for large files.

  • SimpleWFDownloader

    Downloads via py3_wget, then verifies the hash separately.

  • WFDownloader

    Downloads the file at a URL to a local path, verifying its md5 hash.

RobustWFDownloader

Bases: WFDownloader

Downloads via aria2 with retries, suitable for large files.

Methods:

download

download(
    url: str, local_path: Path, md5_hash: str | None
) -> None
Source code in mecfs_bio/build_system/wf/wf_downloader.py
def download(self, url: str, local_path: Path, md5_hash: str | None) -> None:
    robust_download_with_aria(
        md5sum=md5_hash,
        url=url,
        dest=local_path,
    )

SimpleWFDownloader

Bases: WFDownloader

Downloads via py3_wget, then verifies the hash separately.

Methods:

download

download(
    url: str, local_path: Path, md5_hash: str | None
) -> None
Source code in mecfs_bio/build_system/wf/wf_downloader.py
def download(self, url: str, local_path: Path, md5_hash: str | None) -> None:
    # py3_wget attempts to read the whole file to check md5.  doesn't work for large files.  So implement my own check
    py3_wget.download_file(
        url=url,
        output_path=local_path,
    )
    verify_hash(
        downloaded_file=local_path,
        expected_hash=md5_hash,
    )

WFDownloader

Bases: ABC

Downloads the file at a URL to a local path, verifying its md5 hash.

Methods:

  • download

    Download the file at url into local_path and verify its md5 hash.

download abstractmethod

download(
    url: str, local_path: Path, md5_hash: str | None
) -> None

Download the file at url into local_path and verify its md5 hash.

Source code in mecfs_bio/build_system/wf/wf_downloader.py
@abstractmethod
def download(self, url: str, local_path: Path, md5_hash: str | None) -> None:
    """Download the file at url into local_path and verify its md5 hash."""