Skip to content

Commit 243f584

Browse files
authored
Unpin the types-setuptools build dependency (#14787)
- The latest release of `types-setuptools` started causing type-check errors (and, therefore, mypyc build errors) on the `master` branch: see, e.g. https://github.com/python/mypy/actions/runs/4275505309/jobs/7442902732. - #14781 addressed some of the new errors, but didn't quite fix the build. - #14788 then pinned the `types-setuptools` dependency as a temporary stopgap measure. - This PR now attempts to unpin `types-setuptools` and fix the build errors in a more principled way.
1 parent 1853222 commit 243f584

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

build-requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# NOTE: this needs to be kept in sync with the "requires" list in pyproject.toml
22
-r mypy-requirements.txt
33
types-psutil
4-
# TODO: fix build when using the latest version of types-setuptools
5-
types-setuptools<67.4.0.2
4+
types-setuptools
65
types-typed-ast>=1.5.8,<1.6.0

mypyc/build.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
try:
5353
# Import setuptools so that it monkey-patch overrides distutils
54-
import setuptools # noqa: F401
54+
import setuptools
5555
except ImportError:
5656
if sys.version_info >= (3, 12):
5757
# Raise on Python 3.12, since distutils will go away forever
@@ -63,13 +63,16 @@ def get_extension() -> type[Extension]:
6363
# We can work with either setuptools or distutils, and pick setuptools
6464
# if it has been imported.
6565
use_setuptools = "setuptools" in sys.modules
66+
extension_class: type[Extension]
6667

6768
if not use_setuptools:
68-
from distutils.core import Extension
69+
import distutils.core
70+
71+
extension_class = distutils.core.Extension
6972
else:
70-
from setuptools import Extension
73+
extension_class = setuptools.Extension
7174

72-
return Extension
75+
return extension_class
7376

7477

7578
def setup_mypycify_vars() -> None:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ requires = [
1212
"tomli>=1.1.0; python_version<'3.11'",
1313
# the following is from build-requirements.txt
1414
"types-psutil",
15-
"types-setuptools<67.4.0.2", # TODO: fix build when using the latest version of types-setuptools
15+
"types-setuptools",
1616
"types-typed-ast>=1.5.8,<1.6.0",
1717
]
1818
build-backend = "setuptools.build_meta"

0 commit comments

Comments
 (0)