Skip to content

try out setup-uv #41

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
17 changes: 9 additions & 8 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,20 @@ jobs:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
python-version: "3.13"
cache: pip
cache-dependency-path: |
enable-cache: true
prune-cache: false # Can't prune cache if uv installs uv
cache-dependency-glob: |
requirements-tests.txt
stubs/**/METADATA.toml
- name: Install dependencies
run: pip install -r requirements-tests.txt
run: uv pip install -r requirements-tests.txt
- name: Run stubtest
shell: bash
run: |
PACKAGES=$(python tests/get_stubtest_system_requirements.py)
PACKAGES=$(uv run tests/get_stubtest_system_requirements.py)

if [ "${{ runner.os }}" = "Linux" ]; then
if [ -n "$PACKAGES" ]; then
Expand Down Expand Up @@ -112,16 +113,16 @@ jobs:
with:
repository: typeshed-internal/stub_uploader
path: stub_uploader
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
# Keep in sync with stub_uploader's check_scripts.yml workflow.
python-version: "3.13"
- uses: astral-sh/setup-uv@v5
- name: Run tests
run: |
cd stub_uploader
uv pip install -r requirements.txt --system
python -m pytest tests
uv pip install -r requirements.txt
uv run -m pytest tests

# https://github.community/t/run-github-actions-job-only-if-previous-job-has-failed/174786/2
create-issue-on-failure:
Expand Down
20 changes: 9 additions & 11 deletions .github/workflows/meta_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ jobs:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
python-version: "3.13"
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: uv pip install -r requirements-tests.txt --system
- run: python ./tests/typecheck_typeshed.py --platform=${{ matrix.platform }}
- run: uv pip install -r requirements-tests.txt
- run: uv run ./tests/typecheck_typeshed.py --platform=${{ matrix.platform }}
pyright:
name: Check scripts and tests with pyright
runs-on: ubuntu-latest
Expand All @@ -51,13 +50,13 @@ jobs:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
# TODO: Since pytype is not available for Python 3.13, and
# pytype_test.py imports pytype, we need to use Python 3.12 for now.
python-version: "3.12"
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: uv pip install -r requirements-tests.txt --system
prune-cache: false # Can't prune cache if uv installs uv
- run: uv pip install -r requirements-tests.txt
- name: Run pyright on typeshed
uses: jakebailey/pyright-action@v2
with:
Expand All @@ -70,13 +69,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
python-version: "3.13"
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Git config
run: |
git config --global user.name stubsabot
git config --global user.email '<>'
- run: uv pip install -r requirements-tests.txt --system
- run: python scripts/stubsabot.py --action-level local
- run: uv pip install -r requirements-tests.txt
- run: uv run scripts/stubsabot.py --action-level local
4 changes: 2 additions & 2 deletions .github/workflows/mypy_primer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ jobs:
with:
path: typeshed_to_test
fetch-depth: 0
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
python-version: "3.13"
- name: Install dependencies
run: pip install git+https://github.com/hauntsaninja/mypy_primer.git
run: uv pip install git+https://github.com/hauntsaninja/mypy_primer.git
- name: Run mypy_primer
shell: bash
run: |
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/stubsabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,17 @@ jobs:
# use an ssh key so that checks automatically run on stubsabot PRs
ssh-key: ${{ secrets.STUBSABOT_SSH_PRIVATE_KEY }}
fetch-depth: 0
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
python-version: "3.13"
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: git config
run: |
git config --global user.name stubsabot
git config --global user.email '<>'
- name: Install dependencies
run: uv pip install -r requirements-tests.txt --system
run: uv pip install -r requirements-tests.txt
- name: Run stubsabot
run: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} python scripts/stubsabot.py --action-level everything
run: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} uv run scripts/stubsabot.py --action-level everything

# https://github.community/t/run-github-actions-job-only-if-previous-job-has-failed/174786/2
create-issue-on-failure:
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/stubtest_third_party.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,16 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
python-version: "3.13"
cache: pip
cache-dependency-path: |
enable-cache: true
prune-cache: false # Can't prune cache if uv installs uv
cache-dependency-glob: |
requirements-tests.txt
stubs/**/METADATA.toml
- name: Install dependencies
run: pip install -r requirements-tests.txt
run: uv pip install -r requirements-tests.txt
- name: Run stubtest
shell: bash
run: |
Expand All @@ -62,7 +63,7 @@ jobs:

