-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[Packaging] Support Python 3.12 #29465
Conversation
️✔️AzureCLI-FullTest
|
Hi @bebound, |
️✔️AzureCLI-BreakingChangeTest
|
Packaging |
@@ -39,6 +39,7 @@ | |||
'Programming Language :: Python :: 3.9', | |||
'Programming Language :: Python :: 3.10', | |||
'Programming Language :: Python :: 3.11', | |||
'Programming Language :: Python :: 3.12', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should also be added to
azure-cli/src/azure-cli/setup.py
Line 48 in b616adf
'Programming Language :: Python :: 3.11', |
'Programming Language :: Python :: 3.11', |
azure-cli/src/azure-cli-testsdk/setup.py
Line 21 in a5198b5
'Programming Language :: Python :: 3.11', |
@@ -22,9 +22,9 @@ jobs: | |||
fetchTags: true | |||
persistCredentials: true | |||
- task: UsePythonVersion@0 | |||
displayName: 'Use Python 3.10' | |||
displayName: 'Use Python 3.11' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as bundled Python version.
1d7fb07
to
196ae5a
Compare
@@ -24,9 +24,9 @@ def test_validate_decorator_mode(self): | |||
self.assertEqual(validate_decorator_mode(DecoratorMode.CREATE), True) | |||
self.assertEqual(validate_decorator_mode(DecoratorMode.UPDATE), True) | |||
self.assertEqual(validate_decorator_mode(DecoratorMode), False) | |||
self.assertEqual(validate_decorator_mode(1), False) | |||
# self.assertEqual(validate_decorator_mode(1), False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In 3.12, the Enum.value in Enum
is True.
DeprecationWarning: in 3.12 __contains__ will no longer raise TypeError, but will return True or False depending on whether the value is a member or the value of a member
This is the result in 3.11:
>>> from enum import Enum
>>> class DecoratorMode(Enum):
... """Enumerations used to distinguish whether to handle creation or update.
... """
... CREATE = 1
... UPDATE = 2
...
>>> 1 in DecoratorMode
<stdin>:1: DeprecationWarning: in 3.12 __contains__ will no longer raise TypeError, but will return True or
False depending on whether the value is a member or the value of a member
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\enum.py", line 742, in __contains__
raise TypeError(
TypeError: unsupported operand type(s) for 'in': 'int' and 'EnumType'
>>> True in DecoratorMode
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\enum.py", line 742, in __contains__
raise TypeError(
TypeError: unsupported operand type(s) for 'in': 'bool' and 'EnumType'
>>> "1" in DecoratorMode
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\enum.py", line 742, in __contains__
raise TypeError(
TypeError: unsupported operand type(s) for 'in': 'str' and 'EnumType'
In 3.12
>>> 1 in DecoratorMode
True
>>> True in DecoratorMode
True
>>> "1" in DecoratorMode
False
Changed in version 3.12: Before Python 3.12, a
TypeError
is raised if a non-Enum-member is used in a containment check. --https://docs.python.org/3/library/enum.html#enum.EnumType.__contains__
Not sure if this affects az command, skip the test temporally.
I'll check it when bundle Python bumps to 3.12.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing in #29517
This reverts commit 2e3a4c3.
Description
Close #27673
Changes:
setup.py
Also need to update
scripts/ci/build.sh
to include 3.12 insetup.py