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

ap_dds_tests: Deprecate calling setup.py directly #24862

Open
Ryanf55 opened this issue Sep 3, 2023 · 3 comments
Open

ap_dds_tests: Deprecate calling setup.py directly #24862

Ryanf55 opened this issue Sep 3, 2023 · 3 comments
Labels
For-4.5 Planned for 4.5 release ROS

Comments

@Ryanf55
Copy link
Collaborator

Ryanf55 commented Sep 3, 2023

Bug report

Issue details

Developer machine

Version
master 9d98244

Platform
[ x] All
[ ] AntennaTracker
[ ] Copter
[ ] Plane
[ ] Rover
[ ] Submarine

Logs

colcon build --packages-up-to ardupilot_dds_tests
...
Starting >>> ardupilot_dds_tests
--- stderr: ardupilot_dds_tests                                                                        
/home/ryan/.local/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:66: 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()
---
Finished <<< ardupilot_dds_tests [0.54s]

Tagging @srmainwaring for visibility, I think we should fix this by 4.5.

@Ryanf55 Ryanf55 added ROS For-4.5 Planned for 4.5 release labels Sep 3, 2023
@srmainwaring
Copy link
Contributor

This requires an upstream fix to colcon. You see this on all the ROS 2 projects built as ament_python packages in humble built with Python versions >= 3.10.

There is discussion here:

Call for testing the new approach here:
-https://discourse.ros.org/t/call-for-testing-standards-based-python-packaging-with-colcon/32008

@vibgyor-s
Copy link

Reporting that after the setuptools update to version 68.2.0 changelogs the package straightaway fails to build with error Invalid Syntax

