{"id":9604,"library":"colcon-package-information","title":"colcon-package-information","description":"colcon-package-information is an extension for the `colcon` build tool, providing the `info` verb. It allows users to inspect and display various details about packages within a `colcon` workspace, such as their source, version, and dependencies. The current version is 0.4.1, and it follows the stable release cadence of the `colcon` ecosystem, with updates typically coinciding with major `colcon-core` releases or bug fixes.","status":"active","version":"0.4.1","language":"en","source_language":"en","source_url":"https://github.com/colcon/colcon-package-information/","tags":["colcon","ROS","build system","package management","cli tool","extension","robotics"],"install":[{"cmd":"pip install colcon-package-information","lang":"bash","label":"Install colcon-package-information"}],"dependencies":[{"reason":"Required for `colcon-package-information` to register and provide its 'info' verb within the `colcon` CLI framework.","package":"colcon-core","optional":false}],"imports":[{"note":"This library is primarily a `colcon` command-line extension; direct programmatic import of its internal components like `InfoVerb` is typically not done by end-users. Its functionality is accessed via the `colcon info` command.","symbol":"InfoVerb","correct":"from colcon_package_information.verb.info import InfoVerb"}],"quickstart":{"code":"import os\nimport shutil\n\n# Ensure colcon-core and colcon-package-information are installed\nos.system(\"pip install colcon-core colcon-package-information\")\n\nworkspace_path = \"my_colcon_workspace\"\npackage_path = os.path.join(workspace_path, \"src\", \"my_package\")\n\n# Create a dummy colcon workspace and a simple package\nos.makedirs(package_path, exist_ok=True)\n\npackage_xml_content = \"\"\"\n<package format='3'>\n  <name>my_package</name>\n  <version>0.1.0</version>\n  <description>A dummy package for colcon info demonstration.</description>\n  <maintainer email='dev@example.com'>Developer</maintainer>\n  <license>Apache-2.0</license>\n</package>\n\"\"\"\n\nwith open(os.path.join(package_path, \"package.xml\"), \"w\") as f:\n    f.write(package_xml_content)\n\nprint(f\"\\nCreated dummy workspace at: {workspace_path}\")\nprint(f\"Created dummy package 'my_package' at: {package_path}\")\n\n# Navigate into the workspace for colcon to find it\noriginal_cwd = os.getcwd()\nos.chdir(workspace_path)\n\n# Run the colcon info command\nprint(\"\\n--- Running colcon info for 'my_package' ---\")\nos.system(\"colcon info --packages-select my_package\")\n\nprint(\"\\n--- Running colcon info for all packages (if more existed) ---\")\nos.system(\"colcon info\")\n\n# Clean up\nos.chdir(original_cwd)\nshutil.rmtree(workspace_path)\nprint(f\"\\nCleaned up dummy workspace: {workspace_path}\")","lang":"python","description":"This quickstart demonstrates how to install and use `colcon-package-information` via the `colcon` command-line interface. It creates a temporary `colcon` workspace with a dummy package, then executes `colcon info` to display the package's metadata. This highlights the primary interaction model, which is through the `colcon` CLI, not direct Python imports."},"warnings":[{"fix":"Always invoke `colcon-package-information` via the `colcon` executable on the command line. For programmatic access to its *output*, consider using Python's `subprocess` module to run `colcon info` and parse its stdout.","message":"This package is a `colcon` extension and provides a new `colcon` verb (`info`). Its functionality is primarily accessed via the `colcon` command-line interface (e.g., `colcon info`), not by importing Python modules and calling functions directly within Python scripts for end-user tasks.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure `colcon-core` is installed via `pip install colcon-core` alongside `colcon-package-information`.","message":"`colcon-package-information` requires `colcon-core` to be installed and available in the environment for the `colcon info` verb to be discovered and function correctly. Installing `colcon-package-information` alone without `colcon-core` will not expose the `info` verb.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Ensure both `colcon-core` and `colcon-package-information` are installed in the active Python environment: `pip install colcon-core colcon-package-information`. Verify `colcon` is in your system's `PATH`.","cause":"The `colcon info` verb is not recognized by `colcon`. This typically happens if `colcon-package-information` is not installed, or if `colcon-core` (its primary dependency) is missing or not discoverable by your Python environment.","error":"colcon: error: argument {build,test,install,package,help}: invalid choice: 'info' (choose from 'build', 'test', 'install', 'package', 'help')"},{"fix":"Instead of importing and calling functions, use the `colcon` command-line tool. For example, run `colcon info` in your terminal. If you need to interact with its output from Python, use `subprocess.run(['colcon', 'info'], capture_output=True)` and parse the result.","cause":"Attempting to import `colcon_package_information` directly as a regular Python library for end-user functionality. While the package *can* be imported, its primary purpose is as a `colcon` command-line extension, not a library for direct function calls.","error":"ModuleNotFoundError: No module named 'colcon_package_information'"}]}