CMSIS-Pack Manager

0.6.0 · active · verified Sat Apr 11

cmsis-pack-manager is a Python module, Rust crate, and command-line utility designed for managing CMSIS-Pack indexes and caches. It enables users to query for embedded device information such as processor types, flash algorithms, and memory layouts within Python programs or via its `pack-manager` CLI. The library leverages a fast Rust backend for performance. The current stable Python version is 0.6.0, with ongoing development and updates released periodically.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the CMSIS-Pack manager and access its cache path. It also shows how to list installed packs, noting that an update is required to fetch packs from online sources. The `update_pdsc_idx()` and `get_device_by_name()` calls are commented out to make the example immediately runnable without network interaction or requiring pre-installed packs, highlighting where user action would be needed.

from cmsis_pack_manager import Cache
from cmsis_pack_manager.cmsis_pack_manager import CmsisPackManager

# Initialize the cache and manager
cache = Cache(False, False) # Args: no_create, no_setup_logging
cmsis_manager = CmsisPackManager(cache)

print(f"CMSIS-Pack cache directory: {cache.data_path()}")

# Update the pack index (requires network access and can take time)
# This line is commented out for quickstart to avoid network call by default
# cmsis_manager.update_pdsc_idx()

# List some installed packs (will be empty if no packs updated/installed)
packs = cmsis_manager.get_installed_packs()
if packs:
    print("Installed Packs:")
    for pack in packs:
        print(f"  - {pack.vendor}::{pack.pack_id}@{pack.version}")
else:
    print("No CMSIS-Packs found in cache. Run `pack-manager update` or `cmsis_manager.update_pdsc_idx()` to fetch them.")

# Example: Find a device (requires packs to be installed)
# device = cmsis_manager.get_device_by_name("ATSAMD21E15A")
# if device:
#    print(f"Found device: {device.name}, Vendor: {device.vendor}")
# else:
#    print("Device not found. Ensure relevant packs are installed.")

view raw JSON →