_dl Module (Internal Colab Utility)¶
This internal module provides a utility function specifically for use within Google Colab environments to facilitate downloading project files.
Functions¶
create_downloadable_zip¶
def create_downloadable_zip(
excluded_files: list,
zip_name: str = 'Model_files.zip'
) -> None:
Creates a zip archive of the /content directory (the default root directory in Google Colab), excluding specified files or patterns, and then initiates a file download prompt in the Colab interface.
Parameters:
excluded_files(list): A list of strings representing filenames or patterns to exclude from the zip archive (e.g.,"drive","sample_data"). The patterns are used with thezip -xcommand.zip_name(str, optional): The desired name for the output zip file. Defaults to'Model_files.zip'.
Returns:
None: The function executes system commands and triggers a download viagoogle.colab.files.download.
Notes:
This function relies on the
zipcommand-line utility being available in the environment.It specifically imports and uses
google.colab.files, meaning it will only function correctly within a Google Colab notebook session.The script part of
_dl.pycalls this function with a predefined list of exclusions ("drive","sample_data").