MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / get_bundle_info

Function get_bundle_info

monai/bundle/scripts.py:883–921  ·  view source on GitHub ↗

Get all information (include "name" and "browser_download_url") of a bundle with the specified bundle name and version which is stored in the release of specified repository with the provided tag. In order to increase the rate limits of calling Github APIs, you can input your personal a

(
    bundle_name: str,
    version: str | None = None,
    repo: str = "Project-MONAI/model-zoo",
    tag: str = "dev",
    auth_token: str | None = None,
)

Source from the content-addressed store, hash-verified

881
882
883def get_bundle_info(
884 bundle_name: str,
885 version: str | None = None,
886 repo: str = "Project-MONAI/model-zoo",
887 tag: str = "dev",
888 auth_token: str | None = None,
889) -> dict[str, Any]:
890 """
891 Get all information (include "name" and "browser_download_url") of a bundle
892 with the specified bundle name and version which is stored in the release of specified repository with the provided tag.
893 In order to increase the rate limits of calling Github APIs, you can input your personal access token.
894 Please check the following link for more details about rate limiting:
895 https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting
896
897 The following link shows how to create your personal access token:
898 https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
899
900 Args:
901 bundle_name: bundle name.
902 version: version name of the target bundle, if None, the latest version will be used.
903 repo: it should be in the form of "repo_owner/repo_name/".
904 tag: the tag name of the release.
905 auth_token: github personal access token.
906
907 Returns:
908 a dictionary that contains the bundle's information.
909
910 """
911
912 bundles_info = _get_all_bundles_info(repo=repo, tag=tag, auth_token=auth_token)
913 if bundle_name not in bundles_info:
914 raise ValueError(f"bundle: {bundle_name} is not existing.")
915 bundle_info = bundles_info[bundle_name]
916 if version is None:
917 version = sorted(bundle_info.keys())[-1]
918 if version not in bundle_info:
919 raise ValueError(f"version: {version} of bundle: {bundle_name} is not existing.")
920
921 return bundle_info[version]
922
923
924def run(

Callers 4

test_get_bundle_infoMethod · 0.90
test_fake_tokenMethod · 0.90

Calls 1

_get_all_bundles_infoFunction · 0.85

Tested by 3

test_get_bundle_infoMethod · 0.72
test_fake_tokenMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…