Skip to content

Commit 943d04a

Browse files
committed
Fail with an explicit error on PyPy
1 parent b0abcac commit 943d04a

4 files changed

Lines changed: 13 additions & 5 deletions

File tree

mypy-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ typing_extensions>=4.6.0
44
mypy_extensions>=1.0.0
55
pathspec>=0.9.0
66
tomli>=1.1.0; python_version<'3.11'
7-
librt>=0.6.2
7+
librt>=0.6.2; platform_python_implementation != 'PyPy'

mypy/build.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,15 @@
4040
TypedDict,
4141
)
4242

43-
from librt.internal import cache_version
43+
try:
44+
from librt.internal import cache_version
45+
except ImportError:
46+
print(
47+
"Running mypy on PyPy is not supported yet."
48+
"To type-check a PyPy library please run mypy on an equivalent CPython version,"
49+
"see https://github.com/mypyc/librt/issues/16 for possible workarounds."
50+
)
51+
sys.exit(2)
4452

4553
import mypy.semanal_main
4654
from mypy.cache import CACHE_VERSION, CacheMeta, ReadBuffer, WriteBuffer, write_json

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ requires = [
99
"mypy_extensions>=1.0.0",
1010
"pathspec>=0.9.0",
1111
"tomli>=1.1.0; python_version<'3.11'",
12-
"librt>=0.6.2",
12+
"librt>=0.6.2; platform_python_implementation != 'PyPy'",
1313
# the following is from build-requirements.txt
1414
"types-psutil",
1515
"types-setuptools",
@@ -53,7 +53,7 @@ dependencies = [
5353
"mypy_extensions>=1.0.0",
5454
"pathspec>=0.9.0",
5555
"tomli>=1.1.0; python_version<'3.11'",
56-
"librt>=0.6.2",
56+
"librt>=0.6.2; platform_python_implementation != 'PyPy'",
5757
]
5858
dynamic = ["version"]
5959

test-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ identify==2.6.15
2222
# via pre-commit
2323
iniconfig==2.1.0
2424
# via pytest
25-
librt==0.6.2
25+
librt==0.7.3 ; platform_python_implementation != 'PyPy'
2626
# via -r mypy-requirements.txt
2727
lxml==6.0.2 ; python_version < "3.15"
2828
# via -r test-requirements.in

0 commit comments

Comments
 (0)