Starting >>> ardupilot_dds_tests
--- stderr: ardupilot_dds_tests
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/colcon_core/executor/init.py", line 91, in call
rc = await self.task(*args, **kwargs)
File "/usr/lib/python3/dist-packages/colcon_core/task/init.py", line 93, in call
return await task_method(*args, **kwargs)
File "/usr/lib/python3/dist-packages/colcon_ros/task/ament_python/build.py", line 51, in build
setup_py_data = get_setup_data(self.context.pkg, env)
File "/usr/lib/python3/dist-packages/colcon_core/task/python/init.py", line 20, in get_setup_data
return dict(pkg.metadatakey)
File "/usr/lib/python3/dist-packages/colcon_ros/package_augmentation/ros_ament_python.py", line 57, in getter
return get_setup_information(
File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 241, in get_setup_information
_setup_information_cache[hashable_env] = _get_setup_information(
File "/usr/lib/python3/dist-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 293, in _get_setup_information
return ast.literal_eval(output)
File "/usr/lib/python3.10/ast.py", line 64, in literal_eval
node_or_string = parse(node_or_string.lstrip(" \t"), mode='eval')
File "/usr/lib/python3.10/ast.py", line 50, in parse
return compile(source, filename, mode, flags,
File "", line 1
{'package_data': {}, 'dist_files': [], 'src_root': None, 'dependency_links': [], 'setup_requires': [], 'eager_resources': None, 'entry_points': {'console_scripts': ['time_listener = ardupilot_dds_tests.time_listener:main']}, 'exclude_package_data': None, 'extras_require': {}, 'include_package_data': None, 'install_requires': ['setuptools'], 'namespace_packages': None, 'packages': ['ardupilot_dds_tests'], 'python_requires': None, 'test_loader': None, 'test_runner': None, 'test_suite': None, 'tests_require': ['pytest'], 'use_2to3': None, 'zip_safe': True, 'message_extractors': None, 'verbose': 1, 'dry_run': 0, 'help': 0, 'command_packages': None, 'script_name': 'setup.py', 'script_args': ['--dry-run'], 'command_options': {'develop': {'script_dir': ('setup.cfg', '$base/lib/ardupilot_dds_tests')}, 'install': {'install_scripts': ('setup.cfg', '$base/lib/ardupilot_dds_tests')}}, 'package_dir': {}, 'py_modules': None, 'libraries': None, 'headers': None, 'ext_package': None, 'include_dirs': None, 'extra_path': None, 'scripts': None, 'data_files': [('share/ament_index/resource_index/packages', ['resource/ardupilot_dds_tests']), ('share/ardupilot_dds_tests', ['package.xml']), ('share/ardupilot_dds_tests/launch', []), ('share/ardupilot_dds_tests/config', []), ('share/ardupilot_dds_tests/config', ['config/ardupilot_dds.yaml'])], 'password': '', 'command_obj': {}, 'have_run': {}, 'want_user_cfg': True, 'metadata': {'name': 'ardupilot_dds_tests', 'version': '0.0.0', 'author': None, 'author_email': None, 'maintainer': 'maintainer', 'maintainer_email': 'maintainer@ardupilot.org', 'url': None, 'license': 'GPL-3.0', 'description': 'Tests for the ArduPilot AP_DDS library', 'long_description': None, 'keywords': None, 'platforms': None, 'classifiers': None, 'download_url': None, 'provides': None, 'requires': None, 'obsoletes': None, 'long_description_content_type': None, 'project_urls': {}, 'license_file': None, '_normalized_install_requires': {'setuptools': <Requirement('setuptools')>}, '_normalized_extras_require': {}}}
^
SyntaxError: invalid syntax
Failed <<< ardupilot_dds_tests [0.21s, exited with code 1]
Summary: 3 packages finished [7.60s]
1 package failed: ardupilot_dds_tests
1 package had stderr output: ardupilot_dds_tests
invalid syntax (, line 1)


This is verified after completing the build by reverting to setuptools==68.1.2 as a temporary fix.

@Ryanf55
Copy link
Collaborator Author

Ryanf55 commented Sep 11, 2023

I tried adding colcon-python-project to the workspace.

colcon build --packages-up-to colcon-python-project

Unfortunately, the package does not seem to work.

rfriedman@dev-rfriedman01:~/Dev/ardu_ws$ colcon build --packages-up-to colcon-python-project
Starting >>> colcon-python-project
--- stderr: colcon-python-project                   
/home/rfriedman/.local/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:66: 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()
---
Finished <<< colcon-python-project [1.04s]

Summary: 1 package finished [1.40s]
  1 package had stderr output: colcon-python-project
rfriedman@dev-rfriedman01:~/Dev/ardu_ws$ . install/local_setup.bash
rfriedman@dev-rfriedman01:~/Dev/ardu_ws$ colcon list
ardupilot_dds_tests     src/ardupilot/Tools/ros2/ardupilot_dds_tests    (ros.ament_python)
ardupilot_gz_application        src/ardupilot_gz/ardupilot_gz_application       (ros.ament_cmake)
ardupilot_gz_bringup    src/ardupilot_gz/ardupilot_gz_bringup   (ros.ament_cmake)
ardupilot_gz_description        src/ardupilot_gz/ardupilot_gz_description       (ros.ament_cmake)
ardupilot_gz_gazebo     src/ardupilot_gz/ardupilot_gz_gazebo    (ros.ament_cmake)
ardupilot_msgs  src/ardupilot/Tools/ros2/ardupilot_msgs (ros.ament_cmake)
ardupilot_ros   src/ardupilot_ros       (ros.ament_python)
ardupilot_sitl  src/ardupilot/Tools/ros2/ardupilot_sitl (ros.ament_cmake)
colcon-python-project   src/colcon-python-project       (python)
micro_ros_agent src/micro_ros_agent/micro_ros_agent     (ros.ament_cmake)

For now, I say we pin setuptools to an earlier version in the ardupilot setup scripts till this issue is resolved: colcon/colcon-python-setup-py#56 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For-4.5 Planned for 4.5 release ROS
Projects
Status: 🔖 Ready
Development

No branches or pull requests

3 participants