Skip to content

Commit

Permalink
Unpin the types-setuptools build dependency (#14787)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
AlexWaygood authored Feb 28, 2023
1 parent 1853222 commit 243f584
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
3 changes: 1 addition & 2 deletions build-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# NOTE: this needs to be kept in sync with the "requires" list in pyproject.toml
-r mypy-requirements.txt
types-psutil
# TODO: fix build when using the latest version of types-setuptools
types-setuptools<67.4.0.2
types-setuptools
types-typed-ast>=1.5.8,<1.6.0
11 changes: 7 additions & 4 deletions mypyc/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

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

if not use_setuptools:
from distutils.core import Extension
import distutils.core

extension_class = distutils.core.Extension
else:
from setuptools import Extension
extension_class = setuptools.Extension

return Extension
return extension_class


def setup_mypycify_vars() -> None:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ requires = [
"tomli>=1.1.0; python_version<'3.11'",
# the following is from build-requirements.txt
"types-psutil",
"types-setuptools<67.4.0.2", # TODO: fix build when using the latest version of types-setuptools
"types-setuptools",
"types-typed-ast>=1.5.8,<1.6.0",
]
build-backend = "setuptools.build_meta"
Expand Down

0 comments on commit 243f584

Please sign in to comment.