Skip to content

Commit

Permalink
Merge branch 'master' into spec
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja authored May 20, 2024
2 parents 50d0897 + ac8a5a7 commit 83fefbf
Show file tree
Hide file tree
Showing 1,005 changed files with 72,838 additions and 29,355 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
root = true

[*.{py,pyi,c,cpp,h,rst,md,yml,json,test}]
[*.{py,pyi,c,cpp,h,rst,md,yml,yaml,json,test}]
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space

[*.{py,pyi,c,h,json,test}]
indent_size = 4

[*.yml]
[*.{yml,yaml}]
indent_size = 2
8 changes: 7 additions & 1 deletion .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# Adopt black and isort
97c5ee99bc98dc475512e549b252b23a6e7e0997
97c5ee99bc98dc475512e549b252b23a6e7e0997
# Use builtin generics and PEP 604 for type annotations wherever possible (#13427)
23ee1e7aff357e656e3102435ad0fe3b5074571e
# Use variable annotations (#10723)
f98f78216ba9d6ab68c8e69c19e9f3c7926c5efe
# run pyupgrade (#12711)
fc335cb16315964b923eb1927e3aad1516891c28
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ contact_links:
- about: "Please check the linked documentation page before filing new issues."
name: "Common issues and solutions"
url: "https://mypy.readthedocs.io/en/stable/common_issues.html"
- about: "Please ask and answer any questions on the mypy Gitter."
- about: "Please ask and answer any questions on the python/typing Gitter."
name: "Questions or Chat"
url: "https://gitter.im/python/typing"
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ labels: "feature"

**Feature**

(A clear and concise description of your feature proposal.)
<!-- Enter a clear and concise description of your feature proposal here. -->

**Pitch**

(Please explain why this feature should be implemented and how it would be used. Add examples, if applicable.)
<!-- Please explain why this feature should be implemented and how it would be used. Add examples, if applicable. -->
11 changes: 7 additions & 4 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@ name: Trigger wheel build

on:
push:
branches: [master, 'release*']
branches: [main, master, 'release*']
tags: ['*']

permissions:
contents: write

