newton.utils.download_asset#

newton.utils.download_asset(asset_folder, cache_dir=None, force_refresh=False, ref=None)[source]#

Download a specific folder from the newton-assets GitHub repository into a local cache.

Parameters:
  • asset_folder (str) – The folder within the repository to download (e.g., “assets/models”)

  • cache_dir (str | None) – Directory to cache downloads. If None, the path is determined in the following order: 1. NEWTON_CACHE_PATH environment variable. 2. System’s user cache directory (via appdirs.user_cache_dir).

  • force_refresh (bool) – If True, bypass TTL and verify the cached version against the remote. Re-downloads only if the remote SHA differs.

  • ref (str | None) – Git branch, tag, or commit SHA to checkout. Defaults to the revision pinned in NEWTON_ASSETS_REF.

Returns:

Path to the downloaded folder in the local cache.

Return type:

Path