[ros-users] [Discourse.ros.org] [Next Generation ROS] Questioning the .launch.py file extension

Alexander Rössler ros.discourse at gmail.com
Sun Oct 7 18:13:00 UTC 2018



@wjwwood Presented the new Python-based launch files at ROSCon.

I really like the idea of using Python as a configuration/launcher language. In fact, we have also done this in the [Machinekit](http://machinekit.io) project for both configuration and launch files.

However, what I want to question is the `.launch.py` file extension.

Why? Python forbids adding dots in the name of a module (see https://www.python.org/dev/peps/pep-0008/#package-and-module-names). Therefore, it isn't possible to use files with extra dots in the name as if they are Python modules.

Of course, our launch file is not a Python module per default. However, it's very likely that the launch files will be used to build modular setups. Therefore, the launch file should be treated as a normal Python module.

As a software engineer, I want to be able to test my code, this includes launch files. But it turns out quickly that this is a lot harder to do when a module can't be imported the "normal" way via `import`. Other Python development tools might choke (or throw warnings) as well on the non-standard file extension.

One workaround is to use `importlib`. But I argue that this adds unnecessary complexity to the setup.

Therefore, I would like to propose to use a different method for identifying launch Python files such as for example using `_launch.py` in the name.





---
[Visit Topic](https://discourse.ros.org/t/questioning-the-launch-py-file-extension/6352/1) or reply to this email to respond.




More information about the ros-users mailing list