* ci: try Python 3.15 release candidate (DRAFT)
Point the repo's .python-version at 3.15 so every workflow that reads
python-version-file runs on the 3.15 release candidate (allow-prereleases
is already enabled across all workflows). Add the 3.15 trove classifier
and bump scipy>=1.18.1, which is the first scipy with cp315 manylinux
wheels, so uv installs it as a wheel rather than building from source.
Rebuilt on current master: the earlier version of this PR edited the
per-workflow `python-version: 3.14` lines, but master has since moved
the interpreter to a single `.python-version` file, so the change is now
a one-line switch there.
Purpose is to document which dependencies/tests are not yet 3.15-ready.
Must stay DRAFT until Python 3.15 GA (early October). Requested in #15081.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Upgrade to Python 3.15t
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Per discussion in #15418, these four files are not algorithms (they are
how-to-use scripts wrapping a deep-learning framework) and dragged in the
heavy keras/tensorflow dependency stack:
- computer_vision/cnn_classification.py
- dynamic_programming/k_means_clustering_tensorflow.py
- machine_learning/lstm/lstm_prediction.py
- neural_network/input_data.py (TF MNIST data loader; nothing imports it)
Also removes the now-orphaned machine_learning/lstm/ package (only
__init__.py + sample_data.csv, which served lstm_prediction.py).
Cleanups:
- Drop keras from pyproject.toml dependencies; regenerate uv.lock
(removes absl-py, h5py, keras, ml-dtypes, namex, optree).
- Remove the pre-release libhdf5-dev install step from build.yml and
sphinx.yml (it existed only because keras needs hdf5).
- Drop the four stale pytest --ignore entries in build.yml.
- Remove the four DIRECTORY.md entries and the empty Lstm heading.
Polars only ships cp310-abi3 wheels, which are not loadable under the
free-threaded CPython the repo targets (.python-version = 3.14t). uv
therefore builds the ~3 MB Rust sdist from source on every uv.lock
change, making CI builds very slow. Upstream (pola-rs/polars#27955)
is not yet ready to publish free-threaded wheels.
Remove polars from pyproject.toml and relock (uv sync --upgrade && uv lock).
No source files import polars, so nothing else changes.
* Fix arg for print_dist function
* Add doctests to dijkstra_2.py
* Add polars dependency to pyproject.toml
---------
Co-authored-by: Christian Clauss <cclauss@me.com>
* ty: un-ignore invalid-type-form
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Apply batched suggestions from code review
Co-authored-by: Christian Clauss <cclauss@me.com>
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Land the non-3.15t-gated pieces of #15105 ahead of GA:
- build.yml/sphinx.yml: install libhdf5-dev only when running a pre-release
interpreter (keras needs hdf5 there); guarded so it is a no-op on final builds.
- pyproject.toml: pin scikit-learn>=1.9.1, the first release with cp315t
free-threaded wheels, so uv resolves a wheel instead of building from source.
The .python-version bump to 3.15t stays in #15105 as a draft until 3.15 GA.
* Fix ty invalid assignment diagnostics
* updating DIRECTORY.md
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix unused typing import
* Fix gradient accumulation type handling
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix automatic differentiation gradient dtype handling
---------
Co-authored-by: kadubhumika <kadubhumika@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Drop machine_learning/xgboost_classifier.py and
machine_learning/xgboost_regressor.py. Both were thin "how-to-use"
wrappers around sklearn's XGBClassifier/XGBRegressor rather than
from-scratch implementations, and the classifier's only doctest was
already disabled (# THIS TEST IS BROKEN!!), so it was never exercised
in CI.
xgboost is one of the heaviest compiled dependencies in the tree (large
wheel, needs OpenMP/libgomp at runtime, no free-threaded wheel yet), and
gradient boosting is already implemented from scratch in
machine_learning/gradient_boosting_classifier.py and
gradient_boosting_regressor.py, so no algorithm coverage is lost.
Removes the xgboost dependency from pyproject.toml, its (and its
xgboost-only transitive dep nvidia-nccl-cu13) entries from uv.lock, and
the two DIRECTORY.md links.
Refs #15081
* deps: migrate from httpx to httpx2 (pydantic's maintained fork)
Mechanical rename of httpx -> httpx2 (API-compatible fork of httpx 0.28.1):
pyproject.toml deps, PEP 723 inline-script headers, and all import/call sites.
Excludes uv.lock (the keeper's allow-list rejects .lock files); the lock
refresh needs a separate maintainer-merged PR.
Refs #15081
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* deps: drop tweepy + migrate remaining requests refs to httpx2
- maths/allocation_number.py: docstring example uses httpx2, not requests
- web_programming/get_imdbtop.py.DISABLED: import httpx2 instead of requests
- remove web_programming/get_user_tweets.py.DISABLED (a Twitter API how-to,
not an algorithm) and drop the tweepy dependency that was its only user and
the last high-level dep pulling in requests
- uv.lock intentionally untouched (keeper allow-list)
Refs #15081
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* ci: add informational (non-blocking) ty type-check job
* ci: pin ty environment python-version to 3.14
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* pyproject.toml: Ignore some ty rules
* Refactor ty.yml for dependency installation and checks
Updated ty.yml to install test dependencies and modify ty check command.
* Add virtual environment setup to workflow
* ci(ty): install deps with 'uv sync' instead of 'uv pip install .'
The previous 'uv pip install ".[test]"' step failed because this repo is a
flat-layout collection of algorithms, not an installable package: setuptools'
legacy backend errors with 'Multiple top-level packages discovered in a
flat-layout'. Rather than restructuring into a src-layout, mirror the existing
'build' job and use 'uv sync' -- pyproject.toml has no [build-system], so uv
treats the project as virtual and installs only its dependencies. Pin a regular
GIL 3.14 so typed third-party deps resolve, and pull ty in ephemerally with
'uv run --with ty' so it needn't touch the lockfile. Also drop the stray
per-step 'source .venv/bin/activate' (each run: is its own shell, so it was a
no-op). Job stays continue-on-error (informational).
* ci(ty): keep the advisory job green with inline annotations
ty emits ::error annotations via --output-format=github; those render on
the PR diff regardless of the step's exit code. Add '|| true' so the check
stays green (it's informational, not a gate) while findings remain visible
as inline annotations -- avoids a permanent red X on every commit. Remove
'|| true' and continue-on-error to promote ty to a required gate later.
* ci(ty): keep ty's real exit status (drop || true), rely on continue-on-error for non-blocking
* ci(ty): pin the ty run to regular 3.14 and use native --exit-zero
The ty step ran 'uv run --with ty' without --python, so uv re-resolved the
project default (free-threaded 3.14t), where many third-party stubs don't
resolve -- that env-resolution failure, not real type errors, produced the
unresolved-import/unresolved-attribute noise and masked whether [tool.ty.rules]
severities apply. Pin the run to regular 3.14 so ty sees the synced deps.
Replace the continue-on-error/real-status juggling with ty's native --exit-zero
(the analog of 'ruff check --exit-zero'): always exit 0 while --output-format=github
still surfaces findings as inline annotations. continue-on-error stays only as a
crash guard. Documents the --exit-zero -> --exit-zero-on-warning -> gate path.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* build: upgrade scikit-learn>=1.9.0 and scipy>=1.18.1 specifiers
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* ci: switch default Python to free-threaded 3.14t
Change the interpreter used across CI workflows from 3.14 to the
free-threaded build 3.14t to surface which dependencies and tests are
not yet free-threading compatible. Opened as DRAFT for documentation
purposes per maintainer request (#15081).
* ci(3.14t): gate opencv-python into optional 'cv' group + skip cv2 files
opencv-python has no cp314t wheel yet and fails to build from source under
free-threaded 3.14t (CMake), blocking uv sync for every job. Move it to an
optional [dependency-groups] cv group so the ft CI installs everything else
and runs pytest-run-parallel on the pure-Python algorithms. Skip the 20 files
that import cv2 (computer_vision augmentations, data_compression PSNR, and the
mostly-cv2 digital_image_processing/ tree). Re-fold once a cp314t wheel ships
(upstream: opencv/opencv#27933).
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* ci(3.14t): add --ignore-gil-enabled so sklearn/xgboost imports don't abort the run
* ci(3.14t): gate qiskit into an optional group like opencv
qiskit re-enables the GIL under free-threaded CPython and the team is still scoping free-threading support (Qiskit/qiskit#16893), so move it out of the core deps into an optional 'quantum' group and ignore the one algorithm that imports it (quantum/q_fourier_transform.py) in the 3.14t test run. Mirrors the existing opencv 'cv' carve-out. Per cclauss: default all workflows to 3.14t except tests depending on OpenCV or Qiskit.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* ci: single-source 3.14t via .python-version; declare Free Threading :: 2 - Beta
Un-ignore .python-version and pin it to 3.14t, then point all four
workflows at python-version-file: .python-version so the free-threaded
interpreter is selected from one place. Also add the
'Programming Language :: Python :: Free Threading :: 2 - Beta' trove
classifier to document our free-threaded support status per
https://py-free-threading.github.io/porting/#define-and-document-thread-safety-guarantees
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* docs: configure Sphinx directly and drop unmaintained sphinx-pyproject
sphinx-pyproject has no releases supporting Python 3.14/3.15 and pins an
old Sphinx, which blocks the docs build on newer interpreters. Move the
[tool.sphinx-pyproject] config into a plain docs/conf.py (project name,
version and authors single-sourced from pyproject.toml via stdlib
tomllib), drop the sphinx-pyproject dependency, and depend on sphinx>=8.2
directly. Also bump beautifulsoup4>=4.15 and pandas>=2.3.3.
No changes to uv.lock.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* quantum: modernize QFT to Qiskit 2.x + re-enable its test
quantum/q_fourier_transform.py used the Aer and execute symbols that were
removed from qiskit in the 1.0 API break, so it could never run and was on
the pytest --ignore list. Port it to the current API:
- Drop 'from qiskit import Aer, execute'. Build the circuit unchanged, then
simulate with the pure-Python BasicSimulator via transpile() + backend.run(),
so no compiled qiskit-aer backend is needed (qiskit-aer has no Python 3.14
wheels yet; BasicSimulator ships inside qiskit core).
- Seed the run (seed_simulator=42) and rewrite the doctest to assert the
reproducible, shot-noise-independent facts (the four outcomes appear and the
counts sum to the shot total) instead of exact per-state counts, which random
sampling can never hit.
- Add 'qiskit>=2' to project dependencies and drop the quantum ignore + the
stale '# TODO: #8818 Re-enable quantum tests' comment in build.yml.
Draft until CI confirms qiskit installs and imports on the repo's Python 3.14.
* Update quantum/q_fourier_transform.py
---------
Co-authored-by: Christian Clauss <cclauss@me.com>
* Fix typo in spheres intersection print statement
* Fix typo in CONTRIBUTING.md
* Improve comments in comb_sort.py
* pyproject.toml: tool.ruff.target-version = "py314"
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix comment formatting in lint.ignore section
---------
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* pre-commit autoupdate 2025-09-11
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* updating DIRECTORY.md
* Fix some RUF012 per file ignores
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix
* Fix
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix
* Improve
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Improve
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Use Astral uv
* uvx vs uv run
* uv sync --group=euler-validate,test
* uv sync --group=euler-validate --group=test
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* --group=test
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* updating DIRECTORY.md
* Fix some SIM114 per file ignores
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix review issue
---------
Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>