Skip to content

Add Python 3.13 as supported #225

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

Merged
merged 2 commits into from
Mar 19, 2025

Conversation

woodsp-ibm
Copy link
Member

@woodsp-ibm woodsp-ibm commented Mar 17, 2025

Summary

Add support for Python 3.13

Details and comments

At present I expect this to failed in the same way qiskit-community/qiskit-machine-learning#836 is currently in this equivalent test here that was copied to "test.optimizers.test_gradient_descent.TestGradientDescent.test_start" when it tests a couple of dataclass equalities. I have a fix that works for me locally, see this comment in the above PR qiskit-community/qiskit-machine-learning#836 (comment) but I just wanted to see it failing in CI too before applying it just to make sure.


Will need branch rules updating for this change once its ok/approved.

@woodsp-ibm
Copy link
Member Author

Indeed it fails under 3.13 in CI as expected as below

test.optimizers.test_gradient_descent.TestGradientDescent.test_start
--------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):

      File "/Users/runner/work/qiskit-algorithms/qiskit-algorithms/test/optimizers/test_gradient_descent.py", line 135, in test_start
    self.assertEqual(test_state, optimizer.state)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

      File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/unittest/case.py", line 907, in assertEqual
    assertion_func(first, second, msg=msg)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^

      File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/unittest/case.py", line 897, in _baseAssertEqual
    if not first == second:
           ^^^^^^^^^^^^^^^

      File "<string>", line 18, in __eq__

    ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Will add the fixes, which is basically custom eq methods, rather than the autogenerated ones, on the dataclasses in question

@coveralls
Copy link

Pull Request Test Coverage Report for Build 13902685239

Details

  • 4 of 4 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.003%) to 90.477%

Totals Coverage Status
Change from base Build 13900902629: 0.003%
Covered Lines: 6394
Relevant Lines: 7067

💛 - Coveralls

Copy link
Collaborator

@ElePT ElePT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@woodsp-ibm
Copy link
Member Author

Thx, I updated the branch rules for this 3.13 change.

@woodsp-ibm woodsp-ibm merged commit ca48697 into qiskit-community:main Mar 19, 2025
16 of 18 checks passed
@woodsp-ibm woodsp-ibm deleted the py_3.13_add branch March 19, 2025 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants