Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use uv to manage ci dependencies #39060

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/write-dockerfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ cat <<EOF
FROM with-system-packages AS bootstrapped
#:bootstrapping:
RUN rm -rf /new /sage/.git
$ADD Makefile VERSION.txt COPYING.txt condarc.yml README.md bootstrap configure.ac sage .homebrew-build-env tox.ini .gitignore /new/
$ADD pyproject.toml uv.lock Makefile VERSION.txt COPYING.txt condarc.yml README.md bootstrap configure.ac sage .homebrew-build-env tox.ini .gitignore /new/
$ADD config/config.rpath /new/config/config.rpath
$ADD src/doc/bootstrap /new/src/doc/bootstrap
$ADD src/bin /new/src/bin
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,9 @@ jobs:
# The following command checks that all modules can be imported.
# The output also includes a long list of modules together with the number of tests in each module.
# This can be ignored.
./sage -python -m pip install pytest-xdist
./sage -python -m pytest -c tox.ini -qq --doctest --collect-only || true
pip install uv
export UV_PROJECT_ENVIRONMENT= $(./sage -python -c "import os; print(os.environ.get('VIRTUAL_ENV', ''))")
uv run --frozen --only-group test -- pytest -c tox.ini -qq --doctest --collect-only || true
shell: sh .ci/docker-exec-script.sh BUILD /sage {0}

- name: Test changed files (sage -t --new)
Expand Down Expand Up @@ -453,14 +454,15 @@ jobs:
rm -rf /sage/.coverage
ln -s $(pwd)/.coverage /sage/
cd /sage
./sage -python -m pip install coverage
./sage -python -m coverage run --rcfile=src/tox.ini src/bin/sage-runtests --force-lib --long -p4 --format github --random-seed=286735480429121101562228604801325644303 ${{ matrix.tests }}
pip install uv
export UV_PROJECT_ENVIRONMENT= $(./sage -python -c "import os; print(os.environ.get('VIRTUAL_ENV', ''))")
uv run --frozen --only-group test -- coverage run --rcfile=src/tox.ini src/bin/sage-runtests --force-lib --long -p4 --format github --random-seed=286735480429121101562228604801325644303 ${{ matrix.tests }}
shell: sh .ci/docker-exec-script.sh BUILD . {0}

- name: Combine coverage results
if: (success() || failure()) && steps.container.outcome == 'success'
run: |
./sage -python -m coverage combine --rcfile=src/tox.ini
uv run --frozen --only-group test -- coverage combine --rcfile=src/tox.ini
shell: sh .ci/docker-exec-script.sh BUILD /sage {0}

- name: Prepare upload
Expand Down Expand Up @@ -580,9 +582,10 @@ jobs:
rm -rf /sage/.coverage
ln -s $(pwd)/.coverage /sage/
cd /sage
./sage -python -m pip install coverage
./sage -python -m coverage combine --rcfile=src/tox.ini .coverage/coverage-*/.coverage
./sage -python -m coverage xml --rcfile=src/tox.ini --omit="/tmp/*"
pip install uv
export UV_PROJECT_ENVIRONMENT= $(./sage -python -c "import os; print(os.environ.get('VIRTUAL_ENV', ''))")
uv run --frozen --only-group test -- coverage combine --rcfile=src/tox.ini .coverage/coverage-*/.coverage
uv run --frozen --only-group test -- coverage xml --rcfile=src/tox.ini --omit="/tmp/*"
mkdir -p .coverage/coverage-report
mv coverage.xml .coverage/coverage-report/
shell: sh .ci/docker-exec-script.sh BUILD . {0}
Expand Down
8 changes: 7 additions & 1 deletion tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ tools/update-conda.py

This command is used to updates the Meson build files in the project. It automatically adds new source files (py, pyx) to the Meson files and removes deleted source files. This command is useful when adding or removing source files from the project.

Within an active virtual environment where Meson is installed, run the following command:
You can use [uv](https://docs.astral.sh/uv/) to run the command:

```bash
uv run tools/update-meson.py
```

Alternatively, within an active virtual environment where `meson` is installed, run the following command:

```bash
tools/update-meson.py
Expand Down
6 changes: 6 additions & 0 deletions tools/update-meson.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "meson",
# ]
# ///

import argparse
import os
Expand Down
Loading
Loading