From 6efab923bf9ced40f103e8253449f33dff47b38b Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Wed, 7 May 2025 20:10:05 +0100 Subject: [PATCH 1/5] DO NOT MERGE: Test Python 3.14 --- .github/workflows/build.yml | 9 ++++++++- .github/workflows/directory_writer.yml | 3 ++- .github/workflows/project_euler.yml | 20 ++++++++++++++++++-- .github/workflows/sphinx.yml | 9 ++++++++- ciphers/gronsfeld_cipher.py | 2 +- machine_learning/xgboost_classifier.py | 2 -- maths/largest_of_very_large_numbers.py | 2 +- maths/radix2_fft.py | 4 ++-- pyproject.toml | 8 ++++++-- 9 files changed, 46 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8b83cb41c79a..c4b1d35265a9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,13 @@ 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: @@ -16,7 +23,7 @@ jobs: 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 diff --git a/.github/workflows/directory_writer.yml b/.github/workflows/directory_writer.yml index 55d89f455a25..d4b585121303 100644 --- a/.github/workflows/directory_writer.yml +++ b/.github/workflows/directory_writer.yml @@ -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 diff --git a/.github/workflows/project_euler.yml b/.github/workflows/project_euler.yml index eaf4150e4eaa..96e9c8ffa03f 100644 --- a/.github/workflows/project_euler.yml +++ b/.github/workflows/project_euler.yml @@ -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: diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml index 2010041d80c5..063e2a377f51 100644 --- a/.github/workflows/sphinx.yml +++ b/.github/workflows/sphinx.yml @@ -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 diff --git a/ciphers/gronsfeld_cipher.py b/ciphers/gronsfeld_cipher.py index 8fbeab4307fc..a72b141bd502 100644 --- a/ciphers/gronsfeld_cipher.py +++ b/ciphers/gronsfeld_cipher.py @@ -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 """ ascii_len = len(ascii_uppercase) key_len = len(key) diff --git a/machine_learning/xgboost_classifier.py b/machine_learning/xgboost_classifier.py index 1da933cf690f..e845480074b9 100644 --- a/machine_learning/xgboost_classifier.py +++ b/machine_learning/xgboost_classifier.py @@ -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. diff --git a/maths/largest_of_very_large_numbers.py b/maths/largest_of_very_large_numbers.py index edee50371e02..e38ab2edb932 100644 --- a/maths/largest_of_very_large_numbers.py +++ b/maths/largest_of_very_large_numbers.py @@ -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. diff --git a/maths/radix2_fft.py b/maths/radix2_fft.py index d41dc82d5588..d7db241afdb3 100644 --- a/maths/radix2_fft.py +++ b/maths/radix2_fft.py @@ -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)] __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): diff --git a/pyproject.toml b/pyproject.toml index c320a2f2bbfe..6830f97269a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", From ea645f0e3d77f3a9882bf0858689b2f61f2c9b3e Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 13 May 2025 09:36:48 +0200 Subject: [PATCH 2/5] pyproject.toml: cython>=3.1.0-1 --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6830f97269a6..327026885c7c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ classifiers = [ ] dependencies = [ "beautifulsoup4>=4.12.3", - "cython>=3.1.0rc2", # For lxml on Python 3.14 pre-release + "cython>=3.1.0-1", # For lxml on Python 3.14 pre-release "fake-useragent>=1.5.1", "imageio>=2.36.1", "keras>=3.7", @@ -25,7 +25,6 @@ dependencies = [ "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", From a115c87780da6bad7025afa87e98b71cca8eb67f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 13 May 2025 07:37:21 +0000 Subject: [PATCH 3/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 327026885c7c..1e0f8fd1a411 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ classifiers = [ ] dependencies = [ "beautifulsoup4>=4.12.3", - "cython>=3.1.0-1", # For lxml on Python 3.14 pre-release + "cython>=3.1.0.post1", # For lxml on Python 3.14 pre-release "fake-useragent>=1.5.1", "imageio>=2.36.1", "keras>=3.7", From e47e600ac676b6e9a449d6895fdef7de70a043ef Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 13 May 2025 09:42:22 +0200 Subject: [PATCH 4/5] pyproject.toml: cython>=3.1.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1e0f8fd1a411..d5713ebfc63a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ classifiers = [ ] dependencies = [ "beautifulsoup4>=4.12.3", - "cython>=3.1.0.post1", # For lxml on Python 3.14 pre-release + "cython>=3.1.0", # For lxml on Python 3.14 pre-release "fake-useragent>=1.5.1", "imageio>=2.36.1", "keras>=3.7", From 6e07abfe3c6dd70747b9b6cbfe1c4fd6da97d6db Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 13 May 2025 07:43:08 +0000 Subject: [PATCH 5/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d5713ebfc63a..129a7736d605 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ classifiers = [ ] dependencies = [ "beautifulsoup4>=4.12.3", - "cython>=3.1.0", # For lxml on Python 3.14 pre-release + "cython>=3.1", # For lxml on Python 3.14 pre-release "fake-useragent>=1.5.1", "imageio>=2.36.1", "keras>=3.7",