From 9ff2cd3cb4549c03ecc9cefc25600544dcdd9997 Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Thu, 18 Feb 2021 16:02:50 +0000 Subject: [PATCH 1/4] Reduce the size of the build by not compiling stubgen This might fix the out-of-memory errors we are getting when building Windows wheels. In any case these will speed up builds slightly. --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index aed725e74a514..004fc58998803 100644 --- a/setup.py +++ b/setup.py @@ -99,8 +99,12 @@ def run(self): # Also I think there would be problems with how we generate version.py. 'version.py', - # Can be removed once we drop support for Python 3.5.2 and lower. + # Skip these to reduce the size of the build 'stubtest.py', + 'stubgen.py', + 'stubgenc.py', + 'stubdoc.py', + 'stubutil.py', )) + ( # Don't want to grab this accidentally os.path.join('mypyc', 'lib-rt', 'setup.py'), From fc7e4f0497713f8cc225882f39fe52efe0df8f4e Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Thu, 18 Feb 2021 17:54:43 +0000 Subject: [PATCH 2/4] Empty commit to re-trigger builds From 4890b688f589f1b74bd8443c2720d9eedef8d9d0 Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Fri, 19 Feb 2021 10:50:19 +0000 Subject: [PATCH 3/4] Don't inherit an interpreted class from a compiled class --- mypy/stubgen.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/mypy/stubgen.py b/mypy/stubgen.py index c48ec3288f769..a12cd969e9ca6 100755 --- a/mypy/stubgen.py +++ b/mypy/stubgen.py @@ -192,7 +192,7 @@ def __init__(self, self.export_less = export_less -class StubSource(BuildSource): +class StubSource: """A single source for stub: can be a Python or C module. A simple extension of BuildSource that also carries the AST and @@ -200,10 +200,18 @@ class StubSource(BuildSource): """ def __init__(self, module: str, path: Optional[str] = None, runtime_all: Optional[List[str]] = None) -> None: - super().__init__(path, module, None) + self.source = BuildSource(path, module, None) self.runtime_all = runtime_all self.ast = None # type: Optional[MypyFile] + @property + def module(self) -> str: + return self.source.module + + @property + def path(self) -> Optional[str]: + return self.source.path + # What was generated previously in the stub file. We keep track of these to generate # nicely formatted output (add empty line between non-empty classes, for example). @@ -1435,7 +1443,7 @@ def generate_asts_for_modules(py_modules: List[StubSource], return # Perform full semantic analysis of the source set. try: - res = build(list(py_modules), mypy_options) + res = build([module.source for module in py_modules], mypy_options) except CompileError as e: raise SystemExit("Critical error during semantic analysis: {}".format(e)) from e From f3082e54d942ba59679ad1533d1318e6e2cc8e03 Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Fri, 19 Feb 2021 11:18:21 +0000 Subject: [PATCH 4/4] stubgen.py not supported since it inherits from compiled classes --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 004fc58998803..af896c0661959 100644 --- a/setup.py +++ b/setup.py @@ -101,7 +101,6 @@ def run(self): # Skip these to reduce the size of the build 'stubtest.py', - 'stubgen.py', 'stubgenc.py', 'stubdoc.py', 'stubutil.py',