Skip to content

Commit b524c66

Browse files
author
hauntsaninja
committed
Merge remote-tracking branch 'upstream/master' into nspcdef
2 parents 088990d + c90026b commit b524c66

File tree

1,345 files changed

+104221
-16855
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,345 files changed

+104221
-16855
lines changed

.github/workflows/mypy_primer.yml

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ name: Run mypy_primer
22

33
on:
44
# Only run on PR, since we diff against master
5-
# pull_request_target gives us access to a write token
6-
pull_request_target:
5+
pull_request:
76
paths-ignore:
87
- 'docs/**'
98
- '**/*.rst'
@@ -12,15 +11,19 @@ on:
1211

1312
jobs:
1413
mypy_primer:
15-
name: Run mypy_primer
14+
name: Run
1615
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
strategy:
19+
matrix:
20+
shard-index: [0, 1, 2]
21+
fail-fast: false
1722
steps:
1823
- uses: actions/checkout@v2
1924
with:
2025
path: mypy_to_test
2126
fetch-depth: 0
22-
# pull_request_target checks out the PR base branch by default
23-
ref: refs/pull/${{ github.event.pull_request.number }}/merge
2427
- uses: actions/setup-python@v2
2528
with:
2629
python-version: 3.8
@@ -33,30 +36,34 @@ jobs:
3336
run: |
3437
cd mypy_to_test
3538
echo "new commit"
36-
COMMIT=$(git rev-parse HEAD)
37-
git rev-list --format=%s --max-count=1 $COMMIT
39+
git rev-list --format=%s --max-count=1 $GITHUB_SHA
3840
git checkout -b upstream_master origin/master
3941
echo "base commit"
4042
git rev-list --format=%s --max-count=1 upstream_master
4143
echo ''
4244
cd ..
43-
( mypy_primer --repo mypy_to_test --new $COMMIT --old upstream_master --mypyc-compile-level 0 -o concise | tee diff.txt ) || [ $? -eq 1 ]
44-
- name: Post comment
45-
uses: actions/github-script@v3
45+
# fail action if exit code isn't zero or one
46+
(
47+
mypy_primer \
48+
--repo mypy_to_test \
49+
--new $GITHUB_SHA --old upstream_master \
50+
--num-shards 3 --shard-index ${{ matrix.shard-index }} \
51+
--debug \
52+
--output concise \
53+
| tee diff_${{ matrix.shard-index }}.txt
54+
) || [ $? -eq 1 ]
55+
- name: Upload mypy_primer diff
56+
uses: actions/upload-artifact@v2
4657
with:
47-
github-token: ${{secrets.GITHUB_TOKEN}}
48-
script: |
49-
const fs = require('fs').promises;
50-
try {
51-
data = await fs.readFile('diff.txt', 'utf-8')
52-
if (data.trim()) {
53-
await github.issues.createComment({
54-
issue_number: context.issue.number,
55-
owner: context.repo.owner,
56-
repo: context.repo.repo,
57-
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 + '```'
58-
})
59-
}
60-
} catch (error) {
61-
console.log(error)
62-
}
58+
name: mypy_primer_diffs
59+
path: diff_${{ matrix.shard-index }}.txt
60+
- if: ${{ matrix.shard-index }} == 0
61+
name: Save PR number
62+
run: |
63+
echo ${{ github.event.pull_request.number }} | tee pr_number.txt
64+
- if: ${{ matrix.shard-index }} == 0
65+
name: Upload PR number
66+
uses: actions/upload-artifact@v2
67+
with:
68+
name: mypy_primer_diffs
69+
path: pr_number.txt
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Comment with mypy_primer diff
2+
3+
on:
4+
workflow_run:
5+
workflows:
6+
- Run mypy_primer
7+
types:
8+
- completed
9+
10+
permissions:
11+
contents: read
12+
pull-requests: write
13+
14+
jobs:
15+
comment:
16+
name: Comment PR from mypy_primer
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Download diffs
20+
uses: actions/github-script@v3
21+
with:
22+
script: |
23+
const fs = require('fs');
24+
const artifacts = await github.actions.listWorkflowRunArtifacts({
25+
owner: context.repo.owner,
26+
repo: context.repo.repo,
27+
run_id: ${{ github.event.workflow_run.id }},
28+
});
29+
const [matchArtifact] = artifacts.data.artifacts.filter((artifact) =>
30+
artifact.name == "mypy_primer_diffs");
31+
32+
const download = await github.actions.downloadArtifact({
33+
owner: context.repo.owner,
34+
repo: context.repo.repo,
35+
artifact_id: matchArtifact.id,
36+
archive_format: "zip",
37+
});
38+
fs.writeFileSync("diff.zip", Buffer.from(download.data));
39+
40+
- run: unzip diff.zip
41+
42+
# Based on https://github.com/kanga333/comment-hider
43+
- name: Hide old comments
44+
uses: actions/github-script@v3
45+
with:
46+
github-token: ${{secrets.GITHUB_TOKEN}}
47+
script: |
48+
const fs = require('fs')
49+
50+
const response = await github.issues.listComments({
51+
issue_number: fs.readFileSync("pr_number.txt", { encoding: "utf8" }),
52+
owner: context.repo.owner,
53+
repo: context.repo.repo,
54+
})
55+
const botCommentIds = response.data
56+
.filter(comment => comment.user.login === 'github-actions[bot]')
57+
.map(comment => comment.node_id)
58+
59+
for (const id of botCommentIds) {
60+
const resp = await github.graphql(`
61+
mutation {
62+
minimizeComment(input: {classifier: OUTDATED, subjectId: "${id}"}) {
63+
minimizedComment {
64+
isMinimized
65+
}
66+
}
67+
}
68+
`)
69+
if (resp.errors) {
70+
throw new Error(resp.errors)
71+
}
72+
}
73+
74+
- name: Post comment
75+
uses: actions/github-script@v3
76+
with:
77+
github-token: ${{secrets.GITHUB_TOKEN}}
78+
script: |
79+
const fs = require('fs')
80+
// Keep in sync with shards produced by mypy_primer workflow
81+
const data = (
82+
['diff_0.txt', 'diff_1.txt', 'diff_2.txt']
83+
.map(fileName => fs.readFileSync(fileName, { encoding: 'utf8' }))
84+
.join('')
85+
.substr(0, 30000) // About 300 lines
86+
)
87+
88+
console.log("Diff from mypy_primer:")
89+
console.log(data)
90+
91+
if (data.trim()) {
92+
const 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 + '```'
93+
await github.issues.createComment({
94+
issue_number: fs.readFileSync("pr_number.txt", { encoding: "utf8" }),
95+
owner: context.repo.owner,
96+
repo: context.repo.repo,
97+
body
98+
})
99+
}

