mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-08 21:21:13 +08:00
Use Astral uv (#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>
This commit is contained in:
15
.github/workflows/build.yml
vendored
15
.github/workflows/build.yml
vendored
@ -10,21 +10,18 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: astral-sh/setup-uv@v4
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: uv.lock
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.13
|
||||
allow-prereleases: true
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip setuptools wheel
|
||||
python -m pip install pytest-cov -r requirements.txt
|
||||
- run: uv sync --group=test
|
||||
- name: Run tests
|
||||
# TODO: #8818 Re-enable quantum tests
|
||||
run: pytest
|
||||
run: uv run pytest
|
||||
--ignore=computer_vision/cnn_classification.py
|
||||
--ignore=docs/conf.py
|
||||
--ignore=dynamic_programming/k_means_clustering_tensorflow.py
|
||||
|
16
.github/workflows/project_euler.yml
vendored
16
.github/workflows/project_euler.yml
vendored
@ -15,25 +15,21 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: astral-sh/setup-uv@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
- name: Install pytest and pytest-cov
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install --upgrade numpy pytest pytest-cov
|
||||
- run: pytest --doctest-modules --cov-report=term-missing:skip-covered --cov=project_euler/ project_euler/
|
||||
- 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:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: astral-sh/setup-uv@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
- name: Install pytest and requests
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install --upgrade numpy pytest requests
|
||||
- run: pytest scripts/validate_solutions.py
|
||||
- run: uv sync --group=euler-validate --group=test
|
||||
- run: uv run pytest scripts/validate_solutions.py
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
4
.github/workflows/ruff.yml
vendored
4
.github/workflows/ruff.yml
vendored
@ -12,5 +12,5 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: pip install --user ruff
|
||||
- run: ruff check --output-format=github .
|
||||
- uses: astral-sh/setup-uv@v4
|
||||
- run: uvx ruff check --output-format=github .
|
||||
|
6
.github/workflows/sphinx.yml
vendored
6
.github/workflows/sphinx.yml
vendored
@ -26,14 +26,14 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: astral-sh/setup-uv@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.13
|
||||
allow-prereleases: true
|
||||
- run: pip install --upgrade pip
|
||||
- run: pip install myst-parser sphinx-autoapi sphinx-pyproject
|
||||
- run: uv sync --group=docs
|
||||
- uses: actions/configure-pages@v5
|
||||
- run: sphinx-build -c docs . docs/_build/html
|
||||
- run: uv run sphinx-build -c docs . docs/_build/html
|
||||
- uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: docs/_build/html
|
||||
|
Reference in New Issue
Block a user