jobs:
build-wheels:
if: github.repository == 'python/mypy'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.7'
python-version: '3.11'
- name: Trigger script
env:
WHEELS_PUSH_TOKEN: ${{ secrets.WHEELS_PUSH_TOKEN }}
Expand Down
22 changes: 17 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,42 @@ name: Check documentation build
on:
workflow_dispatch:
push:
branches: [master, 'release*']
branches: [main, master, 'release*']
tags: ['*']
pull_request:
paths:
- 'docs/**'
# We now have a docs check that fails if any error codes don't have documentation,
# so it's important to do the docs build on all PRs touching mypy/errorcodes.py
# in case somebody's adding a new error code without any docs
- 'mypy/errorcodes.py'
- 'mypyc/doc/**'
- '**/*.rst'
- '**/*.md'
- CREDITS
- LICENSE

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
docs:
runs-on: ubuntu-latest
env:
TOXENV: docs
TOX_SKIP_MISSING_INTERPRETERS: False
VERIFY_MYPY_ERROR_CODES: 1
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.7'
python-version: '3.8'
- name: Install tox
run: pip install --upgrade 'setuptools!=50' tox==4.4.4
run: pip install --upgrade 'setuptools!=50' tox==4.11.0
- name: Setup tox environment
run: tox run -e ${{ env.TOXENV }} --notest
- name: Test
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/mypy_primer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ on:
- 'mypy/test/**'
- 'test-data/**'

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
Expand All @@ -30,11 +33,11 @@ jobs:
shard-index: [0, 1, 2, 3, 4]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: mypy_to_test
fetch-depth: 0
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/mypy_primer_comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Post comment
id: post-comment
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
if (data.trim()) {
body = 'Diff from [mypy_primer](https://github.com/hauntsaninja/mypy_primer), showing the effect of this PR on open source code:\n```diff\n' + data + '```'
} else {
body = 'According to [mypy_primer](https://github.com/hauntsaninja/mypy_primer), this change has no effect on the checked open source code. 🤖🎉'
body = "According to [mypy_primer](https://github.com/hauntsaninja/mypy_primer), this change doesn't affect type check results on a corpus of open source code. ✅"
}
const prNumber = parseInt(fs.readFileSync("pr_number.txt", { encoding: "utf8" }))
await github.rest.issues.createComment({
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sync_typeshed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
if: github.repository == 'python/mypy'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
# TODO: use whatever solution ends up working for
# https://github.com/python/typeshed/issues/8434
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: git config
Expand Down
118 changes: 55 additions & 63 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Tests
on:
workflow_dispatch:
push:
branches: [master, 'release*']
branches: [main, master, 'release*']
tags: ['*']
pull_request:
paths-ignore:
Expand All @@ -15,6 +15,9 @@ on:
- CREDITS
- LICENSE

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
Expand All @@ -26,75 +29,79 @@ jobs:
fail-fast: false
matrix:
include:
- name: Test suite with py37-windows-64
python: '3.7'
arch: x64
os: windows-latest
toxenv: py37
- name: Test suite with py38-ubuntu
# Make sure to run mypyc compiled unit tests for both
# the oldest and newest supported Python versions
- name: Test suite with py38-ubuntu, mypyc-compiled
python: '3.8'
arch: x64
os: ubuntu-latest
toxenv: py
tox_extra_args: "-n 2"
tox_extra_args: "-n 4"
test_mypyc: true
- name: Test suite with py38-windows-64
python: '3.8'
arch: x64
os: windows-latest
toxenv: py38
tox_extra_args: "-n 4"
- name: Test suite with py39-ubuntu
python: '3.9'
arch: x64
os: ubuntu-latest
toxenv: py
tox_extra_args: "-n 2"
- name: Test suite with py37-ubuntu, mypyc-compiled
python: '3.7'
arch: x64
os: ubuntu-latest
toxenv: py
tox_extra_args: "-n 2"
test_mypyc: true
- name: Test suite with py310-ubuntu, mypyc-compiled
python: '3.10'
arch: x64
os: ubuntu-latest
toxenv: py
tox_extra_args: "-n 2"
test_mypyc: true
tox_extra_args: "-n 4"
- name: Test suite with py310-ubuntu
python: '3.10'
arch: x64
os: ubuntu-latest
toxenv: py
tox_extra_args: "-n 2"
tox_extra_args: "-n 4"
- name: Test suite with py311-ubuntu, mypyc-compiled
python: '3.11'
arch: x64
os: ubuntu-latest
toxenv: py
tox_extra_args: "-n 2"
tox_extra_args: "-n 4"
test_mypyc: true
- name: mypyc runtime tests with py37-macos
python: '3.7'
- name: Test suite with py312-ubuntu, mypyc-compiled
python: '3.12'
arch: x64
os: macos-latest
os: ubuntu-latest
toxenv: py
tox_extra_args: "-n 2 mypyc/test/test_run.py mypyc/test/test_external.py"
- name: mypyc runtime tests with py37-debug-build-ubuntu
python: '3.7.13'
tox_extra_args: "-n 4"
test_mypyc: true

- name: mypyc runtime tests with py39-macos
python: '3.9.18'
arch: x64
# TODO: macos-13 is the last one to support Python 3.9, change it to macos-latest when updating the Python version
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 2 mypyc/test/test_run.py mypyc/test/test_external.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 (py37-ubuntu)
python: '3.7'

- name: Type check our own code (py38-ubuntu)
python: '3.8'
arch: x64
os: ubuntu-latest
toxenv: type
- name: Type check our own code (py37-windows-64)
python: '3.7'
- name: Type check our own code (py38-windows-64)
python: '3.8'
arch: x64
os: windows-latest
toxenv: type
- name: Formatting with Black + isort and code style with flake8
python: '3.7'

# We also run these checks with pre-commit in CI,
# but it's useful to run them with tox too,
# to ensure the tox env works as expected
- name: Formatting and code style with Black + ruff
python: '3.10'
arch: x64
os: ubuntu-latest
toxenv: lint
Expand All @@ -113,8 +120,8 @@ jobs:
# Pytest
PYTEST_ADDOPTS: --color=yes
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.arch }}
Expand All @@ -127,35 +134,19 @@ jobs:
./misc/build-debug-python.sh $PYTHONVERSION $PYTHONDIR $VENV
source $VENV/bin/activate
- name: Install tox
run: pip install --upgrade 'setuptools!=50' tox==4.4.4
run: pip install setuptools==68.2.2 tox==4.11.0
- 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
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 }}

python-nightly:
runs-on: ubuntu-latest
name: Test suite with Python nightly
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.12-dev'
- name: Install tox
run: pip install --upgrade 'setuptools!=50' tox==4.4.4
- name: Setup tox environment
run: tox run -e py --notest
- name: Test
run: tox run -e py --skip-pkg-install -- "-n 2"
continue-on-error: true
- name: Mark as a success
run: exit 0

python_32bits:
runs-on: ubuntu-latest
name: Test mypyc suite with 32-bit Python
Expand All @@ -174,12 +165,13 @@ jobs:
CXX: i686-linux-gnu-g++
CC: i686-linux-gnu-gcc
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install 32-bit build dependencies
run: |
sudo dpkg --add-architecture i386 && \
sudo apt-get update && sudo apt-get install -y \
zlib1g-dev:i386 \
libgcc-s1:i386 \
g++-i686-linux-gnu \
gcc-i686-linux-gnu \
libffi-dev:i386 \
Expand All @@ -196,8 +188,8 @@ jobs:
default: 3.11.1
command: python -c "import platform; print(f'{platform.architecture()=} {platform.machine()=}');"
- name: Install tox
run: pip install --upgrade 'setuptools!=50' tox==4.4.4
run: pip install setuptools==68.2.2 tox==4.11.0
- name: Setup tox environment
run: tox run -e py --notest
- name: Test
run: tox run -e py --skip-pkg-install -- -n 2 mypyc/test/
run: tox run -e py --skip-pkg-install -- -n 4 mypyc/test/
Loading

0 comments on commit 83fefbf

Please sign in to comment.