Skip to content

Commit d619c78

Browse files
authored
Support building mypycified mypy with PEP517 interface (#13445)
1 parent 330f79b commit d619c78

File tree

5 files changed

+17
-3
lines changed

5 files changed

+17
-3
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
if: ${{ matrix.test_mypyc }}
116116
run: |
117117
pip install -r test-requirements.txt
118-
CC=clang MYPYC_OPT_LEVEL=0 python3 setup.py --use-mypyc build_ext --inplace
118+
CC=clang MYPYC_OPT_LEVEL=0 MYPY_USE_MYPYC=1 pip install -e .
119119
- name: Setup tox environment
120120
run: tox -e ${{ matrix.toxenv }} --notest
121121
- name: Test

build-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# NOTE: this needs to be kept in sync with the "requires" list in pyproject.toml
12
-r mypy-requirements.txt
23
types-psutil
34
types-setuptools

mypy-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# NOTE: this needs to be kept in sync with the "requires" list in pyproject.toml
12
typing_extensions>=3.10
23
mypy_extensions>=0.4.3
34
typed_ast>=1.4.0,<2; python_version<'3.8'

pyproject.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
[build-system]
22
requires = [
3+
# NOTE: this needs to be kept in sync with mypy-requirements.txt
4+
# and build-requirements.txt, because those are both needed for
5+
# self-typechecking :/
36
"setuptools >= 40.6.2",
47
"wheel >= 0.30.0",
8+
# the following is from mypy-requirements.txt
9+
"typing_extensions>=3.10",
10+
"mypy_extensions>=0.4.3",
11+
"typed_ast>=1.4.0,<2; python_version<'3.8'",
12+
"tomli>=1.1.0; python_version<'3.11'",
13+
# the following is from build-requirements.txt
14+
"types-psutil",
15+
"types-setuptools",
16+
"types-typed-ast>=1.5.8,<1.6.0",
517
]
618
build-backend = "setuptools.build_meta"
719

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ def run(self):
7979

8080
USE_MYPYC = False
8181
# To compile with mypyc, a mypyc checkout must be present on the PYTHONPATH
82-
if len(sys.argv) > 1 and sys.argv[1] == "--use-mypyc":
83-
sys.argv.pop(1)
82+
if len(sys.argv) > 1 and "--use-mypyc" in sys.argv:
83+
sys.argv.remove("--use-mypyc")
8484
USE_MYPYC = True
8585
if os.getenv("MYPY_USE_MYPYC", None) == "1":
8686
USE_MYPYC = True

0 commit comments

Comments
 (0)