(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Contributing Python 3 Fixes

Description: Consider contributing Python 3 fixes. Anything you contribute will help make the Noetic release work better for you.

Tutorial Level: INTERMEDIATE

This tutorial is part of a series about transitioning a ROS 1 package to Python 3.

Finding packages to contribute to

The timing of the Noetic release forces it to move to Python 3, and this is expected to be a significant effort. Every ROS 1 release brings new features and improvements. Any way you can contribute will make this release better for you and your users.

Start with packages you use

Start by contributing to packages you use. Your experience with how the package behaves using Python 2 makes you more likely to spot incorrect behavior using Python 3. You may have already noticed issues while porting your packages.

Open tickets on your dependency's repository describing problems you encountered. Consider also investigating those issues or opening pull requests to fix them for you and others.

Check the Noetic CI jobs

The Noetic CI jobs build and run packages that intend to be released into Noetic using Python 2 and Python 3. The Python 2 job only exists for comparison to indicate if a test failure is related to Python 3 or is already present with Python 2.

Look at the latest jobs and compare the test failures between Python 2 and Python 3. Packages with failing Python 3 tests need help to be ready for the Noetic release.

Build all of Noetic

The noetic/distribution.yaml has source entries for packages that have started making changes for the Noetic release. Try building it on your operating system. Packages that don't build are packages that could use your contributions.

Ways to contribute

Fix test failures

If you spot test failures, either in the Noetic CI jobs or in your own testing, check the package's issue tracker. If there's no issue, then open one. If there is an issue, then try investigating and fixing it.

Add test coverage

Watching test failures is only as effective as the test coverage of a package. Consider creating pull requests that add test coverage to packages using Python. Every increase in test coverage could uncover new bugs.

Fix Flake8 linter complaints

Flake8 is a tool that can catch style issues with Python code. It also catches syntactical issues with the version of Python used to invoke it.

cd path/to_a/ros_package
# Show only syntax errors
python3 -m flake8 --select=E999

Try building on Debian Buster

Try building your packages and their dependencies on Debian Buster. This is likely one of the target platforms for Noetic. You may discover incompatibilities with the version of Python available on Debian Buster.

If you encounter packages that don't build, then those could use your help. Even fixing packages that don't use Python is helpful because other packages using Python may depend on them.

Update this tutorial

Lastly this tutorial is a wiki. Please update the tutorial to fix any issues you find. If there are tools are tips useful to fixing Python 3 issues, then add new sections or new pages. Your experience can be used to make this a better experience for the next reader, and that will make the Noetic release better for you.

Wiki: UsingPython3/Contributing (last edited 2019-08-23 20:13:45 by MaryaBelanger)