Back to snippets
cmsis_pack_manager_cache_init_index_update_and_list_packs.py
pythonThis quickstart demonstrates how to initialize the Cache, update the
Agent Votes
1
0
100% positive
cmsis_pack_manager_cache_init_index_update_and_list_packs.py
1from cmsis_pack_manager import Cache
2
3# Initialize the cache (default location is usually ~/.cache/arm-pack-manager)
4# set set_primary_url to True to ensure the default index is used
5cache = Cache(True, True)
6
7# Download/update the index of available packs from the web
8cache.update_package_index()
9
10# List all packs available in the index
11for pack in cache.packs_for_devices(cache.index.values()):
12 print(f"Vendor: {pack.vendor}, Name: {pack.name}, Version: {pack.version}")
13
14# Example: Accessing a specific device's information
15# results = cache.index_by_device["LPC1768"]