Use Poetry in your ROS2 packages with colcon-poetry-ros!

I’d like to show off a Colcon plugin I’ve been working on that lets you use Poetry instead of setuptools (setup.py, setup.cfg) to declare your Python ROS2 packages and their dependencies!

In case you’re unfamiliar, Poetry is an alternative packaging and dependency management tool for Python. It creates and maintains a lock file for your dependencies out of the box, which makes achieving reliable builds easy.

Poetry uses the new-ish pyproject.toml standard for defining Python packages instead of setup.py or setup.cfg. Colcon-poetry-ros takes care of pulling the information that Colcon needs from the pyproject.toml. It has support for defining nodes, running tests, and including data files. I’ve also included a small utility that assists in installing your Python dependencies to Colcon’s install/ directory.

Please let me know what you think! This is the first Colcon plugin I’ve written, so I would appreciate any feedback.

18 Likes

This is amazing, I’ve been integrating poetry manually in my environment but this will make life easier. Thanks!

3 Likes

It looks like the pyproject.toml you need to add to the package to use colcon-poetry-ros correctly contains similar information to the package.xml. This looks like unnecessary redundancy. What is the benefit?