Files
Python/pyproject.toml
priya-sundaram-devpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Christian Clauss
78e489f5dd CI: Upgrade to free-threaded Python 3.15t (#15105)
* 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>
2026-09-26 18:06:56 +02:00

359 lines
13 KiB
TOML

[project]
name = "thealgorithms-python"
version = "0.0.1"
description = "TheAlgorithms in Python"
authors = [ { name = "TheAlgorithms Contributors" } ]
requires-python = ">=3.15"
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.15",
"Programming Language :: Python :: Free Threading :: 2 - Beta",
]
dependencies = [
"beautifulsoup4>=4.15",
"cython>=3.1.2",
"fake-useragent>=1.5.1",
"httpx2>=2.0.1",
"imageio>=2.36.1",
"lxml>=6",
"matplotlib>=3.9.3",
"numpy>=2.1.3",
"pandas>=2.3.3",
"pillow>=11.3",
"rich>=13.9.4",
"scikit-learn>=1.9.1",
"scipy>=1.18.1",
"statsmodels>=0.14.4",
"sympy>=1.13.3",
"typing-extensions>=4.12.2",
]
[dependency-groups]
test = [
"pytest>=8.4.1",
"pytest-cov>=6",
]
docs = [
"myst-parser>=4",
"sphinx>=8.2",
"sphinx-autoapi>=3.4",
]
# opencv-python has no free-threaded (cp315t) wheel yet and fails to build from
# source under 3.15t (CMake), which blocks `uv sync` for every job. Keep it in an
# optional group so the free-threaded CI can install everything else and actually
# run pytest-run-parallel on the pure-Python algorithms. Re-fold into core deps
# once a cp315t wheel ships (upstream: opencv/opencv#27933).
cv = [
"opencv-python>=4.10.0.84",
]
euler-validate = [
"httpx2>=2.0.1",
"numpy>=2.1.3",
]
[tool.ruff]
target-version = "py315"
output-format = "full"
lint.select = [
# https://docs.astral.sh/ruff/rules
"A", # flake8-builtins
"ANN", # flake8-annotations
"ARG", # flake8-unused-arguments
"ASYNC", # flake8-async
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C4", # flake8-comprehensions
"C90", # McCabe cyclomatic complexity
"DJ", # flake8-django
"DTZ", # flake8-datetimez
"E", # pycodestyle
"EM", # flake8-errmsg
"EXE", # flake8-executable
"F", # Pyflakes
"FA", # flake8-future-annotations
"FLY", # flynt
"G", # flake8-logging-format
"I", # isort
"ICN", # flake8-import-conventions
"INP", # flake8-no-pep420
"INT", # flake8-gettext
"ISC", # flake8-implicit-str-concat
"N", # pep8-naming
"NPY", # NumPy-specific rules
"PD", # pandas-vet
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # Pylint
"PT", # flake8-pytest-style
"PYI", # flake8-pyi
"Q", # flake8-quotes
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # Ruff-specific rules
"S", # flake8-bandit
"SIM", # flake8-simplify
"SLF", # flake8-self
"T10", # flake8-debugger
"TD", # flake8-todos
"TID", # flake8-tidy-imports
"UP", # pyupgrade
"W", # pycodestyle
"YTT", # flake8-2020
# "COM", # flake8-commas -- DO NOT FIX
# "D", # pydocstyle -- FIX ME?
# "ERA", # eradicate -- DO NOT FIX
# "FBT", # flake8-boolean-trap # FIX ME
# "PTH", # flake8-use-pathlib # FIX ME
# "T20", # flake8-print
# "TCH", # flake8-type-checking
# "TRY", # tryceratops
]
lint.ignore = [
# `ruff rule S101` for a description of that rule
"B904", # Within an `except` clause, raise exceptions with `raise ... from err` -- FIX ME
"B905", # `zip()` without an explicit `strict=` parameter -- FIX ME
"EM101", # Exception must not use a string literal, assign to a variable first
"EXE001", # Shebang is present but file is not executable -- DO NOT FIX
"G004", # Logging statement uses f-string
"ISC001", # Conflicts with ruff format -- DO NOT FIX
"PLC0415", # import-outside-top-level -- DO NOT FIX
"PLC1901", # `{}` can be simplified to `{}` as an empty string is falsey
"PLW060", # Using global for `{name}` but no assignment is done -- DO NOT FIX
"PLW1641", # eq-without-hash
"PLW2901", # PLW2901: Redefined loop variable -- FIX ME
"PT011", # `pytest.raises(Exception)` is too broad, set the `match` parameter or use a more specific exception
"PT018", # Assertion should be broken down into multiple parts
"PT028", # pytest-parameter-with-default-argument
"RET504", # unnecessary-assign -- FIX ME
"RET505", # superfluous-else-return -- FIX ME
"S101", # Use of `assert` detected -- DO NOT FIX
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes -- FIX ME
"SIM905", # Consider using a list literal instead of `str.split` -- DO NOT FIX
"SLF001", # Private member accessed: `_Iterator` -- FIX ME
"UP037", # FIX ME
]
lint.per-file-ignores."data_structures/*" = [
"ANN001", # Missing type annotation for function argument
"ANN201", # Missing return type annotation for public function
"ANN202", # Missing return type annotation for private function
"ANN204", # Missing return type annotation for special method
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
]
lint.per-file-ignores."data_structures/binary_tree/binary_search_tree.py" = [
"ANN002", # Missing type annotation for `*values`
]
lint.per-file-ignores."data_structures/hash*" = [
"ANN002", # Missing type annotation for `*args`
"ANN003", # Missing type annotation for `**kwargs`
]
lint.per-file-ignores."data_structures/hashing/tests/test_hash_map.py" = [
"BLE001",
]
lint.per-file-ignores."digital_image_processing/*" = [
"ANN001", # Missing type annotation for function argument
"ANN201", # Missing return type annotation for public function
"ANN202", # Missing return type annotation for private function
]
lint.per-file-ignores."divide_and_conquer/*" = [
"ANN001", # Missing type annotation for function argument
"ANN201", # Missing return type annotation for public function
"ANN202", # Missing return type annotation for private function
]
lint.per-file-ignores."dynamic_programming/*" = [
"ANN001", # Missing type annotation for function argument
"ANN201", # Missing return type annotation for public function
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
]
lint.per-file-ignores."dynamic_programming/rod_cutting.py" = [
"ANN202", # Missing return type annotation for private function
]
lint.per-file-ignores."file_transfer/tests/test_send_file.py" = [
"ANN001", # Missing type annotation for function argument
]
lint.per-file-ignores."fractals/julia_sets.py" = [
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
]
lint.per-file-ignores."fractals/vicsek.py" = [
"ANN001", # Missing type annotation for function argument
]
lint.per-file-ignores."fuzzy_logic/fuzzy_operations.py" = [
"ANN001", # Missing type annotation for function argument
]
lint.per-file-ignores."graphs/*" = [
"ANN001", # Missing type annotation for function argument
"ANN201", # Missing return type annotation for public function
"ANN202", # Missing return type annotation for private function
]
lint.per-file-ignores."greedy_methods/fractional_knapsack.py" = [
"ANN001", # Missing type annotation for function argument
"ANN201", # Missing return type annotation for public function
]
lint.per-file-ignores."hashes/*" = [
"ANN001", # Missing type annotation for function argument
"ANN201", # Missing return type annotation for public function
]
lint.per-file-ignores."hashes/enigma_machine.py" = [
"BLE001",
]
lint.per-file-ignores."knapsack/knapsack.py" = [
"ANN001", # Missing type annotation for function argument
]
lint.per-file-ignores."linear_algebra/src/*" = [
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
]
lint.per-file-ignores."machine_learning/*" = [
"ANN001", # Missing type annotation for function argument
"ANN201", # Missing return type annotation for public function
"ANN202", # Missing return type annotation for private function
]
lint.per-file-ignores."machine_learning/automatic_differentiation.py" = [
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
]
lint.per-file-ignores."machine_learning/sequential_minimum_optimization.py" = [
"ANN002", # Missing type annotation for `*args`
"ANN003", # Missing type annotation for `**kwargs`
"ANN204", # Missing return type annotation for special method
"SIM115",
]
lint.per-file-ignores."maths/*" = [
"ANN001", # Missing type annotation for function argument
"ANN201", # Missing return type annotation for public function
]
lint.per-file-ignores."maths/dual_number_automatic_differentiation.py" = [
"ANN204", # Missing return type annotation for special method
]
lint.per-file-ignores."maths/fibonacci.py" = [
"ANN002", # Missing type annotation for `*args`
"ANN003", # Missing type annotation for `**kwargs`
]
lint.per-file-ignores."maths/radix2_fft.py" = [
"ANN202", # Missing return type annotation for private function
]
lint.per-file-ignores."matrix/matrix_operation.py" = [
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
]
lint.per-file-ignores."matrix/sherman_morrison.py" = [
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
"SIM103",
]
lint.per-file-ignores."matrix/tests/test_matrix_operation.py" = [
"ANN001", # Missing type annotation for function argument
]
lint.per-file-ignores."neural_network/activation_functions/rectified_linear_unit.py" = [
"ANN201", # Missing return type annotation for public function
]
lint.per-file-ignores."neural_network/back_propagation_neural_network.py" = [
"ANN001", # Missing type annotation for function argument
"ANN201", # Missing return type annotation for public function
]
lint.per-file-ignores."neural_network/convolution_neural_network.py" = [
"ANN001", # Missing type annotation for function argument
"ANN201", # Missing return type annotation for public function
"ANN202", # Missing return type annotation for private function
]
lint.per-file-ignores."other/*" = [
"ANN001", # Missing type annotation for function argument
"ANN201", # Missing return type annotation for public function
]
lint.per-file-ignores."other/bankers_algorithm.py" = [
"ANN003", # Missing type annotation for `**kwargs`
]
lint.per-file-ignores."other/pipeline.py" = [
"ANN401",
]
lint.per-file-ignores."physics/newtons_second_law_of_motion.py" = [
"BLE001",
]
lint.per-file-ignores."project_euler/*" = [
"ANN001", # Missing type annotation for function argument
"ANN201", # Missing return type annotation for public function
]
lint.per-file-ignores."project_euler/problem_099/sol1.py" = [
"SIM115",
]
lint.per-file-ignores."searches/*" = [
"ANN001", # Missing type annotation for function argument
"ANN201", # Missing return type annotation for public function
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
]
lint.per-file-ignores."sorts/*" = [
"ANN001", # Missing type annotation for function argument
"ANN201", # Missing return type annotation for public function
"ANN202", # Missing return type annotation for private function
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
]
lint.per-file-ignores."sorts/external_sort.py" = [
"SIM115",
]
lint.per-file-ignores."tests/test_sorts.py" = [
"ANN001", # Missing type annotation for function argument
]
lint.per-file-ignores."web_programming/*" = [
"ANN001", # Missing type annotation for function argument
]
lint.mccabe.max-complexity = 17 # default: 10
lint.pylint.allow-magic-value-types = [
"float",
"int",
"str",
]
lint.pylint.max-args = 10 # default: 5
lint.pylint.max-branches = 20 # default: 12
lint.pylint.max-returns = 8 # default: 6
lint.pylint.max-statements = 88 # default: 50
[tool.codespell]
ignore-words-list = """\
3rt,abd,aer,ans,bitap,crate,damon,fo,followings,hist,iff,kwanza,manuel,mater,secant,som,sur,tim,toi,zar\
"""
skip = """\
./.*,*.json,*.lock,ciphers/prehistoric_men.txt,project_euler/problem_022/p022_names.txt,pyproject.toml,strings/dictio\
nary.txt,strings/words.txt\
"""
[tool.ty]
# Type-check against a regular (GIL) 3.15 interpreter. Pinning this keeps ty's
# assumptions consistent with the CI job in .github/workflows/ty.yml, where the
# free-threaded 3.15t test venv would otherwise leave several stubs unresolved.
environment.python-version = "3.15"
rules.call-non-callable = "ignore"
rules.deprecated = "ignore"
rules.invalid-argument-type = "ignore"
rules.invalid-return-type = "ignore"
rules.no-matching-overload = "ignore"
rules.not-iterable = "ignore"
rules.not-subscriptable = "ignore"
rules.parameter-already-assigned = "ignore"
rules.unresolved-attribute = "ignore"
rules.unresolved-import = "ignore"
rules.unsupported-operator = "ignore"
[tool.pytest]
ini_options.addopts = [
"--durations=10",
"--doctest-modules",
"--showlocals",
]
ini_options.markers = [
"mat_ops: mark a test as utilizing matrix operations.",
]
[tool.coverage]
report.omit = [
".env/*",
"project_euler/*",
]
report.sort = "Cover"
[tool.rumdl]
disable = [
# "MD013",
"MD033",
"MD036",
"MD041",
]
exclude = [ "DIRECTORY.md", "docs/hacktober_2026_prep.md" ]
flavor = "gfm"
line-length = 350
per-file-ignores."index.md" = [ "MD040" ]