if [ -n "$STUBS" ]; then
echo "Testing $STUBS..."
PACKAGES=$(python tests/get_stubtest_system_requirements.py $STUBS)
PACKAGES=$(uv run tests/get_stubtest_system_requirements.py $STUBS)

if [ "${{ runner.os }}" = "Linux" ]; then
if [ -n "$PACKAGES" ]; then
Expand Down
45 changes: 19 additions & 26 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,29 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
python-version: "3.13"
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: uv pip install -r requirements-tests.txt --system
- run: python ./tests/check_typeshed_structure.py
- run: uv pip install -r requirements-tests.txt
- run: uv run ./tests/check_typeshed_structure.py

pytype:
name: "pytype: Check stubs"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
# Max supported Python version as of pytype 2024.10.11
python-version: "3.12"
- uses: astral-sh/setup-uv@v5
- run: uv pip install -r requirements-tests.txt --system
- run: uv pip install -r requirements-tests.txt
- name: Install external dependencies for 3rd-party stubs
run: |
DEPENDENCIES=$( python tests/get_external_stub_requirements.py )
DEPENDENCIES=$(uv run tests/get_external_stub_requirements.py)
if [ -n "$DEPENDENCIES" ]; then
printf "Installing packages:\n $(echo $DEPENDENCIES | sed 's/ /\n /g')\n"
uv pip install --system $DEPENDENCIES
uv pip install $DEPENDENCIES
fi
- run: uv pip freeze
- run: ./tests/pytype_test.py --print-stderr
Expand All @@ -65,26 +64,24 @@ jobs:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: uv pip install -r requirements-tests.txt --system
- run: python ./tests/mypy_test.py --platform=${{ matrix.platform }} --python-version=${{ matrix.python-version }}
- run: uv pip install -r requirements-tests.txt
- run: uv run ./tests/mypy_test.py --platform=${{ matrix.platform }} --python-version=${{ matrix.python-version }}

regression-tests:
name: "mypy: Run test cases"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
# Use py311 for now, as py312 seems to be around 30s slower in CI
# TODO: figure out why that is (#11590)
python-version: "3.11"
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: uv pip install -r requirements-tests.txt --system
- run: python ./tests/regr_test.py --all --verbosity QUIET
- run: uv pip install -r requirements-tests.txt
- run: uv run ./tests/regr_test.py --all --verbosity QUIET

pyright:
name: "pyright: Run test cases"
Expand All @@ -96,24 +93,20 @@ jobs:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
python-version: "3.13"
- uses: astral-sh/setup-uv@v5
- name: Install typeshed test-suite requirements
# Install these so we can run `get_external_stub_requirements.py`
run: uv pip install -r requirements-tests.txt --system
- name: Create an isolated venv for testing
run: uv venv .venv
run: uv pip install -r requirements-tests.txt
- name: Install 3rd-party stub dependencies
run: |
DEPENDENCIES=$( python tests/get_external_stub_requirements.py )
DEPENDENCIES=$(uv run tests/get_external_stub_requirements.py)
if [ -n "$DEPENDENCIES" ]; then
printf "Installing packages:\n $(echo $DEPENDENCIES | sed 's/ /\n /g')\n"
uv pip install --python-version ${{ matrix.python-version }} $DEPENDENCIES
fi
- name: Activate the isolated venv for the rest of the job
run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: List 3rd-party stub dependencies installed
run: uv pip freeze
- name: Run pyright with basic settings on all the stubs
Expand Down Expand Up @@ -153,13 +146,13 @@ jobs:
with:
repository: typeshed-internal/stub_uploader
path: stub_uploader
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
# Keep in sync with stub_uploader's check_scripts.yml workflow.
python-version: "3.13"
- uses: astral-sh/setup-uv@v5
- name: Run tests
run: |
cd stub_uploader
uv pip install -r requirements.txt --system
python -m pytest tests
uv pip install -r requirements.txt
uv run -m pytest tests