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

Switch to use uv pip install #2957

Merged
merged 39 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
45bfc35
Switch to use `uv`. Closes #2956
CoolCat467 Feb 16, 2024
395331d
Attempt to fix venv issue
CoolCat467 Feb 16, 2024
060b9ae
Attempt to fix venv install on windows
CoolCat467 Feb 16, 2024
61c1887
Fix windows check
CoolCat467 Feb 16, 2024
861788e
Should have checked, extra parens syntax error
CoolCat467 Feb 16, 2024
48f8503
Try to get windows venv activate to work
CoolCat467 Feb 16, 2024
71a2e53
Windows venv try #3
CoolCat467 Feb 16, 2024
e300d26
Windows venv try 4
CoolCat467 Feb 16, 2024
386c251
Windows venv 5
CoolCat467 Feb 16, 2024
868022a
Windows venv 6 (forgot `.`)
CoolCat467 Feb 16, 2024
7f654d4
Windows venv 7
CoolCat467 Feb 16, 2024
11af40d
Source the windows activate
CoolCat467 Feb 16, 2024
161be94
Revert installing `build` with `uv`
CoolCat467 Feb 16, 2024
4a5e8ef
Attempt to fix missing `build` errors
CoolCat467 Feb 16, 2024
5ac75fc
Revert pip-compile changes
CoolCat467 Feb 16, 2024
249f7d7
Add uv 0.1.3
CoolCat467 Feb 17, 2024
06064ac
Attempt to fix alpine not finding `uv` by making sure uv is installed…
CoolCat467 Feb 17, 2024
a0a059a
Only use pip for venv installing of `uv`
CoolCat467 Feb 17, 2024
779e872
Ensure pip is installed in venv (pypy failure)
CoolCat467 Feb 17, 2024
be9755f
Merge branch 'python-trio:master' into switch-to-UV
CoolCat467 Mar 11, 2024
bb1ba35
Merge branch 'master' into switch-to-UV
CoolCat467 May 7, 2024
7a614b8
Merge branch 'master' into switch-to-UV
CoolCat467 Jun 27, 2024
da5e997
Update uv version
CoolCat467 Jun 27, 2024
fbe01b5
Update ci.sh
jakkdl Jun 27, 2024
c4f9891
Revert changing wheel version to be lower
CoolCat467 Jun 27, 2024
13cd881
Move using virtual environment behind `MAKE_VENV` flag
CoolCat467 Jun 27, 2024
ada0e84
Make sure running without a venv works
CoolCat467 Jun 27, 2024
f57943d
Try to fix getting python executable on windows
CoolCat467 Jun 27, 2024
a359dac
Make `PYTHON_PATH` work on both windows and linux
CoolCat467 Jun 27, 2024
9561fc7
Merge branch 'main' into switch-to-UV
CoolCat467 Jul 8, 2024
8c1ac6e
Add comment about python path variable
CoolCat467 Jul 8, 2024
a80e435
Merge branch 'main' into switch-to-UV
CoolCat467 Aug 4, 2024
57b8d2f
Detect if on Github CI and use system python if so
CoolCat467 Aug 4, 2024
da9f361
Try invoking with `python -m uv`
CoolCat467 Aug 4, 2024
5b8f40b
Install pinned uv version from the start
CoolCat467 Aug 4, 2024
d7381b5
Follow shellcheck suggestions
CoolCat467 Aug 13, 2024
bc3a94e
Use constraints instead of grep
CoolCat467 Aug 13, 2024
af258f3
Merge branch 'main' into switch-to-UV
CoolCat467 Aug 13, 2024
3933ce2
Merge branch 'main' into switch-to-UV
CoolCat467 Aug 21, 2024
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 check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ if [ $EXIT_STATUS -ne 0 ]; then
Problems were found by static analysis (listed above).
To fix formatting and see remaining errors, run

pip install -r test-requirements.txt
uv pip install -r test-requirements.txt
black src/trio
ruff check src/trio
./check.sh
Expand Down
46 changes: 38 additions & 8 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ set -ex -o pipefail
# used in test_exports and in check.sh
export PYRIGHT_PYTHON_IGNORE_WARNINGS=1

