From 292f94137dacd594d161370f05ef635133e42972 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Thu, 9 Jan 2020 11:31:08 -0800 Subject: [PATCH 1/3] Parallel compilation for windows --- setup.py | 67 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/setup.py b/setup.py index c33ce063cb4d9..66ff1934948ef 100755 --- a/setup.py +++ b/setup.py @@ -9,6 +9,7 @@ import argparse from distutils.sysconfig import get_config_vars from distutils.version import LooseVersion +import multiprocessing import os from os.path import join as pjoin import platform @@ -748,34 +749,38 @@ def srcpath(name=None, suffix=".pyx", subdir="src"): # The build cache system does string matching below this point. # if you change something, be careful. -setup( - name=DISTNAME, - maintainer=AUTHOR, - version=versioneer.get_version(), - packages=find_packages(include=["pandas", "pandas.*"]), - package_data={"": ["templates/*", "_libs/*.dll"]}, - ext_modules=maybe_cythonize(extensions, compiler_directives=directives), - maintainer_email=EMAIL, - description=DESCRIPTION, - license=LICENSE, - cmdclass=cmdclass, - url=URL, - download_url=DOWNLOAD_URL, - project_urls=PROJECT_URLS, - long_description=LONG_DESCRIPTION, - classifiers=CLASSIFIERS, - platforms="any", - python_requires=">=3.6.1", - extras_require={ - "test": [ - # sync with setup.cfg minversion & install.rst - "pytest>=4.0.2", - "pytest-xdist", - "hypothesis>=3.58", - ] - }, - entry_points={ - "pandas_plotting_backends": ["matplotlib = pandas:plotting._matplotlib"] - }, - **setuptools_kwargs, -) +if __name__ == "__main__": + # Freeze to support parallel compilation when using spawn instead of fork + multiprocessing.freeze_support() + + setup( + name=DISTNAME, + maintainer=AUTHOR, + version=versioneer.get_version(), + packages=find_packages(include=["pandas", "pandas.*"]), + package_data={"": ["templates/*", "_libs/*.dll"]}, + ext_modules=maybe_cythonize(extensions, compiler_directives=directives), + maintainer_email=EMAIL, + description=DESCRIPTION, + license=LICENSE, + cmdclass=cmdclass, + url=URL, + download_url=DOWNLOAD_URL, + project_urls=PROJECT_URLS, + long_description=LONG_DESCRIPTION, + classifiers=CLASSIFIERS, + platforms="any", + python_requires=">=3.6.1", + extras_require={ + "test": [ + # sync with setup.cfg minversion & install.rst + "pytest>=4.0.2", + "pytest-xdist", + "hypothesis>=3.58", + ] + }, + entry_points={ + "pandas_plotting_backends": ["matplotlib = pandas:plotting._matplotlib"] + }, + **setuptools_kwargs, + ) From 2ca1b033f3d28e150ff6600b24248d0288c737ba Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Thu, 9 Jan 2020 11:31:48 -0800 Subject: [PATCH 2/3] removed unneeded check --- setup.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/setup.py b/setup.py index 66ff1934948ef..ab22c9b784ee0 100755 --- a/setup.py +++ b/setup.py @@ -533,11 +533,6 @@ def maybe_cythonize(extensions, *args, **kwargs): elif parsed.j: nthreads = parsed.j - # GH#30356 Cythonize doesn't support parallel on Windows - if is_platform_windows() and nthreads > 0: - print("Parallel build for cythonize ignored on Windows") - nthreads = 0 - kwargs["nthreads"] = nthreads build_ext.render_templates(_pxifiles) return cythonize(extensions, *args, **kwargs) From 64db610b3b1d6cbec764f798e879a52381811f9e Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Mon, 20 Jan 2020 15:39:35 -0800 Subject: [PATCH 3/3] setup_package func --- setup.py | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/setup.py b/setup.py index 80b2c87d4c86e..ca5c67fc079ab 100755 --- a/setup.py +++ b/setup.py @@ -36,17 +36,6 @@ def is_platform_mac(): min_numpy_ver = "1.13.3" min_cython_ver = "0.29.13" # note: sync with pyproject.toml -setuptools_kwargs = { - "install_requires": [ - "python-dateutil >= 2.6.1", - "pytz >= 2017.2", - f"numpy >= {min_numpy_ver}", - ], - "setup_requires": [f"numpy >= {min_numpy_ver}"], - "zip_safe": False, -} - - try: import Cython @@ -740,12 +729,16 @@ def srcpath(name=None, suffix=".pyx", subdir="src"): # ---------------------------------------------------------------------- -# The build cache system does string matching below this point. -# if you change something, be careful. - -if __name__ == "__main__": - # Freeze to support parallel compilation when using spawn instead of fork - multiprocessing.freeze_support() +def setup_package(): + setuptools_kwargs = { + "install_requires": [ + "python-dateutil >= 2.6.1", + "pytz >= 2017.2", + f"numpy >= {min_numpy_ver}", + ], + "setup_requires": [f"numpy >= {min_numpy_ver}"], + "zip_safe": False, + } setup( name=DISTNAME, @@ -778,3 +771,9 @@ def srcpath(name=None, suffix=".pyx", subdir="src"): }, **setuptools_kwargs, ) + + +if __name__ == "__main__": + # Freeze to support parallel compilation when using spawn instead of fork + multiprocessing.freeze_support() + setup_package()