Skip to content

DO NOT MERGE: Test Python 3.14 #12710

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

DO NOT MERGE: Test Python 3.14 #12710

wants to merge 1 commit into from

Conversation

cclauss
Copy link
Member

@cclauss cclauss commented May 7, 2025

Describe your change:

  • Test Python 3.14
  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request.
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".
@algorithms-keeper algorithms-keeper bot added awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass and removed tests are failing Do not merge until tests pass labels May 7, 2025
@cclauss cclauss force-pushed the Python-3.14 branch 3 times, most recently from db60e7e to bf69518 Compare May 8, 2025 14:28
@algorithms-keeper algorithms-keeper bot removed the tests are failing Do not merge until tests pass label May 8, 2025
@algorithms-keeper algorithms-keeper bot added the tests are failing Do not merge until tests pass label May 8, 2025
@cclauss cclauss force-pushed the Python-3.14 branch 2 times, most recently from a3721b9 to 5464999 Compare May 8, 2025 16:44
@@ -128,15 +128,6 @@
* [Vigenere Cipher](ciphers/vigenere_cipher.py)
* [Xor Cipher](ciphers/xor_cipher.py)

## Compression
Copy link
Member Author

Choose a reason for hiding this comment

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

Rename Compression --> Data Compression to avoid name collision.

https://docs.python.org/3.14/whatsnew/3.14.html#pep-784-adding-zstandard-to-the-standard-library

@@ -20,7 +20,7 @@ def gronsfeld(text: str, key: str) -> str:
>>> gronsfeld('yes, ¥€$ - _!@#%?', '')
Traceback (most recent call last):
...
ZeroDivisionError: integer modulo by zero
ZeroDivisionError: division by zero
Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -15,7 +15,7 @@ def res(x, y):
>>> res(-1, 5)
Traceback (most recent call last):
...
ValueError: math domain error
ValueError: expected a positive input, got -1
Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -40,7 +40,7 @@ class FFT:

Print product
>>> x.product # 2x + 3x^2 + 8x^3 + 4x^4 + 6x^5
[(-0+0j), (2+0j), (3+0j), (8+0j), (6+0j), (8+0j)]
[(-0-0j), (2+0j), (3-0j), (8-0j), (6+0j), (8+0j)]
Copy link
Member Author

@cclauss cclauss May 8, 2025

Choose a reason for hiding this comment

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

CAREFUL REVIEW PLEASE!

I cannot explain the required changes to maths/radix2_fft.py

@KirilBangachev Are you able to help us understand why Python 3.14 pre-release is returning different test results than Python < 3.14?

@algorithms-keeper algorithms-keeper bot removed the tests are failing Do not merge until tests pass label May 8, 2025
@cclauss
Copy link
Member Author

cclauss commented May 9, 2025

@hugovk congratulations on the compatibility of Python 3.14 beta. This repo contains tested Python algorithms spanning lots of domains and third-party libraries from a huge variety of contributors. We always test and run on the current version of CPython and when each beta 1 release ships I port to it making any required changes.

Of all the upgrades that I have done, Python v3.14 is by far the cleanest and simplest!! Third party tools like SciPy, Pillow, and H5py all seem ready to go. This has never been the case before so I suspect that you have been doing a lot of behind-the-scenes work to ensure everyone is ready for a great release.

We needed to rename our compression directory and change the text of a few exceptions but these were trivial changes. Radix2_fft.py requires changes that I cannot understand but for an initial beta, I am very impressed.

Thanks and congratulations 🎉🎈🍾

@hugovk
Copy link

hugovk commented May 9, 2025

Good to hear, thank you! And thank you for the early testing :)

Of all the upgrades that I have done, Python v3.14 is by far the cleanest and simplest!! Third party tools like SciPy, Pillow, and H5py all seem ready to go. This has never been the case before so I suspect that you have been doing a lot of behind-the-scenes work to ensure everyone is ready for a great release.

Personally I've only been involved with Pillow, but I suspect much of it is down to the excellent work done by the Quansight team helping projects get ready for free-threading, which overlaps getting ready for 3.14. cc @ngoldbaum @lysnikolaou

https://labs.quansight.org/blog/free-threaded-python-rollout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reviews This PR is ready to be reviewed
2 participants