[ros-users] [Discourse.ros.org] [ROS Projects] Catkin_virtua…

Forside
Vedhæftede filer:
Indlæg som e-mail
+ (text/plain)
Slet denne besked
Besvar denne besked
Skribent: Paul Bovbel via ros-users
Dato:  
Til: ros-users
CC: Paul Bovbel
Emne: [ros-users] [Discourse.ros.org] [ROS Projects] Catkin_virtualenv


Hello ros-users,

Presenting [catkin_virtualenv](https://github.com/locusrobotics/catkin_virtualenv), a tool to define and bundle python dependencies with your catkin python packages.

We've been running an internal ros_buildfarm instance at Locus Robotics for almost 2 years (thanks OSRF!). One ongoing pain point was managing python package dependencies that aren't in the Debian/Ubuntu apt repositories.

The workflow for catkin_virtualenv fits fairly well on top of the existing ROS Python-via-CMake pattern:
1. [declare](https://github.com/locusrobotics/catkin_virtualenv/blob/devel/test_catkin_virtualenv/package.xml#L39) a set of python requirements in `requirements.txt`
2. [generate](https://github.com/locusrobotics/catkin_virtualenv/blob/devel/test_catkin_virtualenv/CMakeLists.txt#L8) a virtualenv at build time by calling CMake macro `catkin_generate_virtualenv`.
3. [install](https://github.com/locusrobotics/catkin_virtualenv/blob/devel/test_catkin_virtualenv/CMakeLists.txt#L16) your python scripts via `catkin_install_python` as usual.
4. add a dependency to your [nosetests](https://github.com/locusrobotics/catkin_virtualenv/blob/devel/test_catkin_virtualenv/CMakeLists.txt#L21) and [rostests](https://github.com/locusrobotics/catkin_virtualenv/blob/devel/test_catkin_virtualenv/CMakeLists.txt#L25).

More detail is provided in the [README](https://github.com/locusrobotics/catkin_virtualenv/blob/devel/README.md), or see the provided test packages for toy usage examples. Behind the scenes:
- the generated virtualenv will work transparently in devel- and install-space, and be bundled in any released debian packages.
- package requirements will be propagated to any dependent catkin packages.
- your python scripts will be wrapped in a loader that will work transparently with `rosrun`, `roslaunch`, and `rostest`.
- adding the `PYTHON3` flag to `catkin_generate_virtualenv` will enable your python scripts to run in python3. This mostly ['just works'](https://github.com/locusrobotics/catkin_virtualenv/blob/devel/test_catkin_virtualenv_py3/CMakeLists.txt#L8) with a lot of existing ROS components, but does have a few [caveats](https://github.com/locusrobotics/catkin_virtualenv/issues) at the moment.

One important thing to note is that the catkin_virtualenv approach does make your package artifacts noticeably 'fatter' due to the dependency bundling, so be wary of pulling in large dependency trees, and please continue to use rosdep+apt dependencies when possible.

Please enjoy, and I'm looking forward to feedback from anyone who finds this package useful!

Paul





---
[Visit Topic](https://discourse.ros.org/t/catkin-virtualenv/4365/1) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list

http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>