Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam authored Nov 29, 2023
2 parents 1239536 + e7c57b5 commit a4d8ebc
Show file tree
Hide file tree
Showing 869 changed files with 18,119 additions and 7,052 deletions.
10 changes: 6 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
root = true

[*.{py,pyi,rst,md,yml,yaml,toml,json,txt}]
[*]
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
end_of_line = lf
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[*.{py,pyi,toml,json}]
indent_size = 4

[*.{yml,yaml}]
indent_size = 2
12 changes: 5 additions & 7 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# RST flake8-rst-docstrings
# TYP flake8-typing-imports

# The following rules are incompatible with or enforced by black:
# The following rules are incompatible with or enforced by Black:
# E203 whitespace before ':' -- scripts only
# E301 expected 1 blank line
# E302 expected 2 blank lines
Expand All @@ -31,15 +31,13 @@ extend-ignore = A, D, N8, SIM, RST, TYP, E301, E302, E305, E501
per-file-ignores =
*.py: E203
*.pyi: B, E701, E741, F401, F403, F405
# Since typing.pyi defines "overload" this is not recognized by flake8 as typing.overload.
# Unfortunately, flake8 does not allow to "noqa" just a specific error inside the file itself.
# Since typing.pyi defines "overload" this is not recognized by Flake8 as typing.overload.
# Unfortunately, Flake8 does not allow to "noqa" just a specific error inside the file itself.
# https://github.com/PyCQA/flake8/issues/1079
# F811 redefinition of unused '...'
stdlib/typing.pyi: B, E701, E741, F401, F403, F405, F811
# Generated protobuf files include docstrings
# *_pb2.pyi: B, E701, E741, F401, F403, F405, Y021, Y026, Y053, Y054
*_pb2.pyi: B, E701, E741, F401, F403, F405, Y021, Y026, Y053, Y054

# TODO: Re-enable flake8 on generated protobuf files
# after https://github.com/nipunn1313/mypy-protobuf/issues/523 is resolved
exclude = .venv*,.git,*_pb2.pyi
exclude = .venv*,.git
noqa_require_code = true
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Normalize EOF
* autocrlf=false
* eol=lf
# Set linguist-language to support comments syntax highlight
**/stubtest_allowlist*.txt linguist-language=ini
tests/stubtest_allowlists/*.txt linguist-language=ini
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
fail-fast: false

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v4
with:
Expand All @@ -64,7 +64,7 @@ jobs:
shard-index: [0, 1, 2, 3]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.10"
Expand Down Expand Up @@ -98,23 +98,24 @@ jobs:
fi
$PYTHON_EXECUTABLE tests/stubtest_third_party.py --specified-platforms-only --num-shards 4 --shard-index ${{ matrix.shard-index }}
stub-uploader:
name: Run the stub_uploader tests
if: ${{ github.repository == 'python/typeshed' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout typeshed
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: typeshed
- name: Checkout stub_uploader
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: typeshed-internal/stub_uploader
path: stub_uploader
- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.11"
cache: pip
cache-dependency-path: stub_uploader/requirements.txt
- name: Run tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Typecheck-typeshed-code
# This workflow is for testing typeshed's scripts and tests themselves
name: Meta-tests

on:
workflow_dispatch:
Expand All @@ -9,8 +10,9 @@ on:
paths:
- "scripts/**"
- "tests/**"
- ".github/workflows/typecheck_typeshed_code.yml"
- ".github/workflows/meta_tests.yml"
- "requirements-tests.txt"
- "pyproject.toml"

permissions:
contents: read
Expand All @@ -32,7 +34,7 @@ jobs:
platform: ["linux", "win32"]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.11"
Expand All @@ -48,7 +50,7 @@ jobs:
python-platform: ["Linux", "Windows"]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.9"
Expand All @@ -68,3 +70,19 @@ jobs:
python-platform: ${{ matrix.python-platform }}
python-version: "3.9"
project: ./pyrightconfig.scripts_and_tests.json
stubsabot-dry-run:
name: Stubsabot dry run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: pip
cache-dependency-path: requirements-tests.txt
- name: Git config
run: |
git config --global user.name stubsabot
git config --global user.email '<>'
- run: pip install -r requirements-tests.txt
- run: python scripts/stubsabot.py --action-level local
2 changes: 1 addition & 1 deletion .github/workflows/mypy_primer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
shard-index: [0, 1, 2, 3]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: typeshed_to_test
fetch-depth: 0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stubsabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
if: github.repository == 'python/typeshed'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# use an ssh key so that checks automatically run on stubsabot PRs
ssh-key: ${{ secrets.STUBSABOT_SSH_PRIVATE_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stubtest_stdlib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
fail-fast: false

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stubtest_third_party.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
fail-fast: false

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
Expand Down
53 changes: 21 additions & 32 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
name: Check file consistency
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.11"
Expand All @@ -39,17 +39,26 @@ jobs:
name: Ensure new syntax usage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- run: ./tests/check_new_syntax.py

ruff:
name: Lint with Ruff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
with:
version: "0.1.6" # must match .pre-commit-config.yaml and requirements-test.txt

flake8:
name: Lint with flake8
name: Lint with Flake8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.11"
Expand All @@ -62,10 +71,10 @@ jobs:
name: Run pytype against the stubs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.11"
cache: pip
cache-dependency-path: requirements-tests.txt
- run: pip install -r requirements-tests.txt
Expand All @@ -85,10 +94,10 @@ jobs:
strategy:
matrix:
platform: ["linux", "win32", "darwin"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -97,30 +106,11 @@ jobs:
- run: pip install -r requirements-tests.txt
- run: python ./tests/mypy_test.py --platform=${{ matrix.platform }} --python-version=${{ matrix.python-version }}

# Run mypy slightly differently on the py312 stubs,
# as at least one non-types dependency (greenlet) can't be installed on Python 3.12 yet
mypy-312:
name: Run mypy against the stubs (3.12)
runs-on: ubuntu-latest
strategy:
matrix:
platform: ["linux", "win32", "darwin"]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: pip
cache-dependency-path: requirements-tests.txt
- run: pip install -r requirements-tests.txt
- run: python ./tests/mypy_test.py --platform=${{ matrix.platform }} --python-version=3.12

regression-tests:
name: Run mypy on the test cases
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.11"
Expand All @@ -138,7 +128,7 @@ jobs:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.11"
Expand Down Expand Up @@ -195,13 +185,12 @@ jobs:
name: Run the stub_uploader tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout typeshed
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: typeshed
- name: Checkout stub_uploader
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: typeshed-internal/stub_uploader
path: stub_uploader
Expand Down
21 changes: 8 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0 # must match requirements-tests.txt
rev: v4.5.0 # must match requirements-tests.txt
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -9,29 +9,24 @@ repos:
- id: check-merge-conflict
- id: mixed-line-ending
- id: check-case-conflict
- repo: https://github.com/psf/black
rev: 23.7.0 # must match requirements-tests.txt
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.11.0 # must match requirements-tests.txt
hooks:
- id: black
language_version: python3.10
- repo: https://github.com/pycqa/isort
rev: 5.12.0 # must match requirements-tests.txt
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.280 # must match requirements-tests.txt
rev: v0.1.6 # must match requirements-tests.txt and tests.yml
hooks:
- id: ruff
args: [--exit-non-zero-on-fix]
args: [--exit-non-zero-on-fix, --fix-only]
- repo: https://github.com/pycqa/flake8
rev: 6.0.0 # must match requirements-tests.txt
rev: 6.1.0 # must match requirements-tests.txt
hooks:
- id: flake8
additional_dependencies:
- "flake8-bugbear==23.7.10" # must match requirements-tests.txt
- "flake8-bugbear==23.9.16" # must match requirements-tests.txt
- "flake8-noqa==1.3.2" # must match requirements-tests.txt
- "flake8-pyi==23.6.0" # must match requirements-tests.txt
- "flake8-pyi==23.11.0" # must match requirements-tests.txt
types: [file]
types_or: [python, pyi]

Expand Down
11 changes: 6 additions & 5 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"editorconfig.editorconfig",
"ms-python.black-formatter",
"ms-python.flake8",
"ms-python.isort",
"ms-python.mypy-type-checker",
"ms-python.python",
"ms-python.vscode-pylance",
Expand All @@ -16,18 +15,20 @@
],
"unwantedRecommendations": [
/*
* Don't recommend by default for this workspace
* Don't recommend by default for this workspace
*/
"christian-kohler.npm-intellisense",
/*
* Must disable in this workspace
* https://github.com/microsoft/vscode/issues/40239
* Must disable in this workspace
* https://github.com/microsoft/vscode/issues/40239
*/
// even-better-toml has format on save
"bungcip.better-toml",
// Don't use two mypy extensions simultaneously
"matangover.mypy",
// We use black
// Use Ruff instead
"ms-python.isort",
// We use Black
"ms-python.autopep8",
// Not using pylint
"ms-python.pylint",
Expand Down
Loading

0 comments on commit a4d8ebc

Please sign in to comment.