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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,21 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- run:
sudo apt-get update && sudo apt-get install -y libtiff5-dev libjpeg8-dev libopenjp2-7-dev
zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk
libharfbuzz-dev libfribidi-dev libxcb1-dev
libxml2-dev libxslt-dev
libhdf5-dev
libopenblas-dev
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
cache-dependency-glob: uv.lock
- uses: actions/setup-python@v5
with:
python-version: 3.13
python-version: 3.14
allow-prereleases: true
- run: uv sync --group=test
- name: Run tests
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/directory_writer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: 3.x
python-version: 3.14
allow-prereleases: true
- name: Write DIRECTORY.md
run: |
scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/project_euler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,37 @@ jobs:
project-euler:
runs-on: ubuntu-latest
steps:
- run:
sudo apt-get update && sudo apt-get install -y libtiff5-dev libjpeg8-dev libopenjp2-7-dev
zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk
libharfbuzz-dev libfribidi-dev libxcb1-dev
libxml2-dev libxslt-dev
libhdf5-dev
libopenblas-dev
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
- uses: actions/setup-python@v5
with:
python-version: 3.x
python-version: 3.14
allow-prereleases: true
- run: uv sync --group=euler-validate --group=test
- run: uv run pytest --doctest-modules --cov-report=term-missing:skip-covered --cov=project_euler/ project_euler/
validate-solutions:
runs-on: ubuntu-latest
steps:
- run:
sudo apt-get update && sudo apt-get install -y libtiff5-dev libjpeg8-dev libopenjp2-7-dev
zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk
libharfbuzz-dev libfribidi-dev libxcb1-dev
libxml2-dev libxslt-dev
libhdf5-dev
libopenblas-dev
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
- uses: actions/setup-python@v5
with:
python-version: 3.x
python-version: 3.14
allow-prereleases: true
- run: uv sync --group=euler-validate --group=test
- run: uv run pytest scripts/validate_solutions.py
env:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,18 @@ jobs:
build_docs:
runs-on: ubuntu-24.04-arm
steps:
- run:
sudo apt-get update && sudo apt-get install -y libtiff5-dev libjpeg8-dev libopenjp2-7-dev
zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk
libharfbuzz-dev libfribidi-dev libxcb1-dev
libxml2-dev libxslt-dev
libhdf5-dev
libopenblas-dev
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
- uses: actions/setup-python@v5
with:
python-version: 3.13
python-version: 3.14
allow-prereleases: true
- run: uv sync --group=docs
- uses: actions/configure-pages@v5
Expand Down
20 changes: 11 additions & 9 deletions DIRECTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

* [Burrows Wheeler](compression/burrows_wheeler.py)
* [Huffman](compression/huffman.py)
* [Lempel Ziv](compression/lempel_ziv.py)
* [Lempel Ziv Decompress](compression/lempel_ziv_decompress.py)
* [Lz77](compression/lz77.py)
* [Peak Signal To Noise Ratio](compression/peak_signal_to_noise_ratio.py)
* [Run Length Encoding](compression/run_length_encoding.py)

## Computer Vision
* [Cnn Classification](computer_vision/cnn_classification.py)
* [Flip Augmentation](computer_vision/flip_augmentation.py)
Expand Down Expand Up @@ -181,6 +172,15 @@
* [Volume Conversions](conversions/volume_conversions.py)
* [Weight Conversion](conversions/weight_conversion.py)

## Data Compression
* [Burrows Wheeler](data_compression/burrows_wheeler.py)
* [Huffman](data_compression/huffman.py)
* [Lempel Ziv](data_compression/lempel_ziv.py)
* [Lempel Ziv Decompress](data_compression/lempel_ziv_decompress.py)
* [Lz77](data_compression/lz77.py)
* [Peak Signal To Noise Ratio](data_compression/peak_signal_to_noise_ratio.py)
* [Run Length Encoding](data_compression/run_length_encoding.py)

## Data Structures
* Arrays
* [Equilibrium Index In Array](data_structures/arrays/equilibrium_index_in_array.py)
Expand Down Expand Up @@ -1202,6 +1202,8 @@
* [Sol1](project_euler/problem_234/sol1.py)
* Problem 301
* [Sol1](project_euler/problem_301/sol1.py)
* Problem 345
* [Sol1](project_euler/problem_345/sol1.py)
* Problem 493
* [Sol1](project_euler/problem_493/sol1.py)
* Problem 551
Expand Down
2 changes: 1 addition & 1 deletion ciphers/gronsfeld_cipher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

"""
ascii_len = len(ascii_uppercase)
key_len = len(key)
Expand Down
Empty file removed compression/image_data/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions machine_learning/xgboost_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ def xgboost(features: np.ndarray, target: np.ndarray) -> XGBClassifier:

def main() -> None:
"""
>>> main()

Url for the algorithm:
https://xgboost.readthedocs.io/en/stable/
Iris type dataset is used to demonstrate algorithm.
Expand Down
2 changes: 1 addition & 1 deletion maths/largest_of_very_large_numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
if 0 not in (x, y):
# We use the relation x^y = y*log10(x), where 10 is the base.
Expand Down
4 changes: 2 additions & 2 deletions maths/radix2_fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ 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?


__str__ test
>>> print(x)
A = 0*x^0 + 1*x^1 + 2*x^0 + 3*x^2
B = 0*x^2 + 1*x^3 + 2*x^4
A*B = 0*x^(-0+0j) + 1*x^(2+0j) + 2*x^(3+0j) + 3*x^(8+0j) + 4*x^(6+0j) + 5*x^(8+0j)
A*B = 0*x^(-0-0j) + 1*x^(2+0j) + 2*x^(3-0j) + 3*x^(8-0j) + 4*x^(6+0j) + 5*x^(8+0j)
"""

def __init__(self, poly_a=None, poly_b=None):
Expand Down
10 changes: 7 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ classifiers = [
]
dependencies = [
"beautifulsoup4>=4.12.3",
"cython>=3.1.0rc2", # For lxml on Python 3.14 pre-release
"fake-useragent>=1.5.1",
"imageio>=2.36.1",
"keras>=3.7",
"lxml>=5.3",
# "lxml>=5.4",
"lxml @ git+https://github.com/lxml/lxml",
"matplotlib>=3.9.3",
"numpy>=2.1.3",
"opencv-python>=4.10.0.84",
"pandas>=2.2.3",
"pillow>=11",
# "pillow>=11",
"pillow @ git+https://github.com/python-pillow/pillow",
"requests>=2.32.3",
"rich>=13.9.4",
"scikit-learn>=1.5.2",
"setuptools",
"sphinx-pyproject>=0.3",
"statsmodels>=0.14.4",
"sympy>=1.13.3",
Expand Down Expand Up @@ -187,9 +191,9 @@ autoapi_dirs = [
"boolean_algebra",
"cellular_automata",
"ciphers",
"compression",
"computer_vision",
"conversions",
"data_compression",
"data_structures",
"digital_image_processing",
"divide_and_conquer",
Expand Down