Skip to main content

Python library for the ROS2 module setup

Project description

Ros2Setup

This project is a tiny python library made for ROS2 modules to simplify the packaging process.
Instead of having two files -setup.py and package.xml- with the same duplicated information, this module makes it easy dynamically import the information from the package.xml into the python setup file.

This way, only the package.xml file has to be edited, to prevent having the two files with conflicting information.

Installing

Either install with pip install ros2setup, or copy ros2setup.py next to your setup.py so that it is accessible from there.

Usage

In the setup.py file of your ROS2 package, change the hardcoded information to a call to Ros2Setup to pull the data from the XML file.

from setuptools import setup
from ros2setup import Ros2Setup

package_name = Ros2Setup.tag('name')
setup(
    name=package_name,
    version=Ros2Setup.tag('version'),
    packages=[package_name],
    data_files=[
        ('share/ament_index/resource_index/packages',
            ['resource/' + package_name]),
        ('share/' + package_name, ['package.xml']),
    ],
    install_requires=['setuptools'],
    zip_safe=True,
    maintainer=Ros2Setup.tag('maintainer'),
    maintainer_email=Ros2Setup.attrib('maintainer', 'email'),
    description=Ros2Setup.tag('description'),
    license=Ros2Setup.tag('license'),
    tests_require=['pytest'],
    entry_points={
        'console_scripts': [
            'streamer = mypackage.submodule:main',
        ],
    },
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ros2setup-1.1.tar.gz (2.6 kB view hashes)

Uploaded Source

Built Distribution

ros2setup-1.1-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page