Skip to content

Commit bd793af

Browse files
authored
Use pyproject.toml instead of mypy.ini (#274)
1 parent 6a34fb0 commit bd793af

7 files changed

+299
-301
lines changed

mypy.ini

-10
This file was deleted.

pyproject.toml

+8
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,11 @@ build-backend = "setuptools.build_meta"
77

88
[tool.black]
99
extend-exclude = "(_pb2.pyi?$|_pb2_grpc.pyi?$)"
10+
11+
[tool.mypy]
12+
strict = true
13+
show_error_codes = true
14+
15+
[[tool.mypy.overrides]]
16+
module = "pytest.*"
17+
ignore_missing_imports = true

run_test.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ MYPY_PROTOBUF_VENV=venv_$PY_VER_MYPY_PROTOBUF
7777

7878
# Run mypy on mypy-protobuf internal code for developers to catch issues
7979
FILES="mypy_protobuf/main.py"
80-
$MYPY_VENV/bin/mypy --strict --custom-typeshed-dir=$CUSTOM_TYPESHED_DIR --python-executable=$MYPY_PROTOBUF_VENV/bin/python3 --python-version=$PY_VER_MYPY_PROTOBUF_SHORT --pretty --show-error-codes $FILES
80+
$MYPY_VENV/bin/mypy --custom-typeshed-dir=$CUSTOM_TYPESHED_DIR --python-executable=$MYPY_PROTOBUF_VENV/bin/python3 --python-version=$PY_VER_MYPY_PROTOBUF_SHORT $FILES
8181

8282
# Generate protos
8383
python --version
@@ -142,7 +142,7 @@ for PY_VER in $PY_VER_UNIT_TESTS; do
142142
else
143143
FILES=$FILES38
144144
fi
145-
mypy --strict --custom-typeshed-dir=$CUSTOM_TYPESHED_DIR --python-executable=$UNIT_TESTS_VENV/bin/python --python-version=$PY_VER_MYPY_TARGET --pretty --show-error-codes $FILES
145+
mypy --custom-typeshed-dir=$CUSTOM_TYPESHED_DIR --python-executable=$UNIT_TESTS_VENV/bin/python --python-version=$PY_VER_MYPY_TARGET $FILES
146146

147147
# run mypy on negative-tests (expected mypy failures)
148148
# --python-version=2.7 chokes on the generated grpc files - so split them out here
@@ -158,7 +158,7 @@ for PY_VER in $PY_VER_UNIT_TESTS; do
158158
call_mypy() {
159159
# Write output to file. Make variant w/ omitted line numbers for easy diffing / CR
160160
PY_VER_MYPY_TARGET=$(echo $1 | cut -d. -f1-2)
161-
mypy --strict --custom-typeshed-dir=$CUSTOM_TYPESHED_DIR --python-executable=venv_$1/bin/python --python-version=$PY_VER_MYPY_TARGET ${@: 2} > $MYPY_OUTPUT/mypy_output || true
161+
mypy --custom-typeshed-dir=$CUSTOM_TYPESHED_DIR --python-executable=venv_$1/bin/python --python-version=$PY_VER_MYPY_TARGET ${@: 2} > $MYPY_OUTPUT/mypy_output || true
162162
cut -d: -f1,3- $MYPY_OUTPUT/mypy_output > $MYPY_OUTPUT/mypy_output.omit_linenos
163163
}
164164

test_negative/output.expected.2.7

+64-64
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test_negative/output.expected.2.7.omit_linenos

+64-64
Large diffs are not rendered by default.

test_negative/output.expected.3.8

+80-80
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test_negative/output.expected.3.8.omit_linenos

+80-80
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)