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 | PathLike[str] | None) – Directory to cache downloads. If None, use newton.config.cache_dir_assets, which defaults to NEWTON_CACHE_PATH or the platform’s Newton cache directory. Set that global setting to None to download each request into a fresh temporary directory kept until process exit. An explicit directory overrides the global setting.

  • 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, available until process exit when caching is disabled.

Return type:

Path