Skip to content

Commit

Permalink
Merge branch 'master' into fix_union_inference_of_generic_class_and_i…
Browse files Browse the repository at this point in the history
…ts_generic_type
  • Loading branch information
roberfi committed Oct 24, 2024
2 parents 2314852 + eb0575e commit 401eb22
Show file tree
Hide file tree
Showing 526 changed files with 23,994 additions and 8,879 deletions.
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
f98f78216ba9d6ab68c8e69c19e9f3c7926c5efe
# run pyupgrade (#12711)
fc335cb16315964b923eb1927e3aad1516891c28
# update black to 23.3.0 (#15059)
4276308be01ea498d946a79554b4a10b1cf13ccb
# Update black to 24.1.1 (#16847)
8107e53158d83d30bb04d290ac10d8d3ccd344f8
5 changes: 3 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ concurrency:
jobs:
docs:
runs-on: ubuntu-latest
timeout-minutes: 10
env:
TOXENV: docs
TOX_SKIP_MISSING_INTERPRETERS: False
Expand All @@ -36,9 +37,9 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.12'
- name: Install tox
run: pip install --upgrade 'setuptools!=50' tox==4.11.0
run: pip install tox==4.21.2
- name: Setup tox environment
run: tox run -e ${{ env.TOXENV }} --notest
- name: Test
Expand Down
40 changes: 29 additions & 11 deletions .github/workflows/mypy_primer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ jobs:
matrix:
shard-index: [0, 1, 2, 3, 4]
fail-fast: false
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
path: mypy_to_test
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install -U pip
Expand Down Expand Up @@ -69,18 +70,35 @@ jobs:
--output concise \
| tee diff_${{ matrix.shard-index }}.txt
) || [ $? -eq 1 ]
- name: Upload mypy_primer diff
uses: actions/upload-artifact@v3
with:
name: mypy_primer_diffs
path: diff_${{ matrix.shard-index }}.txt
- if: ${{ matrix.shard-index }} == 0
- if: ${{ matrix.shard-index == 0 }}
name: Save PR number
run: |
echo ${{ github.event.pull_request.number }} | tee pr_number.txt
- if: ${{ matrix.shard-index }} == 0
name: Upload PR number
uses: actions/upload-artifact@v3
- if: ${{ matrix.shard-index == 0 }}
name: Upload mypy_primer diff + PR number
uses: actions/upload-artifact@v4
with:
name: mypy_primer_diffs-${{ matrix.shard-index }}
path: |
diff_${{ matrix.shard-index }}.txt
pr_number.txt
- name: Upload mypy_primer diff
uses: actions/upload-artifact@v4
if: ${{ matrix.shard-index != 0 }}
with:
name: mypy_primer_diffs-${{ matrix.shard-index }}
path: diff_${{ matrix.shard-index }}.txt

join_artifacts:
name: Join artifacts
runs-on: ubuntu-latest
needs: [mypy_primer]
permissions:
contents: read
steps:
- name: Merge artifacts
uses: actions/upload-artifact/merge@v4
with:
name: mypy_primer_diffs
path: pr_number.txt
pattern: mypy_primer_diffs-*
delete-merged: true
2 changes: 1 addition & 1 deletion .github/workflows/mypy_primer_comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Download diffs
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sync_typeshed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
name: Sync typeshed
if: github.repository == 'python/mypy'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
Expand Down
89 changes: 73 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@ jobs:
toxenv: py
tox_extra_args: "-n 4"
test_mypyc: true
- name: Test suite with py313-ubuntu, mypyc-compiled
python: '3.13'
arch: x64
os: ubuntu-latest
toxenv: py
tox_extra_args: "-n 4"
test_mypyc: true

# - name: Test suite with py314-dev-ubuntu
# python: '3.14-dev'
# arch: x64
# os: ubuntu-latest
# toxenv: py
# tox_extra_args: "-n 4"
# allow_failure: true
# test_mypyc: true

- name: mypyc runtime tests with py39-macos
python: '3.9.18'
Expand All @@ -78,13 +94,16 @@ jobs:
os: macos-13
toxenv: py
tox_extra_args: "-n 3 mypyc/test/test_run.py mypyc/test/test_external.py"
- name: mypyc runtime tests with py38-debug-build-ubuntu
python: '3.8.17'
arch: x64
os: ubuntu-latest
toxenv: py
tox_extra_args: "-n 4 mypyc/test/test_run.py mypyc/test/test_external.py"
debug_build: true
# This is broken. See
# - https://github.com/python/mypy/issues/17819
# - https://github.com/python/mypy/pull/17822
# - name: mypyc runtime tests with py38-debug-build-ubuntu
# python: '3.8.17'
# arch: x64
# os: ubuntu-latest
# toxenv: py
# tox_extra_args: "-n 4 mypyc/test/test_run.py mypyc/test/test_external.py"
# debug_build: true

