--- id: xmacro version: "1.2.1" license: MIT license_treatment: permissive maintenance: abandoned --- # xmacro — a simple XML macro tool License: permissive · Maintenance: abandoned · Downloads: 77.5K/mo ## What it is and what it does xmacro is a simplified XML macro language inspired by ROS's xacro, designed to preprocess URDF and SDF robot description files. It runs independently of ROS and can be installed via pip. The tool supports value macros (named constants substituted into XML), block macros (parameterized XML fragments), math expressions within substitution braces, file inclusion, and conditional blocks. It provides both a command-line interface and a Python API for integration into build or launch workflows. The package includes two specialized variants: xmacro4sdf and xmacro4urdf, which add pre-defined geometry and inertia macros specific to each format, along with path resolution for model:// and package:// URIs. Macro nesting is supported up to 5 levels deep. The implementation uses Python's eval() for expression evaluation, which the documentation notes is unsafe for untrusted input. Use it for: - Reduce duplication in URDF robot descriptions by defining reusable inertia and geometry macros for common shapes - Generate multiple SDF model variants from a single template by overriding macro values at parse time - Preprocess robot description files in ROS 2 launch scripts using the Python API before deployment - Conditionally include or exclude robot components based on macro parameters without manual file editing - Include common macro definitions across multiple URDF or SDF files via the xmacro_include tag ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. xmacro is a command-line and Python tool for defining and expanding XML macros—named values, parameterized blocks, and conditional includes—to generate expanded XML files suitable for URDF and SDF robot description formats. Yes, if you need XML macro expansion for URDF or SDF files and are comfortable with an abandoned package. The tool is simple, has no dependencies, and works well for its stated purpose. However, do not use it for untrusted or adversarial input due to eval()-based expression evaluation, and be aware that no security patches or feature updates will be released. ## Install pip install xmacro uv add xmacro poetry add xmacro ## Installing xmacro Before you install: Installation is straightforward via pip with no runtime dependencies. However, the package is abandoned—last release was in January 2022 and the repository received its final commit in September 2022, so no active maintenance or security updates should be expected. License in practice: MIT license is permissive and places no restrictions on use, modification, or distribution in proprietary or open-source projects. Quickstart: # Command-line usage pip install xmacro xmacro input.xml.xmacro > output.xml # Python API usage from xmacro.xmacro import XMLMacro xmacro = XMLMacro() xmacro.set_xml_file('input.xml.xmacro') xmacro.generate() xmacro.to_file('output.xml') Verify before relying: - Whether the package works reliably with modern Python versions given its abandonment status - Whether math expression evaluation via eval() poses security risks in untrusted input scenarios ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 77.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags xml macro expansion, urdf macro preprocessor, sdf template generation, xml templating tool, robot description macro, xacro alternative, xml value substitution, robot-description, xml-templating, abandoned [View on SkillFed](https://skillfed.io/packages/xmacro) · [View on PyPI](https://pypi.org/project/xmacro/)