Registry / devops / colcon-metadata

colcon-metadata

JSON →
library0.2.5pypypiunverified

colcon-metadata is an extension for the `colcon` build tool, providing the ability to read package metadata from various file formats beyond `package.xml`. It helps `colcon` discover and process packages in a more flexible way, especially useful for mixed workspaces. It is currently at version 0.2.5 and has an infrequent release cadence, often aligning with `colcon-core` updates.

pip install colcon-metadata
INSTALL
IMPORT
SIG · COLCON-METADATA
C
colcon-metadata
devopspythonv0.2.5
Install
5.2s avg
Import
Disk
43MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 39.7MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 5.2s · import 0.000s · 41MB
43MB installed
● package 43MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

colcon_metadata
colcon CLI commands (e.g., colcon build)
colcon-metadata is a colcon extension that registers entry points; it is not typically imported directly into user Python code. Its functionality is exposed via the `colcon` command-line interface.

This quickstart demonstrates `colcon-metadata` by creating a temporary `colcon` workspace with a Python package defined solely by a `colcon.pkg` file. It then attempts to run `colcon build` to show how `colcon`, with the `colcon-metadata` extension, can discover and process packages based on this metadata file. Ensure `colcon-core` is installed in your environment for the `colcon` command to be available.

import os import subprocess import shutil # Define workspace and package paths workspace_dir = "temp_colcon_metadata_workspace" package_dir = os.path.join(workspace_dir, "my_python_package") colcon_pkg_path = os.path.join(package_dir, "colcon.pkg") # Clean up previous runs if any if os.path.exists(workspace_dir): shutil.rmtree(workspace_dir) # Create directory structure os.makedirs(package_dir, exist_ok=True) # Create a dummy colcon.pkg file for metadata colcon_pkg_content = """ type: python name: my_python_package version: 0.1.0 maintainers: - Example User <user@example.com> """ with open(colcon_pkg_path, "w") as f: f.write(colcon_pkg_content) # Optional: Create a minimal setup.py and __init__.py for a buildable Python package setup_py_content = """ from setuptools import setup setup( name='my_python_package', version='0.1.0', packages=['my_python_package'], install_requires=[], ) """ os.makedirs(os.path.join(package_dir, "my_python_package"), exist_ok=True) with open(os.path.join(package_dir, "setup.py"), "w") as f: f.write(setup_py_content) with open(os.path.join(package_dir, "my_python_package", "__init__.py"), "w") as f: f.write("") print(f"Created dummy package at: {package_dir}") print(f"Created colcon.pkg at: {colcon_pkg_path}") # Attempt to run 'colcon build' to demonstrate discovery print("\nAttempting to run 'colcon build' in the workspace...") try: # Check if colcon is installed subprocess.run(["colcon", "--version"], check=True, capture_output=True) # Run colcon build for the specific package result = subprocess.run( ["colcon", "build", "--packages-select", "my_python_package"], cwd=workspace_dir, check=True, capture_output=True, text=True ) print("colcon build successful! Output:\n") print(result.stdout) if result.stderr: print("colcon build stderr:\n", result.stderr) except FileNotFoundError: print("Error: 'colcon' command not found. Please install colcon-core: pip install colcon-core") except subprocess.CalledProcessError as e: print(f"colcon build failed: {e}") print("stdout:\n", e.stdout) print("stderr:\n", e.stderr) finally: # Clean up the workspace if os.path.exists(workspace_dir): print(f"\nCleaning up {workspace_dir}") shutil.rmtree(workspace_dir)
colcon --version
Debug
Known issues
gotchacolcon.pkg files are written in YAML. Any indentation errors or incorrect syntax will lead to parsing failures, which might present as generic package discovery errors if not debugged with verbose `colcon` output.
fix
Strictly adhere to YAML syntax. Use a YAML linter during development of `colcon.pkg` files. Run `colcon build --log-level debug` for detailed parsing feedback.
affects: All versions
gotchacolcon-metadata only provides the ability to *read* a `colcon.pkg` file. For `colcon` to actually *build* the package, a separate build extension (e.g., for Python, CMake, etc.) must also be installed and capable of handling the package `type` specified in `colcon.pkg`.
fix
Ensure that the necessary `colcon` build extensions (e.g., `colcon-ros-python-setup-py` for Python packages, `colcon-ament-cmake` for CMake) are installed and compatible with the package type declared in your `colcon.pkg`.
affects: All versions
gotchaIf multiple `colcon` extensions provide metadata for the same package or source file, the behavior might be undefined or depend on the internal loading order of extensions. This can lead to unexpected package discovery or configuration.
fix
Be mindful of other `colcon` extensions installed in your environment, especially if you encounter conflicts in package discovery. Explicitly list packages to build using `--packages-select` if ambiguity arises. Consult `colcon` documentation for extension priority.
affects: All versions
Upgrade
Version history
0.2.5latest on PyPI · released Aug 10, 2020
Audit
Dependencies
colcon-corerequiredProvides the core `colcon` build system, which `colcon-metadata` extends. Essential for `colcon` commands.
colcon-package-informationrequiredUsed internally by `colcon-metadata` for package information handling.
Agent activity
2 hits · last 30 days
node
2
Resources