Skip to content
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

Merged
merged 8 commits into from Nov 23, 2023
Merged

Add support for Python 3.12 #11262

merged 8 commits into from Nov 23, 2023

Conversation

mtreinish
Copy link
Member

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

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
@mtreinish mtreinish added the Changelog: New Feature Include in the "Added" section of the changelog label Nov 16, 2023
@mtreinish mtreinish requested a review from a team as a code owner November 16, 2023 23:10
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core

@coveralls
Copy link

coveralls commented Nov 16, 2023

Pull Request Test Coverage Report for Build 6947252053

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 86.453%

Totals Coverage Status
Change from base Build 6946496347: 0.01%
Covered Lines: 66281
Relevant Lines: 76667

💛 - Coveralls

@mtreinish mtreinish added the stable backport potential The bug might be minimal and/or import enough to be port to stable label Nov 17, 2023
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.
@mtreinish mtreinish added this to the 0.45.1 milestone Nov 17, 2023
@mtreinish
Copy link
Member Author

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.

jakelishman
jakelishman previously approved these changes Nov 17, 2023
Copy link
Member

@jakelishman jakelishman left a 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),
Copy link
Member

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.

@mtreinish
Copy link
Member Author

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.

@jakelishman
Copy link
Member

Unblocked by the merge of #11307.

@jakelishman jakelishman added this pull request to the merge queue Nov 23, 2023
Merged via the queue into Qiskit:main with commit 5a5c9e3 Nov 23, 2023
14 checks passed
mergify bot pushed a commit that referenced this pull request Nov 23, 2023
* 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
jakelishman pushed a commit that referenced this pull request Nov 23, 2023
* 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)
github-merge-queue bot pushed a commit that referenced this pull request Nov 23, 2023
* 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>
FabianBrings pushed a commit to FabianBrings/qiskit that referenced this pull request Nov 27, 2023
* 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.
ElePT pushed a commit to ElePT/qiskit-ibm-runtime that referenced this pull request Dec 8, 2023
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the "Added" section of the changelog stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for Python 3.12
4 participants