.github/workflows/test.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,13 @@ jobs:
3434
toxenv: py37
3535

3636
steps:
37-
- uses: actions/checkout@v1
38-
- name: initialize submodules
39-
run: git submodule update --init
40-
- uses: actions/setup-python@v1
37+
- uses: actions/checkout@v2
38+
- uses: actions/setup-python@v2
4139
with:
4240
python-version: ${{ matrix.python }}
4341
architecture: ${{ matrix.arch }}
4442
- name: install tox
45-
run: pip install --upgrade 'setuptools!=50' 'virtualenv<20' tox==3.20.1
43+
run: pip install --upgrade 'setuptools!=50' 'virtualenv<16.7.11' tox==3.20.1
4644
- name: setup tox environment
4745
run: tox -e ${{ matrix.toxenv }} --notest
4846
- name: test

.github/workflows/test_stubgenc.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Test stubgenc on pybind11-mypy-demo
2+
3+
on:
4+
push:
5+
branches: [master]
6+
tags: ['*']
7+
pull_request:
8+
paths:
9+
- 'misc/test-stubgenc.sh'
10+
- 'mypy/stubgenc.py'
11+
- 'mypy/stubdoc.py'
12+
- 'test-data/stubgen/**'
13+
14+
jobs:
15+
stubgenc:
16+
# Check stub file generation for a small pybind11 project
17+
# (full text match is required to pass)
18+
runs-on: ubuntu-latest
19+
steps:
20+
21+
- uses: actions/checkout@v2
22+
23+
- name: Setup 🐍 3.8
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: 3.8
27+
28+
- name: Test stubgenc
29+
run: misc/test-stubgenc.sh

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ build/
22
__pycache__
33
*.py[cod]
44
*~
5-
@*
65
/build
76
/env*/
87
docs/build/
98
docs/source/_build
9+
mypyc/doc/_build
1010
*.iml
1111
/out/
1212
.venv*/
13+
venv/
1314
.mypy_cache/
1415
.incremental_checker_cache.json
1516
.cache
@@ -44,6 +45,8 @@ htmlcov
4445
bin/
4546
lib/
4647
include/
48+
.python-version
49+
pyvenv.cfg
4750

4851
.tox
4952
pip-wheel-metadata

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

.travis.yml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,26 @@ env:
2222
PYTHON_DEBUG_BUILD=0
2323