ON_WINDOWS=$(python -c "import sys;print(sys.platform.startswith('win'))")

# Log some general info about the environment
echo "::group::Environment"
uname -a
Expand Down Expand Up @@ -37,25 +39,53 @@ python -c "import sys, struct, ssl; print('python:', sys.version); print('versio
echo "::endgroup::"

echo "::group::Install dependencies"
python -m pip install -U pip build
python -m pip install -U pip uv
python -m pip --version
uv --version

# expands to 0 != 1 if MAKE_VENV is not set, if set the `-0` has no effect
# https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02
if [ "${MAKE_VENV-0}" == 1 ]; then
uv venv .venv --seed

if [ "$ON_WINDOWS" = "True" ]; then
source ./.venv/Scripts/activate
else
source .venv/bin/activate
fi
CoolCat467 marked this conversation as resolved.
Show resolved Hide resolved

# Make sure pip is installed (pypy weirdness)
python -m ensurepip

# Install uv in venv
python -m pip install --upgrade uv
fi

if [ "$ON_WINDOWS" = "True" ]; then
PYTHON_PATH=$(python -c "import os, sys; print(os.path.dirname(sys.executable))")
else
PYTHON_PATH=$(which python)
fi

uv pip install --python="$PYTHON_PATH" build
CoolCat467 marked this conversation as resolved.
Show resolved Hide resolved

python -m build
python -m pip install dist/*.whl
wheel_package=$(ls dist/*.whl)
uv pip install --python="$PYTHON_PATH" "trio @ $wheel_package"

if [ "$CHECK_FORMATTING" = "1" ]; then
python -m pip install -r test-requirements.txt
uv pip install --python="$PYTHON_PATH" -r test-requirements.txt
echo "::endgroup::"
source check.sh
else
# Actual tests
# expands to 0 != 1 if NO_TEST_REQUIREMENTS is not set, if set the `-0` has no effect
# https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02
if [ ${NO_TEST_REQUIREMENTS-0} == 1 ]; then
python -m pip install pytest coverage
if [ "${NO_TEST_REQUIREMENTS-0}" == 1 ]; then
uv pip install --python="$PYTHON_PATH" pytest coverage
flags="--skip-optional-imports"
else
python -m pip install -r test-requirements.txt
uv pip install --python="$PYTHON_PATH" -r test-requirements.txt
flags=""
fi

Expand Down Expand Up @@ -118,7 +148,7 @@ else
cd empty

INSTALLDIR=$(python -c "import os, trio; print(os.path.dirname(trio.__file__))")
cp ../pyproject.toml $INSTALLDIR
cp ../pyproject.toml "$INSTALLDIR"

# get mypy tests a nice cache
MYPYPATH=".." mypy --config-file= --cache-dir=./.mypy_cache -c "import trio" >/dev/null 2>/dev/null || true
Expand All @@ -128,7 +158,7 @@ else

echo "::endgroup::"
echo "::group:: Run Tests"
if COVERAGE_PROCESS_START=$(pwd)/../pyproject.toml coverage run --rcfile=../pyproject.toml -m pytest -ra --junitxml=../test-results.xml --run-slow ${INSTALLDIR} --verbose --durations=10 $flags; then
if COVERAGE_PROCESS_START=$(pwd)/../pyproject.toml coverage run --rcfile=../pyproject.toml -m pytest -ra --junitxml=../test-results.xml --run-slow "${INSTALLDIR}" --verbose --durations=10 $flags; then
PASSED=true
else
PASSED=false
Expand Down
1 change: 1 addition & 0 deletions test-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ types-pyOpenSSL; implementation_name == "cpython" # and annotations
ruff >= 0.4.3
astor # code generation
pip-tools >= 6.13.0
uv >= 0.2.17
codespell

# https://github.com/python-trio/trio/pull/654#issuecomment-420518745
Expand Down
2 changes: 2 additions & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ typing-extensions==4.12.0
# pylint
urllib3==2.2.1
# via requests
uv==0.2.17
# via -r test-requirements.in
wheel==0.43.0
# via pip-tools
zipp==3.19.1
Expand Down
Loading