Use Astral uv (#12402) · richard-ma/TheAlgorithmsPython@0bcdfbd · GitHub
Skip to content

Commit 0bcdfbd

Browse files
Use Astral uv (TheAlgorithms#12402)
* 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>
1 parent b22fab0 commit 0bcdfbd

7 files changed

Lines changed: 1301 additions & 40 deletions

File tree

.github/workflows/build.yml

Lines changed: 6 additions & 9 deletions

.github/workflows/project_euler.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,21 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
18+
- uses: astral-sh/setup-uv@v4
1819
- uses: actions/setup-python@v5
1920
with:
2021
python-version: 3.x
21-
- name: Install pytest and pytest-cov
22-
run: |
23-
python -m pip install --upgrade pip
24-
python -m pip install --upgrade numpy pytest pytest-cov
25-
- run: pytest --doctest-modules --cov-report=term-missing:skip-covered --cov=project_euler/ project_euler/
22+
- run: uv sync --group=euler-validate --group=test
23+
- run: uv run pytest --doctest-modules --cov-report=term-missing:skip-covered --cov=project_euler/ project_euler/
2624
validate-solutions:
2725
runs-on: ubuntu-latest
2826
steps:
2927
- uses: actions/checkout@v4
28+
- uses: astral-sh/setup-uv@v4
3029
- uses: actions/setup-python@v5
3130
with:
3231
python-version: 3.x
33-
- name: Install pytest and requests
34-
run: |
35-
python -m pip install --upgrade pip
36-
python -m pip install --upgrade numpy pytest requests
37-
- run: pytest scripts/validate_solutions.py
32+
- run: uv sync --group=euler-validate --group=test
33+
- run: uv run pytest scripts/validate_solutions.py
3834
env:
3935
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ruff.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v4
15-
- run: pip install --user ruff
16-
- run: ruff check --output-format=github .
15+
- uses: astral-sh/setup-uv@v4
16+
- run: uvx ruff check --output-format=github .

.github/workflows/sphinx.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ jobs:
2626
runs-on: ubuntu-latest
2727
steps:
2828
- uses: actions/checkout@v4
29+
- uses: astral-sh/setup-uv@v4
2930
- uses: actions/setup-python@v5
3031
with:
3132
python-version: 3.13
3233
allow-prereleases: true
33-
- run: pip install --upgrade pip
34-
- run: pip install myst-parser sphinx-autoapi sphinx-pyproject
34+
- run: uv sync --group=docs
3535
- uses: actions/configure-pages@v5
36-
- run: sphinx-build -c docs . docs/_build/html
36+
- run: uv run sphinx-build -c docs . docs/_build/html
3737
- uses: actions/upload-pages-artifact@v3
3838
with:
3939
path: docs/_build/html

pyproject.toml

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,43 @@ requires-python = ">=3.13"
77
classifiers = [
88
"Programming Language :: Python :: 3 :: Only",
99
"Programming Language :: Python :: 3.13",
10+
]
11+
dependencies = [
12+
"beautifulsoup4>=4.12.3",
13+
"fake-useragent>=1.5.1",
14+
"imageio>=2.36.1",
15+
"keras>=3.7",
16+
"lxml>=5.3",
17+
"matplotlib>=3.9.3",
18+
"numpy>=2.1.3",
19+
"opencv-python>=4.10.0.84",
20+
"pandas>=2.2.3",
21+
"pillow>=11",
22+
"requests>=2.32.3",
23+
"rich>=13.9.4",
24+
"scikit-learn>=1.5.2",
25+
"sphinx-pyproject>=0.3",
26+
"statsmodels>=0.14.4",
27+
"sympy>=1.13.3",
28+
"tweepy>=4.14",
29+
"typing-extensions>=4.12.2",
30+
"xgboost>=2.1.3",
31+
]
1032

33+
[dependency-groups]
34+
test = [
35+
"pytest>=8.3.4",
36+
"pytest-cov>=6",
1137
]
12-
optional-dependencies.docs = [
13-
"myst-parser",
14-
"sphinx-autoapi",
15-
"sphinx-pyproject",
38+
39+
docs = [
40+
"myst-parser>=4",
41+
"sphinx-autoapi>=3.4",
42+
"sphinx-pyproject>=0.3",
43+
]
44+
euler-validate = [
45+
"numpy>=2.1.3",
46+
"requests>=2.32.3",
1647
]
1748

1849
[tool.ruff]
@@ -61,8 +92,8 @@ lint.select = [
6192
"UP", # pyupgrade
6293
"W", # pycodestyle
6394
"YTT", # flake8-2020
64-
# "ANN", # flake8-annotations # FIX ME?
65-
# "COM", # flake8-commas
95+
# "ANN", # flake8-annotations -- FIX ME?
96+
# "COM", # flake8-commas -- DO NOT FIX
6697
# "D", # pydocstyle -- FIX ME?
6798
# "ERA", # eradicate -- DO NOT FIX
6899
# "FBT", # flake8-boolean-trap # FIX ME
@@ -129,10 +160,7 @@ lint.pylint.max-statements = 88 # default: 50
129160

130161
[tool.codespell]
131162
ignore-words-list = "3rt,ans,bitap,crate,damon,fo,followings,hist,iff,kwanza,manuel,mater,secant,som,sur,tim,toi,zar"
132-
skip = "./.*,*.json,ciphers/prehistoric_men.txt,project_euler/problem_022/p022_names.txt,pyproject.toml,strings/dictionary.txt,strings/words.txt"
133-
134-
[tool.pyproject-fmt]
135-
max_supported_python = "3.13"
163+
skip = "./.*,*.json,*.lock,ciphers/prehistoric_men.txt,project_euler/problem_022/p022_names.txt,pyproject.toml,strings/dictionary.txt,strings/words.txt"
136164

137165
[tool.pytest.ini_options]
138166
markers = [

requirements.txt

Lines changed: 0 additions & 6 deletions

0 commit comments

Comments
 (0)