-
-
Notifications
You must be signed in to change notification settings - Fork 51k
Expand file tree
/
Copy pathpyproject.toml
More file actions
202 lines (196 loc) · 6.2 KB
/
Copy pathpyproject.toml
File metadata and controls
202 lines (196 loc) · 6.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
[project]
name = "thealgorithms-python"
version = "0.0.1"
description = "TheAlgorithms in Python"
authors = [ { name = "TheAlgorithms Contributors" } ]
requires-python = ">=3.14"
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: Free Threading :: 2 - Beta",
]
dependencies = [
"beautifulsoup4>=4.15",
"cython>=3.1.2",
"fake-useragent>=1.5.1",
"httpx>=0.28.1",
"imageio>=2.36.1",
"keras>=3.7",
"lxml>=6",
"matplotlib>=3.9.3",
"numpy>=2.1.3",
"pandas>=2.3.3",
"pillow>=11.3",
"rich>=13.9.4",
"scikit-learn>=1.5.2",
"scipy>=1.16.2",
"statsmodels>=0.14.4",
"sympy>=1.13.3",
"tweepy>=4.14",
"typing-extensions>=4.12.2",
"xgboost>=2.1.3",
]
[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 (cp314t) wheel yet and fails to build from
# source under 3.14t (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 cp314t wheel ships (upstream: opencv/opencv#27933).
cv = [
"opencv-python>=4.10.0.84",
]
euler-validate = [
"httpx>=0.28.1",
"numpy>=2.1.3",
]
# qiskit does not yet run on free-threaded CPython: its compiled core re-enables
# the GIL under 3.14t and the team is still scoping free-threading support
# (upstream: Qiskit/qiskit#16893). Keep it in an optional group so the
# free-threaded CI can install everything else; only quantum/q_fourier_transform.py
# imports it, and that file is ignored in the 3.14t test run. Re-fold into core
# deps once qiskit supports free-threading.
quantum = [
"qiskit>=2",
]
[tool.ruff]
target-version = "py314"
output-format = "full"
lint.select = [
# https://beta.ruff.rs/docs/rules
"A", # flake8-builtins
"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
"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
# "ANN", # flake8-annotations -- FIX ME?
# "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
# "Q", # flake8-quotes
# "RET", # flake8-return # 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
"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/hashing/tests/test_hash_map.py" = [
"BLE001",
]
lint.per-file-ignores."hashes/enigma_machine.py" = [
"BLE001",
]
lint.per-file-ignores."machine_learning/sequential_minimum_optimization.py" = [
"SIM115",
]
lint.per-file-ignores."matrix/sherman_morrison.py" = [
"SIM103",
]
lint.per-file-ignores."physics/newtons_second_law_of_motion.py" = [
"BLE001",
]
lint.per-file-ignores."project_euler/problem_099/sol1.py" = [
"SIM115",
]
lint.per-file-ignores."sorts/external_sort.py" = [
"SIM115",
]
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.mypy]
python_version = "3.14"
[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"