ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

ardupilotwaf: require minimum Python 3.8

Open tpwrules opened this issue 9 months ago • 12 comments

Makes the comment honest.

Requires upgrading Cygwin to Python 3.9. Python 3.12 is available but it doesn't have all our packages. I think we will have to modernize a bit more.

tpwrules avatar Mar 10 '25 17:03 tpwrules

Why is it that we want to move forward with our minimum Python version?

Doing so is likely to break a bunch of people's environments.

peterbarker avatar Mar 10 '25 21:03 peterbarker

I'm mostly proposing that we make the comment correct. If we want to keep 3.6 the minimum I suppose that's okay, but it has not seen a release in nearly four years and is nearly ten years old.

We already tried the move a couple years ago (which is where the comment came from) but it had to be reverted because Ubuntu 18.04 was still on life support. Now that that's gone let's move.

Making 3.8 the minimum also does make it easier to test. We e.g. can't CI test 3.6 compatibility anymore.

tpwrules avatar Mar 10 '25 22:03 tpwrules

Here are your previous thoughts: https://github.com/ArduPilot/ardupilot/pull/23287#discussion_r1174275730 :)

tpwrules avatar Mar 10 '25 22:03 tpwrules

Why is it that we want to move forward with our minimum Python version?

Doing so is likely to break a bunch of people's environments.

I don't understand why this is even a question Peter, like my mother always used to say, if "a bunch of people" jumped off a cliff would you follow them?

timtuxworth avatar Mar 10 '25 23:03 timtuxworth

Incidentally, if you can show we're currently broken on 3.6.9 / 3.7.0 we could probably merge this with the 3.8.0 requirement.

peterbarker avatar Mar 11 '25 02:03 peterbarker

Ping @tpwrules - testing requested here.

Hopefully you can show that we're just broken on <3.8 and we can just specify it as the minimum required version :-)

tridge does want the cygwin binary downloaded and tested, 'though.

peterbarker avatar Jun 02 '25 11:06 peterbarker

ubuntu 20.04 that is the minimal we are supporting is python 3.8 so that would work as the basis, under this the pip install will probably failed to find the right packages version anyway

khancyr avatar Jun 02 '25 12:06 khancyr

pymavlink is now broken on Python 3.6.9 (eg. Bionic):

    bionic64:     Complete output from command python setup.py egg_info:
    bionic64:     Traceback (most recent call last):
    bionic64:       File "<string>", line 1, in <module>
    bionic64:       File "/tmp/pip-build-6wWD6q/pymavlink/setup.py", line 15, in <module>
    bionic64:         from Cython.Build import cythonize
    bionic64:     ImportError: No module named Cython.Build
vagrant@ubuntu-bionic:~$ python3 --version
Python 3.6.9

peterbarker avatar Jun 03 '25 11:06 peterbarker

The Linux build requires syntax features only in 3.8:

$ ./waf configure --board=linux
Setting top to                           : /home/tpwatson/ardusimstuff/ardupilot 
Setting out to                           : /home/tpwatson/ardusimstuff/ardupilot/build 
Autoconfiguration                        : enabled 
Checking for program 'python'            : /usr/bin/python3 
Checking for python version >= 3.6.9     : 3.6.9 
Setting board to                         : linux 
Traceback (most recent call last):
  File "/home/tpwatson/ardusimstuff/ardupilot/modules/waf/waflib/Scripting.py", line 159, in waf_entry_point
    run_commands()
  File "/home/tpwatson/ardusimstuff/ardupilot/modules/waf/waflib/Scripting.py", line 255, in run_commands
    ctx = run_command(cmd_name)
  File "/home/tpwatson/ardusimstuff/ardupilot/modules/waf/waflib/Scripting.py", line 239, in run_command
    ctx.execute()
  File "/home/tpwatson/ardusimstuff/ardupilot/modules/waf/waflib/Configure.py", line 159, in execute
    super(ConfigurationContext, self).execute()
  File "/home/tpwatson/ardusimstuff/ardupilot/modules/waf/waflib/Context.py", line 214, in execute
    self.recurse([os.path.dirname(g_module.root_path)])
  File "/home/tpwatson/ardusimstuff/ardupilot/modules/waf/waflib/Context.py", line 296, in recurse
    user_function(self)
  File "/home/tpwatson/ardusimstuff/ardupilot/wscript", line 579, in configure
    cfg.get_board().configure(cfg)
  File "Tools/ardupilotwaf/boards.py", line 1464, in configure
    cfg.load('linux')
  File "/home/tpwatson/ardusimstuff/ardupilot/modules/waf/waflib/Configure.py", line 257, in load
    module = Context.load_tool(tool, tooldir, ctx=self, with_sys_path=with_sys_path)
  File "/home/tpwatson/ardusimstuff/ardupilot/modules/waf/waflib/Context.py", line 735, in load_tool
    __import__(x % tool)
  File "Tools/ardupilotwaf/linux.py", line 17, in <module>
    import linux_hwdef  # noqa:501
  File "<fstring>", line 1
    (len(dev)=)
             ^
SyntaxError: invalid syntax

tpwrules avatar Jun 07 '25 19:06 tpwrules

But our wscript is rather gigantic and I'm not sure how to check before triggering a syntax error in the general case. Do we just have to keep the wscript compatible with any Python? Or accept that old Pythons might give syntax errors before we can complain about the version?

tpwrules avatar Jun 07 '25 19:06 tpwrules

Rebased to generate fresh artifacts to test

robertlong13 avatar Jun 17 '25 22:06 robertlong13

Took a quadplane and a copter for a basic spin. Looks fine.

robertlong13 avatar Jun 18 '25 02:06 robertlong13