colcon / colcon-bundle

A colcon extension to create portable application bundles
Apache License 2.0
38 stars 24 forks source link

Hide confusing warning message from setuptools #140

Closed AAlon closed 4 years ago

AAlon commented 4 years ago

As a result of https://github.com/colcon/colcon-bundle/pull/127 an incompatible version of setuptools will not be installed. We need a way to hide the irrelevant warning:

You are running Setuptools on Python 2, which is no longer
supported and
>>> SETUPTOOLS WILL STOP WORKING <<<
in a subsequent release (no sooner than 2020-04-20).

Not sure the solution would be in colcon-bundle but perhaps it's possible for colcon-bundle to change the warning configuration when it prepares the bundle with setuptools. Refer to internal issue B9SIM-1008.

piraka9011 commented 4 years ago

@AAlon this is related to setuptool and not to colcon-bundle. Since the fix is in, I think what needs to happen instead is a version bump and customers should update their colcon-bundle install.

Looking into it a bit though, I see that specifying setuptools<45 instead of setuptools==44 might work and/or adding:

import warnings
warnings.filterwarnings("ignore")

to setup.py is one way to suppress warnings.

AAlon commented 4 years ago

re: not related to colcon-bundle - setuptools might not be a dependency of the customer's application. It's a dependency of pip, which is a dependency of colcon-bundle. So when customers bundle their ROS1 application, even if it has no use of setuptools - it will be bundled with Python2.x + setuptools (with the version that colcon-bundle decided). The customer has no control over that, which is why I thought that exploring a solution on colcon-bundle's side is worth looking into.

Colcon-bundle could do something (rather ugly) like patch the warning message string of the setuptools installation in the bundle to be empty, or be less scary ;) Or, patch the default warning config to filter out that particular warning. Hopefully there are more elegant solutions out there.

piraka9011 commented 4 years ago

I wasn't able to reproduce locally and I don't think it's wise to suppress warnings. I'd either have to suppress all the warnings with the -W ignore flag or add a context manager to suppress the warnings whose blast radius might be a bit too wide.

I think the solution is to release colcon-bundle 0.0.19 with the latest changes which pin the setuptools version (As suggested by the official docs). If you have any other suggestions feel free to re-open this ticket.