Page MenuHomeVyOS Platform

Python3 deprecation distutils.version import LooseVersion
Closed, ResolvedPublicBUG

Description

vyos@r14# sudo python3
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> 
>>> from distutils.version import LooseVersion
<stdin>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
>>> 
>>>

Used in NAT and test_login

Details

Difficulty level
Unknown (require assessment)
Version
VyOS 1.4-rolling-202303291133
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Unspecified (please specify)

Event Timeline

Viacheslav changed the task status from Open to Needs testing.Jan 20 2024, 12:18 PM
Viacheslav triaged this task as Normal priority.

about vyos-1x:
current and sagitta don't use distutils, I found this only for equuleus
https://github.com/vyos/vyos-1x/blob/ae96118ec38c4064552889aea5e50023a66aac1e/src/conf_mode/nat.py#L21
https://github.com/vyos/vyos-1x/blob/ae96118ec38c4064552889aea5e50023a66aac1e/smoketest/scripts/cli/test_system_login.py#L23

pep 0632 suggest using packaging instead of distutils.version but versions like 5.4.268-amd64-vyos' , from kernel_version(), are also deprecated in this package

in addition, as I see equuleus still using python version 3.7, therefore if we don't have plans to upgrade python version on vyos-1.3 I think we can keep distutils for this vyos version.

vyos@vyos:~$ python3
Python 3.7.3 (default, Oct 11 2023, 09:51:27) 
[GCC 8.3.0] on linux