{"id":3928,"library":"cmsis-pack-manager","title":"CMSIS-Pack Manager","description":"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.","status":"active","version":"0.6.0","language":"en","source_language":"en","source_url":"https://github.com/pyocd/cmsis-pack-manager","tags":["CMSIS","embedded","microcontroller","pack management","ARM","Rust","pyocd"],"install":[{"cmd":"pip install cmsis-pack-manager","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Used for determining appropriate user-specific paths for cache and data directories.","package":"appdirs"},{"reason":"Used for Python to C Foreign Function Interface, enabling communication with the Rust backend.","package":"cffi"},{"reason":"Likely used for parsing or handling YAML-based configuration or pack metadata.","package":"pyyaml"}],"imports":[{"symbol":"Cache","correct":"from cmsis_pack_manager import Cache"},{"note":"The core manager class is nested within cmsis_pack_manager.cmsis_pack_manager.","symbol":"CmsisPackManager","correct":"from cmsis_pack_manager.cmsis_pack_manager import CmsisPackManager"}],"quickstart":{"code":"from cmsis_pack_manager import Cache\nfrom cmsis_pack_manager.cmsis_pack_manager import CmsisPackManager\n\n# Initialize the cache and manager\ncache = Cache(False, False) # Args: no_create, no_setup_logging\ncmsis_manager = CmsisPackManager(cache)\n\nprint(f\"CMSIS-Pack cache directory: {cache.data_path()}\")\n\n# Update the pack index (requires network access and can take time)\n# This line is commented out for quickstart to avoid network call by default\n# cmsis_manager.update_pdsc_idx()\n\n# List some installed packs (will be empty if no packs updated/installed)\npacks = cmsis_manager.get_installed_packs()\nif packs:\n    print(\"Installed Packs:\")\n    for pack in packs:\n        print(f\"  - {pack.vendor}::{pack.pack_id}@{pack.version}\")\nelse:\n    print(\"No CMSIS-Packs found in cache. Run `pack-manager update` or `cmsis_manager.update_pdsc_idx()` to fetch them.\")\n\n# Example: Find a device (requires packs to be installed)\n# device = cmsis_manager.get_device_by_name(\"ATSAMD21E15A\")\n# if device:\n#    print(f\"Found device: {device.name}, Vendor: {device.vendor}\")\n# else:\n#    print(\"Device not found. Ensure relevant packs are installed.\")","lang":"python","description":"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."},"warnings":[{"fix":"Prefer installing pre-built wheels via `pip install cmsis-pack-manager`. If building from source is necessary, check GitHub issues for specific workarounds, which may involve installing a particular `maturin` branch or temporarily removing `cmsis-pack-manager` from `install_requires` in a `setup.py`/`setup.cfg` file for related projects (e.g., `pyocd`). Ensure a stable Rust compiler is installed and up-to-date if building from source.","message":"Building `cmsis-pack-manager` from source on non-x86 architectures (e.g., ARM-based systems like Raspberry Pi) or with newer Python versions (e.g., Python 3.11) can encounter build failures. This is often due to underlying Rust build requirements or specific `maturin`/`cffi` interactions.","severity":"gotcha","affected_versions":"All versions when building from source on non-standard architectures/environments, particularly with Python 3.11+ before specific fixes."},{"fix":"Ensure your project uses Python 3.7 or newer. Python 3.11 is explicitly supported in recent releases.","message":"Python 3.6 support has been removed in recent development versions. While PyPI metadata currently indicates `>=3.6`, newer internal releases and the Rust backend's evolution have dropped support for older Python versions.","severity":"breaking","affected_versions":"Development versions beyond 0.2.x; future stable releases."},{"fix":"This is generally handled by the `pip install` process. If building from source, ensure `maturin` is correctly installed and configured in your build environment.","message":"The `milksnake` runtime dependency was replaced by `maturin` for building the Python bindings to the Rust backend. While this is an internal build change, users compiling from source or relying on specific older build environments might be affected.","severity":"deprecated","affected_versions":"Versions prior to the change (specific Python `cmsis-pack-manager` version is not clearly documented for this change, but occurred around `cmsis-pack` Rust crate 0.2.x development)."},{"fix":"The cache location can be queried using `cmsis_pack_manager.Cache().data_path()`. If a different location is desired, the existing cache might need to be manually moved or cleared, and packs re-downloaded to the new location.","message":"The cache directory where CMSIS-Packs are stored, once set, is generally not easily changeable without manually re-downloading packs. While this warning primarily applies to GUI-based pack managers like the Eclipse plugin, the underlying principle of managing a persistent local pack repository applies. Programmatic changes to the cache location might require manual intervention or re-initialization to reflect.","severity":"gotcha","affected_versions":"All versions."}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}