Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build/install wheel for Python packages #1196

Open
wants to merge 1 commit into
base: noetic-devel
Choose a base branch
from

Conversation

mikepurvis
Copy link
Member

@mikepurvis mikepurvis commented Apr 10, 2024

Addresses another bit of spam we encountered migrating our ROS 1 codebase to Python 3.11:

/nix/store/yvhwsfbh4bc99vfvwpaa70m4yng4pvpz-python3-3.11.8/lib/python3.11/distutils/cmd.py:62: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
  self.initialize_options()

I don't expect this to be accepted as it's a pretty significant change in operations for catkin and possibly even breaks core functionality such as the develspace (though we don't care as we now use colcon everywhere anyway). I'm offering it largely as a conversation piece to understand from the community if there is any interest in "modernizing" catkin's interface to Python in this way, and if so is calling the CLI interface to pypa/build and pip the correct way to go about it, or are there programmatic APIs that would be more logical to use? If we only want to continue supporting setuptools, then we can obviously use setuptools.build_meta, but if we're going to pay the cost of a wheel round trip anyway, why not put us on the path to working with pyproject-only packages too?

On the colcon side, there's been some lively discussion going on for a while in colcon/colcon-core#208 and colcon/colcon-core#454.

"--disable-pip-version-check" \
"--user" \
"--upgrade" \
"$WHEELFILE"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested various combinations of the --root, --target, and --prefix options available in pip (see https://stackoverflow.com/a/53870246/109517) and the --root + --user + PYTHONUSERBASE route seems the least hacky.

Copy link
Member Author

@mikepurvis mikepurvis Apr 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might also be over the top to be involving pip here when it could be as simple as reaching into setuptools to invoke the install/run method:

https://github.com/pypa/setuptools/blob/6ee23bf0579c52e1cbe7c97fc20fd085ff2a25c7/setuptools/command/install.py#L78-L89

Or using the new pypa/installer method as suggested in the original warning message: https://installer.pypa.io/en/stable/


<buildtool_export_depend>cmake</buildtool_export_depend>
<buildtool_export_depend condition="$ROS_PYTHON_VERSION == 3">python3-setuptools</buildtool_export_depend>
<buildtool_export_depend condition="$ROS_PYTHON_VERSION == 3">python3-build</buildtool_export_depend>
<buildtool_export_depend condition="$ROS_PYTHON_VERSION == 3">python3-wheel</buildtool_export_depend>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need a dep here for pip too; on NixOS at least neither the module nor executable is bundled with Python: https://search.nixos.org/packages?query=pip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant