-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add support for Python 3.12 #11262
Add support for Python 3.12 #11262
Conversation
Python 3.12.0 was released on 10-02-2023, this commit marks the start of support for Python 3.12 in Qiskit. It adds the supported Pythonv ersion in the package metadata and updates the CI configuration to run test jobs on Python 3.12 and build Python 3.12 wheels on release. Fixes: Qiskit#10887
One or more of the the following people are requested to review this:
|
Pull Request Test Coverage Report for Build 6947252053
💛 - Coveralls |
In Python 3.12 `datetime.datetime.utcnow()` has been deprecated, being replaced by: `datetime.datetime.now(datetime.UTC)`. This commit updates the usage of `utcnow()` to follow the new convention.
The recommended alternative for using utcnow() in the deprecation warnings emitted by Python 3.12 are not compatible with Python 3.8. The datetime.UTC alias was not added to Python until Python 3.11. To ensure that the code is compatible with Python < 3.11 this commit updates all the usage of datetime.UTC to use datetime.timezone.utc instead, which is what datetime.UTC aliases to in Python >=3.11.
I think this should be good to go now, at least it passes locally. My only concern is we'll hit the same stability issue with unitary synthesis on the newer numpy that led to #11232. But to support 3.12 we need to use a newer version of numpy. |
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 seems fine by me. We ought to get to the bottom of the Numpy flakiness - the failing test is weird to me full stop, but I'm most concerned that it's flaky.
online_date=datetime.datetime.utcnow(), | ||
online_date=datetime.datetime.now(datetime.timezone.utc), |
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.
I was confused why I hadn't seen and fixed this when I was doing the initial Python 3.12 testing, but then I remembered that symengine didn't have wheels at the time and we had Numpy/Scipy problems, so I'd not got all the way.
I've been rerunning the tests and managed to trigger the test failure on the 3rd run: https://dev.azure.com/qiskit-ci/qiskit/_build/results?buildId=51680&view=logs&j=783cd8ce-45d0-52b9-fbe2-d8b6f5c36b94&t=f6ef7ac4-a492-580b-ed69-1d6c3306a466&l=22108 I think we need to get to the bottom of this instability issue before we can merge this, otherwise we'll likely block ci in practical terms because of these failures. |
Unblocked by the merge of #11307. |
* Add support for Python 3.12 Python 3.12.0 was released on 10-02-2023, this commit marks the start of support for Python 3.12 in Qiskit. It adds the supported Pythonv ersion in the package metadata and updates the CI configuration to run test jobs on Python 3.12 and build Python 3.12 wheels on release. Fixes: #10887 * Add release note * Avoid deprecated `datetime.datetime.utcnow()` usage In Python 3.12 `datetime.datetime.utcnow()` has been deprecated, being replaced by: `datetime.datetime.now(datetime.UTC)`. This commit updates the usage of `utcnow()` to follow the new convention. * Adjust UTC usage to support Python 3.8 The recommended alternative for using utcnow() in the deprecation warnings emitted by Python 3.12 are not compatible with Python 3.8. The datetime.UTC alias was not added to Python until Python 3.11. To ensure that the code is compatible with Python < 3.11 this commit updates all the usage of datetime.UTC to use datetime.timezone.utc instead, which is what datetime.UTC aliases to in Python >=3.11. (cherry picked from commit 5a5c9e3) # Conflicts: # requirements.txt
* Add support for Python 3.12 Python 3.12.0 was released on 10-02-2023, this commit marks the start of support for Python 3.12 in Qiskit. It adds the supported Pythonv ersion in the package metadata and updates the CI configuration to run test jobs on Python 3.12 and build Python 3.12 wheels on release. Fixes: #10887 * Add release note * Avoid deprecated `datetime.datetime.utcnow()` usage In Python 3.12 `datetime.datetime.utcnow()` has been deprecated, being replaced by: `datetime.datetime.now(datetime.UTC)`. This commit updates the usage of `utcnow()` to follow the new convention. * Adjust UTC usage to support Python 3.8 The recommended alternative for using utcnow() in the deprecation warnings emitted by Python 3.12 are not compatible with Python 3.8. The datetime.UTC alias was not added to Python until Python 3.11. To ensure that the code is compatible with Python < 3.11 this commit updates all the usage of datetime.UTC to use datetime.timezone.utc instead, which is what datetime.UTC aliases to in Python >=3.11. (cherry picked from commit 5a5c9e3)
* Add support for Python 3.12 Python 3.12.0 was released on 10-02-2023, this commit marks the start of support for Python 3.12 in Qiskit. It adds the supported Pythonv ersion in the package metadata and updates the CI configuration to run test jobs on Python 3.12 and build Python 3.12 wheels on release. Fixes: #10887 * Add release note * Avoid deprecated `datetime.datetime.utcnow()` usage In Python 3.12 `datetime.datetime.utcnow()` has been deprecated, being replaced by: `datetime.datetime.now(datetime.UTC)`. This commit updates the usage of `utcnow()` to follow the new convention. * Adjust UTC usage to support Python 3.8 The recommended alternative for using utcnow() in the deprecation warnings emitted by Python 3.12 are not compatible with Python 3.8. The datetime.UTC alias was not added to Python until Python 3.11. To ensure that the code is compatible with Python < 3.11 this commit updates all the usage of datetime.UTC to use datetime.timezone.utc instead, which is what datetime.UTC aliases to in Python >=3.11. (cherry picked from commit 5a5c9e3) Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
* Add support for Python 3.12 Python 3.12.0 was released on 10-02-2023, this commit marks the start of support for Python 3.12 in Qiskit. It adds the supported Pythonv ersion in the package metadata and updates the CI configuration to run test jobs on Python 3.12 and build Python 3.12 wheels on release. Fixes: Qiskit#10887 * Add release note * Avoid deprecated `datetime.datetime.utcnow()` usage In Python 3.12 `datetime.datetime.utcnow()` has been deprecated, being replaced by: `datetime.datetime.now(datetime.UTC)`. This commit updates the usage of `utcnow()` to follow the new convention. * Adjust UTC usage to support Python 3.8 The recommended alternative for using utcnow() in the deprecation warnings emitted by Python 3.12 are not compatible with Python 3.8. The datetime.UTC alias was not added to Python until Python 3.11. To ensure that the code is compatible with Python < 3.11 this commit updates all the usage of datetime.UTC to use datetime.timezone.utc instead, which is what datetime.UTC aliases to in Python >=3.11.
* Add support for Python 3.12 Python 3.12.0 was released on 10-02-2023, this commit marks the start of support for Python 3.12 in Qiskit. It adds the supported Pythonv ersion in the package metadata and updates the CI configuration to run test jobs on Python 3.12 and build Python 3.12 wheels on release. Fixes: Qiskit/qiskit#10887 * Add release note * Avoid deprecated `datetime.datetime.utcnow()` usage In Python 3.12 `datetime.datetime.utcnow()` has been deprecated, being replaced by: `datetime.datetime.now(datetime.UTC)`. This commit updates the usage of `utcnow()` to follow the new convention. * Adjust UTC usage to support Python 3.8 The recommended alternative for using utcnow() in the deprecation warnings emitted by Python 3.12 are not compatible with Python 3.8. The datetime.UTC alias was not added to Python until Python 3.11. To ensure that the code is compatible with Python < 3.11 this commit updates all the usage of datetime.UTC to use datetime.timezone.utc instead, which is what datetime.UTC aliases to in Python >=3.11.
Summary
Python 3.12.0 was released on 10-02-2023, this commit marks the start of support for Python 3.12 in Qiskit. It adds the supported Pythonv ersion in the package metadata and updates the CI configuration to run test jobs on Python 3.12 and build Python 3.12 wheels on release.
Details and comments
Fixes: #10887