- name: Type check our own code (py38-ubuntu)
python: '3.8'
Expand All @@ -107,10 +126,11 @@ jobs:
toxenv: lint

name: ${{ matrix.name }}
timeout-minutes: 60
env:
TOX_SKIP_MISSING_INTERPRETERS: False
# Rich (pip)
FORCE_COLOR: 1
# Rich (pip) -- Disable color for windows + pytest
FORCE_COLOR: ${{ !(startsWith(matrix.os, 'windows-') && startsWith(matrix.toxenv, 'py')) && 1 || 0 }}
# Tox
PY_COLORS: 1
# Mypy (see https://github.com/python/mypy/issues/7771)
Expand All @@ -119,37 +139,74 @@ jobs:
MYPY_FORCE_TERMINAL_WIDTH: 200
# Pytest
PYTEST_ADDOPTS: --color=yes

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.arch }}

- name: Debug build
if: ${{ matrix.debug_build }}
run: |
PYTHONVERSION=${{ matrix.python }}
PYTHONDIR=~/python-debug/python-$PYTHONVERSION
VENV=$PYTHONDIR/env
./misc/build-debug-python.sh $PYTHONVERSION $PYTHONDIR $VENV
# TODO: does this do anything? env vars aren't passed to the next step right
source $VENV/bin/activate
- name: Latest dev build
if: ${{ endsWith(matrix.python, '-dev') }}
run: |
git clone --depth 1 https://github.com/python/cpython.git /tmp/cpython --branch $( echo ${{ matrix.python }} | sed 's/-dev//' )
cd /tmp/cpython
echo git rev-parse HEAD; git rev-parse HEAD
git show --no-patch
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential gdb lcov libbz2-dev libffi-dev libgdbm-dev liblzma-dev libncurses5-dev \
libreadline6-dev libsqlite3-dev libssl-dev lzma lzma-dev tk-dev uuid-dev zlib1g-dev
./configure --prefix=/opt/pythondev
make -j$(nproc)
sudo make install
sudo ln -s /opt/pythondev/bin/python3 /opt/pythondev/bin/python
sudo ln -s /opt/pythondev/bin/pip3 /opt/pythondev/bin/pip
echo "/opt/pythondev/bin" >> $GITHUB_PATH
- uses: actions/setup-python@v5
if: ${{ !(matrix.debug_build || endsWith(matrix.python, '-dev')) }}
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.arch }}

- name: Install tox
run: pip install setuptools==68.2.2 tox==4.11.0
run: |
echo PATH; echo $PATH
echo which python; which python
echo which pip; which pip
echo python version; python -c 'import sys; print(sys.version)'
echo debug build; python -c 'import sysconfig; print(bool(sysconfig.get_config_var("Py_DEBUG")))'
echo os.cpu_count; python -c 'import os; print(os.cpu_count())'
echo os.sched_getaffinity; python -c 'import os; print(len(getattr(os, "sched_getaffinity", lambda *args: [])(0)))'
pip install setuptools==75.1.0 tox==4.21.2
- name: Compiled with mypyc
if: ${{ matrix.test_mypyc }}
run: |
pip install -r test-requirements.txt
CC=clang MYPYC_OPT_LEVEL=0 MYPY_USE_MYPYC=1 pip install -e .
- name: Setup tox environment
run: |
tox run -e ${{ matrix.toxenv }} --notest
python -c 'import os; print("os.cpu_count", os.cpu_count(), "os.sched_getaffinity", len(getattr(os, "sched_getaffinity", lambda *args: [])(0)))'
- name: Test
run: tox run -e ${{ matrix.toxenv }} --skip-pkg-install -- ${{ matrix.tox_extra_args }}
continue-on-error: ${{ matrix.allow_failure == 'true' }}

- name: Mark as success (check failures manually)
if: ${{ matrix.allow_failure == 'true' }}
run: exit 0

python_32bits:
runs-on: ubuntu-latest
name: Test mypyc suite with 32-bit Python
timeout-minutes: 60
env:
TOX_SKIP_MISSING_INTERPRETERS: False
# Rich (pip)
Expand Down Expand Up @@ -188,7 +245,7 @@ jobs:
default: 3.11.1
command: python -c "import platform; print(f'{platform.architecture()=} {platform.machine()=}');"
- name: Install tox
run: pip install setuptools==68.2.2 tox==4.11.0
run: pip install setuptools==75.1.0 tox==4.21.2
- name: Setup tox environment
run: tox run -e py --notest
- name: Test
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_stubgenc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
# Check stub file generation for a small pybind11 project
# (full text match is required to pass)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:

- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.1.1 # must match test-requirements.txt
rev: 24.8.0 # must match test-requirements.txt
hooks:
- id: black
exclude: '^(test-data/)'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0 # must match test-requirements.txt
rev: v0.6.9 # must match test-requirements.txt
hooks:
- id: ruff
args: [--exit-non-zero-on-fix]
Expand Down
Loading

0 comments on commit 401eb22

Please sign in to comment.