Support for Python version 3.12 and 3.13 #1465
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Build with 3.13 is still experimental. It builds the binaries but due to compiling errors in library pyglet version 1.5.29 we miss the support for 3D visualization. Beside this Pronterface and Pronsole is fully functional.
Changes in release_windows.bat
Python 3.13 is still experimental as there is for now no 3D visualization available because of incompatibility issues with pyglet
CleanCacheFiles.bat
This batch file will clean up all pycache folders, *.pyd files and left over gcoder_line files from previous builds. For local Windows only. It is helpful when you switch between Python versions or you have problems with incompatible library files or versions.
Changes in requirements.txt
Remove dedicated version for pillow in Windows build environment
pillow < 10.0; sys_platform == 'win32'
--> to:
pillow ;sys_platform == 'win32'
Changes in buildpackage-win.yml
Add support for Python 3.12 and 3.13 and mark Python 3.13 as experimental
Various fixes for visible SyntaxError warnings of invalid escape sequence when compiling with Python 3.12 and 3.13
(in question to become in Python >3.13 a syntax error)
See https://docs.python.org/dev/whatsnew/3.6.html#deprecated-python-behavior:
A backslash-character pair that is not a valid escape sequence now generates a DeprecationWarning.
Although this will eventually become a SyntaxError, that will not be for several Python releases.
(Contributed by Emanuel Barry in bpo-27364.)
and https://docs.python.org/3/reference/lexical_analysis.html, Chapter 2.4.1.1. Escape sequences:
Changed in version 3.6: Unrecognized escape sequences produce a DeprecationWarning.
Changed in version 3.12: Unrecognized escape sequences produce a SyntaxWarning. In a future Python version they will be eventually a SyntaxError.
Solution: Change string to raw string when escape sequences are involved
\printrun\pronterface.py:2099: SyntaxWarning: invalid escape sequence '\d'
self.sdfiles.append(re.sub(" \d+$", "", line.strip().lower())) # NOQA
--> to:
self.sdfiles.append(re.sub(r" \d+$", "", line.strip().lower())) # NOQA
\printrun\pronsole.py:61: SyntaxWarning: invalid escape sequence '\d'
tempreading_exp = re.compile('\\bT\d*:')
--> to:
tempreading_exp = re.compile(r'\\bT\d*:')
\printrun\pronsole.py:201: SyntaxWarning: invalid escape sequence '\d'
self.lineignorepattern=re.compile("ok ?\d*$|.*busy: ?processing|.*busy: ?heating|.*Active Extruder: ?\d*$")
--> to:
self.lineignorepattern = re.compile(r"ok ?\d*$|.*busy: ?processing|.*busy: ?heating|.*Active Extruder: ?\d*$")
\printrun\pronsole.py:1140: SyntaxWarning: invalid escape sequence '\d'
self.sdfiles.append(re.sub(" \d+$","",line.strip().lower()))
--> to:
self.sdfiles.append(re.sub(r" \d+$","",line.strip().lower()))
\printrun\gcoder.py:28: SyntaxWarning: invalid escape sequence '('
gcode_exp = re.compile("\([^\(\)]*\)|;.*|[/\*].*\n|([%s])\s*([-+]?[0-9]*\.?[0-9]*)" % to_parse)
--> to:
gcode_exp = re.compile(r"\([^\(\)]*\)|;.*|[/\*].*\n|([%s])\s*([-+]?[0-9]*\.?[0-9]*)" % to_parse)
\printrun\gcoder.py:29: SyntaxWarning: invalid escape sequence '('
gcode_strip_comment_exp = re.compile("\([^\(\)]*\)|;.*|[/\*].*\n")
--> to:
gcode_strip_comment_exp = re.compile(r"\([^\(\)]*\)|;.*|[/\*].*\n")
\printrun\gcoder.py:30: SyntaxWarning: invalid escape sequence '('
m114_exp = re.compile("\([^\(\)]*\)|[/\*].*\n|([XYZ]):?([-+]?[0-9]*\.?[0-9]*)")
--> to:
m114_exp = re.compile(r"\([^\(\)]*\)|[/\*].*\n|([XYZ]):?([-+]?[0-9]*\.?[0-9]*)")
\printrun\gcoder.py:31: SyntaxWarning: invalid escape sequence '('
specific_exp = "(?:\([^\(\)]*\))|(?:;.*)|(?:[/\*].*\n)|(%s[-+]?[0-9]*\.?[0-9]*)"
--> to:
specific_exp = "(?:\([^\(\)]*\))|(?:;.*)|(?:[/\*].*\n)|(%s[-+]?[0-9]*\.?[0-9]*)"
\printrun\device.py:209: SyntaxWarning: invalid escape sequence '.'
host_regexp = re.compile("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$")
--> to:
host_regexp = re.compile("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$")
\printrun\gcodeplater.py:48: SyntaxWarning: invalid escape sequence '.'
rewrite_exp = re.compile("(%s)" % "|".join(["X([-+]?[0-9]*\.?[0-9]*)",
--> to:
rewrite_exp = re.compile("(%s)" % "|".join([r"X([-+]?[0-9]*\.?[0-9]*)",
\printrun\gcodeplater.py:49: SyntaxWarning: invalid escape sequence '.'
"Y([-+]?[0-9]*\.?[0-9]*)"]))
--> to:
r"Y([-+]?[0-9]*\.?[0-9]*)"]))
Can't be fixed because external library and do not harm:
\v3\Lib\site-packages\pyglet\gl\wgl.py:36: SyntaxWarning: invalid escape sequence '\c'
"""Wrapper for C:\cygwin\home\Alex\pyglet\tools\wgl.h