python3-cython: remove obsolete SETUPTOOLS_INSTALL_ARGS
PATCH 1/2 python3-cython: remove obsolete SETUPTOOLS_INSTALL_ARGS
--- meta/recipes-devtools/python/python3-cython_3.0.11.bb | 5 ----- 1 file changed, 5 deletions(-)
meta/recipes-devtools/python/python3-cython_3.0.11.bb +0 -5
@@ -17,11 +17,6 @@ DEPENDS:remove = "python3-cython-native" UPSTREAM_CHECK_PYPI_PACKAGE = "Cython" -# running build_ext a second time during install fails, because Python -# would then attempt to import cythonized modules built for the target -# architecture. -SETUPTOOLS_INSTALL_ARGS += "--skip-build" - do_install:append() { # rename scripts that would conflict with the Python 2 build of Cython mv ${D}${bindir}/cython ${D}${bindir}/cython3
Signature · 1 line
2.34.1
PATCH 2/2 python3-setuptols: do parallel builds
Explicitly tell the build_ext task to do parallel builds, as it defaults to not.
In my testing this halves the build time of python3-pandas.
--- meta/classes-recipe/python_setuptools_build_meta.bbclass | 9 +++++++++ meta/classes-recipe/setuptools3.bbclass | 7 +++++++ 2 files changed, 16 insertions(+)
meta/classes-recipe/python_setuptools_build_meta.bbclass +9 -0
@@ -7,3 +7,12 @@ inherit setuptools3-base python_pep517 DEPENDS += "python3-setuptools-native python3-wheel-native" + +do_compile:prepend() { + # Write an extra config file to build in parallel + export DIST_EXTRA_CONFIG=${WORKDIR}/setuptools-extra.cfg + cat <<EOF >$DIST_EXTRA_CONFIG +[build_ext] +parallel = ${@oe.utils.parallel_make(d)} +EOF +}
meta/classes-recipe/setuptools3.bbclass +7 -0
@@ -31,6 +31,13 @@ setuptools3_do_configure() { } setuptools3_do_compile() { + # Write an extra config file to build in parallel + export DIST_EXTRA_CONFIG=${WORKDIR}/setuptools-extra.cfg + cat <<EOF >$DIST_EXTRA_CONFIG +[build_ext] +parallel = ${@oe.utils.parallel_make(d)} +EOF + cd ${SETUPTOOLS_SETUP_PATH} NO_FETCH_BUILD=1 \ STAGING_INCDIR=${STAGING_INCDIR} \
Signature · 1 line
2.34.1
Re: [PATCH 2/2] python3-setuptols: do parallel builds
On Tue, Nov 5, 2024 at 01:56 PM, Ross Burton wrote:
I find that patch incredibly risky, as there is no really opt-out.
As the main beneficiary is pandas (which is not in core), which not add it there as a patch?
Also other suggest that all that can be achieved with --global-option="build_ext" --global-option="-j5" set by PEP517_BUILD_OPTS, which would find the much better options here.
Something like
PARALLEL_PEP517_BUILD ?= " --global-option="build_ext" --global-option="-j<job count>"" PEP517_BUILD_OPTS:append = " ${PARALLEL_PEP517_BUILD}"
Re: [OE-core] [PATCH 2/2] python3-setuptols: do parallel builds
Quoted 5 lines · Konrad Weihmann via lists.openembedded.org
On Tue, Nov 5, 2024 at 01:56 PM, Ross Burton wrote:
I find that patch incredibly risky, as there is no really opt-out.
As the main beneficiary is pandas (which is not in core), which not add it there as a patch?
You can opt out by setting PARALLEL_MAKE to -j1. Pandas is where I noticed, but I expect it will make a difference for any package that builds extensions with setuptools.
Quoted 7 lines
Also other suggest that all that can be achieved with --global-option="build_ext" --global-option="-j5" set by
PEP517_BUILD_OPTS, which would find the much better options here.Something like
PARALLEL_PEP517_BUILD?= " --global-option="build_ext" --global-option="-j<job count>"" PEP517_BUILD_OPTS:append = " ${PARALLEL_PEP517_BUILD}”
That’s possibly a neater solution, yes. I tried using global-option but couldn’t get it to work right.
Ross
Re: [OE-core] [PATCH 2/2] python3-setuptols: do parallel builds
Quoted 12 lines · Ross Burton
Quoted 5 lines · Konrad Weihmann via lists.openembedded.org
On Tue, Nov 5, 2024 at 01:56 PM, Ross Burton wrote:
I find that patch incredibly risky, as there is no really opt-out.
As the main beneficiary is pandas (which is not in core), which not add it there as a patch?You can opt out by setting
PARALLEL_MAKEto -j1. Pandas is where I noticed, but I expect it will make a difference for any package that builds extensions with setuptools.Quoted 3 lines
Also other suggest that all that can be achieved with --global-option="build_ext" --global-option="-j5" set by
PEP517_BUILD_OPTS, which would find the much better options here.
Quoted 9 lines
Quoted 4 lines
Something like
PARALLEL_PEP517_BUILD?= " --global-option="build_ext" --global-option="-j<job count>"" PEP517_BUILD_OPTS:append = " ${PARALLEL_PEP517_BUILD}”That’s possibly a neater solution, yes. I tried using global-option but couldn’t get it to work right.
Ross
Here's a monkey patch to expose the missing option
setuptools/command/bdist_wheel.py +7 -0
@@ -234,6 +234,11 @@ class bdist_wheel(Command): "result of calling the PEP517 'prepare_metadata_for_build_wheel' " "method)", ), + ( + "parallel=", + "j", + "number of parallel build jobs", + ), ] boolean_options = ["keep-temp", "skip-build", "relative", "universal"]
@@ -259,6 +264,7 @@ class bdist_wheel(Command): self.build_number: str | None = None self.py_limited_api: str | Literal[False] = False self.plat_name_supplied = False + self.parallel = None def finalize_options(self) -> None: if not self.bdist_dir:
@@ -398,6 +404,7 @@ class bdist_wheel(Command): build_ext = self.reinitialize_command("build_ext") build_ext.inplace = False + build_ext.parallel = self.parallel if not self.skip_build: self.run_command("build")
feel free to propose that to upstream, as I think it's the better option in the long run.
And yeah I have to agree for pandas it's like a day and night difference, on 20+ cores it's almost fun to compile it now :-)
Cheers
Konrad
Re: [OE-core] [PATCH 2/2] python3-setuptols: do parallel builds
In reply to Ross BurtonQuoted 12 lines · Ross Burton
Quoted 5 lines · Konrad Weihmann via lists.openembedded.org
On Tue, Nov 5, 2024 at 01:56 PM, Ross Burton wrote:
I find that patch incredibly risky, as there is no really opt-out.
As the main beneficiary is pandas (which is not in core), which not add it there as a patch?You can opt out by setting
PARALLEL_MAKEto -j1. Pandas is where I noticed, but I expect it will make a difference for any package that builds extensions with setuptools.Quoted 3 lines
Also other suggest that all that can be achieved with --global-option="build_ext" --global-option="-j5" set by
PEP517_BUILD_OPTS, which would find the much better options here.
Quoted 9 lines
Quoted 4 lines
Something like
PARALLEL_PEP517_BUILD?= " --global-option="build_ext" --global-option="-j<job count>"" PEP517_BUILD_OPTS:append = " ${PARALLEL_PEP517_BUILD}”That’s possibly a neater solution, yes. I tried using global-option but couldn’t get it to work right.
Ross
Maybe as an addition, why I would like this feature to added in a very transparent and easy to undo way:
https://github.com/pypa/setuptools/issues/3119 - I'm a bit worried that in the wider ecosystem things will fall apart easily, if parallel builds are the default.
And as comment for the v2 of the patch:
I believe --bdist-dir does set the build dir to a path of your choice already
Re: [OE-core] [PATCH 2/2] python3-setuptols: do parallel builds
Quoted 2 lines · Konrad Weihmann
And as comment for the v2 of the patch:
I believe --bdist-dir does set the build dir to a path of your choice already
It sets the directory for the binary distribution not the intermediate build tree.
Ross