Skip to content

Commit ed06e36

Browse files
committed
mypy runner script
since we have to do something special to get their c extension to build
1 parent 472e6cc commit ed06e36

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

run_mypy.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# mypy is special in that they distribute a C extension only for CPython,
2+
# and while it looks like you are supposed to be able to do
3+
# MYPY_USE_MYPYC pip install --no-binary mypy
4+
# to compile the C extension yourself, I get an error when I try that.
5+
# So instead, clone their repo and build it from there.
6+
7+
set -e
8+
9+
if [ -z "$1" ]; then
10+
echo "Usage: $0 python_executable"
11+
exit 1
12+
fi
13+
14+
BINARY=$1
15+
16+
set -u
17+
set -x
18+
19+
ENV=/tmp/macrobenchmark_env
20+
rm -rf $ENV
21+
virtualenv -p $BINARY $ENV
22+
23+
rm -rf /tmp/mypy
24+
git clone --depth 1 --branch v0.790 https://github.com/python/mypy/ /tmp/mypy
25+
cd /tmp/mypy
26+
27+
$ENV/bin/pip install -r mypy-requirements.txt
28+
$ENV/bin/pip install --upgrade setuptools
29+
git submodule update --init mypy/typeshed
30+
$ENV/bin/python setup.py --use-mypyc install
31+
32+
cd -
33+
time $ENV/bin/python benchmarks/mypy_bench.py 50
34+
time $ENV/bin/python benchmarks/mypy_bench.py 50
35+
time $ENV/bin/python benchmarks/mypy_bench.py 50
36+

0 commit comments

Comments
 (0)