2424
jobs:
25+
fast_finish: true
2526
include:
26-
# Specifically request 3.5.1 because we need to be compatible with that.
27-
- name: "run test suite with python 3.5.1 (compiled with mypyc)"
28-
python: 3.5.1
29-
dist: trusty
27+
- name: "run test suite with python 3.6 (compiled with mypyc)"
28+
python: 3.6 # 3.6.3 pip 9.0.1
3029
env:
3130
- TOXENV=py
3231
- EXTRA_ARGS="-n 2"
3332
- TEST_MYPYC=1
34-
- name: "run test suite with python 3.6"
35-
python: 3.6 # 3.6.3 pip 9.0.1
36-
- name: "run test suite with python 3.7 (compiled with mypyc)"
33+
- name: "run test suite with python 3.7"
3734
python: 3.7
35+
- name: "run test suite with python 3.8"
36+
python: 3.8
37+
- name: "run test suite with python 3.9 (compiled with mypyc)"
38+
python: 3.9
3839
env:
3940
- TOXENV=py
4041
- EXTRA_ARGS="-n 2"
4142
- TEST_MYPYC=1
42-
- name: "run test suite with python 3.8"
43-
python: 3.8
44-
- name: "run test suite with python 3.9"
45-
python: 3.9
43+
- name: "run test suite with python nightly"
44+
python: nightly
4645
- name: "run mypyc runtime tests with python 3.6 debug build"
4746
language: generic
4847
env:
@@ -80,10 +79,13 @@ jobs:
8079
# env:
8180
# - TOXENV=dev
8281
# - EXTRA_ARGS=
82+
allow_failures:
83+
- python: nightly
8384

8485
install:
85-
- pip install -U pip setuptools
86-
- pip install -U 'virtualenv<20'
86+
# pip 21.0 no longer works on Python 3.5
87+
- pip install -U pip==20.3.4 setuptools
88+
- pip install -U 'virtualenv<16.7.11'
8789
- pip install -U tox==3.20.1
8890
- python2 -m pip install --user -U typing
8991
- tox --notest
@@ -92,7 +94,7 @@ install:
9294
# means that tox picks up the mypy from the source directories instead of
9395
# the version it installed into a venv. This is also *why* we need to do this,
9496
# since if we arranged for tox to build with mypyc, pytest wouldn't use it.
95-
- if [[ $TEST_MYPYC == 1 ]]; then pip install -r mypy-requirements.txt; CC=clang MYPYC_OPT_LEVEL=0 python3 setup.py --use-mypyc build_ext --inplace; fi
97+
- if [[ $TEST_MYPYC == 1 ]]; then pip install -r test-requirements.txt; CC=clang MYPYC_OPT_LEVEL=0 python3 setup.py --use-mypyc build_ext --inplace; fi
9698

9799
script:
98100
- tox --skip-pkg-install -- $EXTRA_ARGS

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Getting started, building, and testing
1212

1313
If you haven't already, take a look at the project's
1414
[README.md file](README.md)
15-
and the [Mypy documentation](http://mypy.readthedocs.io/en/latest/),
15+
and the [Mypy documentation](https://mypy.readthedocs.io/en/latest/),
1616
and try adding type annotations to your file and type-checking it with Mypy.
1717

1818

LICENSE

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Mypy (and mypyc) are licensed under the terms of the MIT license, reproduced bel
44

55
The MIT License
66

7-
Copyright (c) 2015-2019 Jukka Lehtosalo and contributors
7+
Copyright (c) 2015-2021 Jukka Lehtosalo and contributors
88

99
Permission is hereby granted, free of charge, to any person obtaining a
1010
copy of this software and associated documentation files (the "Software"),
@@ -28,8 +28,9 @@ DEALINGS IN THE SOFTWARE.
2828

2929
Portions of mypy and mypyc are licensed under different licenses. The
3030
files under stdlib-samples as well as the files
31-
mypyc/lib-rt/pythonsupport.h and mypyc/lib-rt/getargs.c are licensed
32-
under the PSF 2 License, reproduced below.
31+
mypyc/lib-rt/pythonsupport.h, mypyc/lib-rt/getargs.c and
32+
mypyc/lib-rt/getargsfast.c are licensed under the PSF 2 License, reproduced
33+
below.
3334

3435
= = = = =
3536

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
# stubs
55
prune mypy/typeshed
6+
include mypy/typeshed/LICENSE
7+
include mypy/typeshed/stdlib/VERSIONS
68
recursive-include mypy/typeshed *.pyi
79

810
# mypy and mypyc
@@ -28,6 +30,7 @@ graft mypyc/doc
2830

2931
# files necessary for testing sdist
3032
include mypy-requirements.txt
33+
include build-requirements.txt
3134
include test-requirements.txt
3235
include mypy_self_check.ini
3336
prune misc

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy