All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] python3-installer: add installer module
@ 2022-03-10 17:16 Ross Burton
  2022-03-10 17:16 ` [PATCH 2/2] pip_install_wheel: use installer instead of pip Ross Burton
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Ross Burton @ 2022-03-10 17:16 UTC (permalink / raw)
  To: openembedded-core

Add a recipe for Installer, a minimal library/tool to install Python
Wheels.  Unlike PIP, it explicitly only installs wheels and does nothing
else.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 .../python/python3-installer_0.5.0.bb         | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-installer_0.5.0.bb

diff --git a/meta/recipes-devtools/python/python3-installer_0.5.0.bb b/meta/recipes-devtools/python/python3-installer_0.5.0.bb
new file mode 100644
index 0000000000..bde9397569
--- /dev/null
+++ b/meta/recipes-devtools/python/python3-installer_0.5.0.bb
@@ -0,0 +1,20 @@
+SUMMARY = "A library for installing Python wheels"
+DESCRIPTION = "a low-level library for installing a Python package from a wheel distribution."
+HOMEPAGE = "https://installer.readthedocs.io/"
+BUGTRACKER = "https://github.com/pradyunsg/installer/issues"
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=5038641aec7a77451e31da828ebfae00"
+
+SRC_URI[sha256sum] = "0cd6bdab3b358cf7e8749370b99aef9e12202751271c5ddb22126599b34dc665"
+
+inherit pypi flit_core
+
+DEPENDS:remove:class-native = "python3-installer-native"
+DEPENDS:append:class-native = " unzip-native"
+
+do_install:class-native () {
+    pip_install_wheel_do_bootstrap_install
+}
+
+BBCLASSEXTEND = "native nativesdk"
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] pip_install_wheel: use installer instead of pip
  2022-03-10 17:16 [PATCH 1/2] python3-installer: add installer module Ross Burton
@ 2022-03-10 17:16 ` Ross Burton
  2022-03-10 21:19   ` [OE-core] " Richard Purdie
  2022-03-10 17:36 ` [OE-core] [PATCH 1/2] python3-installer: add installer module Konrad Weihmann
  2022-03-10 21:21 ` Richard Purdie
  2 siblings, 1 reply; 10+ messages in thread
From: Ross Burton @ 2022-03-10 17:16 UTC (permalink / raw)
  To: openembedded-core

Instead of battling pip to install a wheel, use installer. Installer
does one thing, so it's faster and easier to work with.

This means setuptools, pip, and wheel are no longer part of the
bootstrap phase, so they can be built normally.  To avoid sysroot file
conflicts these three recipes can't install .pyc files to the native
sysroot.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes/pip_install_wheel.bbclass        | 16 +++------
 .../python/python3-flit-core_3.7.1.bb         |  2 +-
 .../python/python3-pip_22.0.3.bb              | 35 +++----------------
 .../python/python3-setuptools_59.5.0.bb       | 12 +++----
 .../python/python3-wheel_0.37.1.bb            | 26 +++-----------
 5 files changed, 18 insertions(+), 73 deletions(-)

diff --git a/meta/classes/pip_install_wheel.bbclass b/meta/classes/pip_install_wheel.bbclass
index 29cd544aa3..497f69260e 100644
--- a/meta/classes/pip_install_wheel.bbclass
+++ b/meta/classes/pip_install_wheel.bbclass
@@ -1,23 +1,15 @@
-DEPENDS:append = " python3-pip-native"
+DEPENDS:append = " python3-installer-native"
 
 # The directory where wheels should be written too. Build classes
 # will ideally [cleandirs] this but we don't do that here in case
 # a recipe wants to install prebuilt wheels.
 PIP_INSTALL_DIST_PATH ?= "${WORKDIR}/dist"
 
-PIP_INSTALL_ARGS = "\
-    -vvvv \
-    --ignore-installed \
-    --no-cache \
-    --no-deps \
-    --no-index \
-    --root=${D} \
-    --prefix=${prefix} \
-"
-
 PIP_INSTALL_PYTHON = "python3"
 PIP_INSTALL_PYTHON:class-native = "nativepython3"
 
+INSTALL_WHEEL_COMPILE_BYTECODE ?= "--compile-bytecode=0"
+
 pip_install_wheel_do_install () {
     COUNT=$(find ${PIP_INSTALL_DIST_PATH} -name '*.whl' | wc -l)
     if test $COUNT -eq 0; then
@@ -26,7 +18,7 @@ pip_install_wheel_do_install () {
         bbfatal More than one wheel found in ${PIP_INSTALL_DIST_PATH}, this should not happen
     fi
 
-    nativepython3 -m pip install ${PIP_INSTALL_ARGS} ${PIP_INSTALL_DIST_PATH}/*.whl
+    nativepython3 -m installer ${INSTALL_WHEEL_COMPILE_BYTECODE} --destdir=${D} ${PIP_INSTALL_DIST_PATH}/*.whl
 
     cd ${D}
     for i in ${D}${bindir}/* ${D}${sbindir}/*; do
diff --git a/meta/recipes-devtools/python/python3-flit-core_3.7.1.bb b/meta/recipes-devtools/python/python3-flit-core_3.7.1.bb
index 1f14345d50..d4993fee69 100644
--- a/meta/recipes-devtools/python/python3-flit-core_3.7.1.bb
+++ b/meta/recipes-devtools/python/python3-flit-core_3.7.1.bb
@@ -13,7 +13,7 @@ SRC_URI[sha256sum] = "3c9bd9c140515bfe62dd938c6610d10d6efb9e35cc647fc614fe5fb3a5
 inherit pypi flit_core
 
 # Need to install by hand as there's a dependency loop
-DEPENDS:remove:class-native = " python3-pip-native"
+DEPENDS:remove:class-native = " python3-installer-native"
 DEPENDS:append:class-native = " unzip-native"
 
 # We need the full flit tarball
diff --git a/meta/recipes-devtools/python/python3-pip_22.0.3.bb b/meta/recipes-devtools/python/python3-pip_22.0.3.bb
index bce3b68861..9ca8fbc1e5 100644
--- a/meta/recipes-devtools/python/python3-pip_22.0.3.bb
+++ b/meta/recipes-devtools/python/python3-pip_22.0.3.bb
@@ -6,43 +6,14 @@ LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=63ec52baf95163b597008bb46db68030"
 
 inherit pypi setuptools_build_meta
 
-DEPENDS += "python3"
-
-# To avoid a dependency loop; we bootstrap -native
-DEPENDS:remove:class-native = "python3-pip-native"
-DEPENDS:append:class-native = " unzip-native"
-
 SRC_URI += "file://0001-change-shebang-to-python3.patch"
 SRC_URI += "file://no_shebang_mangling.patch"
 SRC_URI += "file://reproducible.patch"
 
 SRC_URI[sha256sum] = "f29d589df8c8ab99c060e68ad294c4a9ed896624f6368c5349d70aa581b333d0"
 
-do_install:class-native() {
-    pip_install_wheel_do_bootstrap_install
-
-    # pip install would normally generate [console_scripts] in ${bindir}
-    install -d ${D}/${bindir}
-    # We will skip the ${bindir}/pip variant as we would just remove it in the do_install:append
-    cat << EOF >> ${D}/${bindir}/pip3 | tee ${D}/${bindir}/pip${PYTHON_BASEVERSION}
-#!/bin/sh
-'''exec' ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} "\$0" "\$@"
-' '''
-# -*- coding: utf-8 -*-
-import re
-import sys
-from pip._internal.cli.main import main
-if __name__ == '__main__':
-    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
-    sys.exit(main())
-EOF
-    chmod 0755 ${D}${bindir}/pip3 ${D}${bindir}/pip${PYTHON_BASEVERSION}
-}
-
 do_install:append() {
-    if [ -e ${D}/${bindir}/pip ]; then
-        rm ${D}/${bindir}/pip
-    fi
+    rm -f ${D}/${bindir}/pip
 }
 
 RDEPENDS:${PN} = "\
@@ -59,3 +30,7 @@ RDEPENDS:${PN} = "\
 "
 
 BBCLASSEXTEND = "native nativesdk"
+
+# This used to use the bootstrap install which didn't compile. Until we bump the
+# tmpdir version we can't compile the native otherwise the sysroot unpack fails
+INSTALL_WHEEL_COMPILE_BYTECODE:class-native = "--no-compile-bytecode"
diff --git a/meta/recipes-devtools/python/python3-setuptools_59.5.0.bb b/meta/recipes-devtools/python/python3-setuptools_59.5.0.bb
index 7cd67b85f9..35bec19e33 100644
--- a/meta/recipes-devtools/python/python3-setuptools_59.5.0.bb
+++ b/meta/recipes-devtools/python/python3-setuptools_59.5.0.bb
@@ -17,14 +17,6 @@ SRC_URI[sha256sum] = "d144f85102f999444d06f9c0e8c737fd0194f10f2f7e5fdb77573f6e2f
 
 DEPENDS += "${PYTHON_PN}"
 
-# Avoid dependency loop; we bootstrap -native
-DEPENDS:remove:class-native = "python3-pip-native python3-setuptools-native"
-DEPENDS:append:class-native = " unzip-native"
-
-do_install:class-native() {
-    pip_install_wheel_do_bootstrap_install
-}
-
 RDEPENDS:${PN} = "\
     ${PYTHON_PN}-2to3 \
     ${PYTHON_PN}-compile \
@@ -59,3 +51,7 @@ RDEPENDS:${PYTHON_PN}-pkg-resources = "\
     ${PYTHON_PN}-plistlib \
     ${PYTHON_PN}-pprint \
 "
+
+# This used to use the bootstrap install which didn't compile. Until we bump the
+# tmpdir version we can't compile the native otherwise the sysroot unpack fails
+INSTALL_WHEEL_COMPILE_BYTECODE:class-native = "--no-compile-bytecode"
diff --git a/meta/recipes-devtools/python/python3-wheel_0.37.1.bb b/meta/recipes-devtools/python/python3-wheel_0.37.1.bb
index cf0d8191b4..efd6c2f968 100644
--- a/meta/recipes-devtools/python/python3-wheel_0.37.1.bb
+++ b/meta/recipes-devtools/python/python3-wheel_0.37.1.bb
@@ -10,26 +10,8 @@ inherit flit_core pypi
 
 SRC_URI += " file://0001-Backport-pyproject.toml-from-flit-backend-branch.patch"
 
-DEPENDS:remove:class-native = "python3-pip-native"
-
-do_install:class-native () {
-    pip_install_wheel_do_bootstrap_install
-
-    # pip install would normally generate [project.scripts] in ${bindir}
-    install -d ${D}/${bindir}
-    cat << EOF >> ${D}/${bindir}/wheel
-#!/bin/sh
-'''exec' ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} "\$0" "\$@"
-' '''
-# -*- coding: utf-8 -*-
-import re
-import sys
-from wheel.cli import main
-if __name__ == '__main__':
-    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
-    sys.exit(main())
-EOF
-    chmod 0755 ${D}${bindir}/wheel
-}
-
 BBCLASSEXTEND = "native nativesdk"
+
+# This used to use the bootstrap install which didn't compile. Until we bump the
+# tmpdir version we can't compile the native otherwise the sysroot unpack fails
+INSTALL_WHEEL_COMPILE_BYTECODE:class-native = "--no-compile-bytecode"
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [OE-core] [PATCH 1/2] python3-installer: add installer module
  2022-03-10 17:16 [PATCH 1/2] python3-installer: add installer module Ross Burton
  2022-03-10 17:16 ` [PATCH 2/2] pip_install_wheel: use installer instead of pip Ross Burton
@ 2022-03-10 17:36 ` Konrad Weihmann
  2022-03-10 18:25   ` Ross Burton
  2022-03-11 13:13   ` Ross Burton
  2022-03-10 21:21 ` Richard Purdie
  2 siblings, 2 replies; 10+ messages in thread
From: Konrad Weihmann @ 2022-03-10 17:36 UTC (permalink / raw)
  To: Ross Burton, openembedded-core

Sorry to say that - but to me (even though it's more work) pip seems to 
be the better option - the proposed tool is ~8 months old and not part 
of pypa community as it seems - so in comparison to pip this could not 
be labeled "battle proven".

Especially as the second patch of the series removes the possibility to 
use the tooling proposed by python upstream for installing stuff.

If one would want to have that kind of tooling the switch from pure 
setup.py to toml and friends could have been done already a year ago 
(python-build was the originally proposed tool iirc) - so this feels to 
me like a step in the wrong direction (esp. the part that this would 
rely on a tool **not** supported by upstream)

On 10.03.22 18:16, Ross Burton wrote:
> Add a recipe for Installer, a minimal library/tool to install Python
> Wheels.  Unlike PIP, it explicitly only installs wheels and does nothing
> else.
> 
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
>   .../python/python3-installer_0.5.0.bb         | 20 +++++++++++++++++++
>   1 file changed, 20 insertions(+)
>   create mode 100644 meta/recipes-devtools/python/python3-installer_0.5.0.bb
> 
> diff --git a/meta/recipes-devtools/python/python3-installer_0.5.0.bb b/meta/recipes-devtools/python/python3-installer_0.5.0.bb
> new file mode 100644
> index 0000000000..bde9397569
> --- /dev/null
> +++ b/meta/recipes-devtools/python/python3-installer_0.5.0.bb
> @@ -0,0 +1,20 @@
> +SUMMARY = "A library for installing Python wheels"
> +DESCRIPTION = "a low-level library for installing a Python package from a wheel distribution."
> +HOMEPAGE = "https://installer.readthedocs.io/"
> +BUGTRACKER = "https://github.com/pradyunsg/installer/issues"
> +
> +LICENSE = "MIT"
> +LIC_FILES_CHKSUM = "file://LICENSE;md5=5038641aec7a77451e31da828ebfae00"
> +
> +SRC_URI[sha256sum] = "0cd6bdab3b358cf7e8749370b99aef9e12202751271c5ddb22126599b34dc665"
> +
> +inherit pypi flit_core
> +
> +DEPENDS:remove:class-native = "python3-installer-native"
> +DEPENDS:append:class-native = " unzip-native"
> +
> +do_install:class-native () {
> +    pip_install_wheel_do_bootstrap_install
> +}
> +
> +BBCLASSEXTEND = "native nativesdk"
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#163032): https://lists.openembedded.org/g/openembedded-core/message/163032
> Mute This Topic: https://lists.openembedded.org/mt/89691492/3647476
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [kweihmann@outlook.com]
> -=-=-=-=-=-=-=-=-=-=-=-
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [OE-core] [PATCH 1/2] python3-installer: add installer module
  2022-03-10 17:36 ` [OE-core] [PATCH 1/2] python3-installer: add installer module Konrad Weihmann
@ 2022-03-10 18:25   ` Ross Burton
  2022-03-10 19:03     ` Konrad Weihmann
  2022-03-11  4:17     ` Tim Orling
  2022-03-11 13:13   ` Ross Burton
  1 sibling, 2 replies; 10+ messages in thread
From: Ross Burton @ 2022-03-10 18:25 UTC (permalink / raw)
  To: Konrad Weihmann; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 1411 bytes --]

On Thu, 10 Mar 2022 at 17:36, Konrad Weihmann <kweihmann@outlook.com> wrote:

> Sorry to say that - but to me (even though it's more work) pip seems to
> be the better option - the proposed tool is ~8 months old and not part
> of pypa community as it seems - so in comparison to pip this could not
> be labeled "battle proven".


It’s not that unheard of, for example the flit_core bootstrap documentation
says to use it:

https://flit.readthedocs.io/en/latest/bootstrap.html

It also does one job and just one job, which is A Very Good Thing.

Especially as the second patch of the series removes the possibility to
> use the tooling proposed by python upstream for installing stuff.


Do you mean Pip here? That’s one option.  Installing a wheel is a glorified
unzip, pip brings a lot of baggage that we don’t care about.

I should make it clear that this class is not for installing arbitrary
wheels, it installs a wheel we just built and in the future will build the
wheel too.

If one would want to have that kind of tooling the switch from pure
> setup.py to toml and friends could have been done already a year ago
> (python-build was the originally proposed tool iirc) - so this feels to
> me like a step in the wrong direction (esp. the part that this would
> rely on a tool **not** supported by upstream)


Adding support for build is next on the list.

Ross

[-- Attachment #2: Type: text/html, Size: 2572 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [OE-core] [PATCH 1/2] python3-installer: add installer module
  2022-03-10 18:25   ` Ross Burton
@ 2022-03-10 19:03     ` Konrad Weihmann
  2022-03-10 19:29       ` Ross Burton
  2022-03-11  4:17     ` Tim Orling
  1 sibling, 1 reply; 10+ messages in thread
From: Konrad Weihmann @ 2022-03-10 19:03 UTC (permalink / raw)
  To: Ross Burton; +Cc: openembedded-core



On 10.03.22 19:25, Ross Burton wrote:
> 
> On Thu, 10 Mar 2022 at 17:36, Konrad Weihmann <kweihmann@outlook.com 
> <mailto:kweihmann@outlook.com>> wrote:
> 
>     Sorry to say that - but to me (even though it's more work) pip seems to
>     be the better option - the proposed tool is ~8 months old and not part
>     of pypa community as it seems - so in comparison to pip this could not
>     be labeled "battle proven".
> 
> 
> It’s not that unheard of, for example the flit_core bootstrap 
> documentation says to use it:
> 
> https://flit.readthedocs.io/en/latest/bootstrap.html 
> <https://flit.readthedocs.io/en/latest/bootstrap.html>
> 
> It also does one job and just one job, which is A Very Good Thing.

Still doesn't make it the best choice TBH.
Just diving into the code makes me wonder about a lot, like

- can this tool run on non arm/aarch64/x86/x86-64 hosts 
(https://github.com/pradyunsg/installer/blob/fad2894a572d5497a3dceec58407c276f21e8c11/src/installer/utils.py#L140) 
- in its full feature set? - the assumptions made by this function, 
makes me think, it doesn't
- support of this here https://github.com/pradyunsg/installer/issues/98, 
should be given by a matured tool

> 
>     Especially as the second patch of the series removes the possibility to
>     use the tooling proposed by python upstream for installing stuff.
> 
> 
> Do you mean Pip here? That’s one option.  Installing a wheel is a 
> glorified unzip, pip brings a lot of baggage that we don’t care about.
> 
> I should make it clear that this class is not for installing arbitrary 
> wheels, it installs a wheel we just built and in the future will build 
> the wheel too.

Then that's definitely missing in the commit message, that this should 
be an option and not the default

> 
>     If one would want to have that kind of tooling the switch from pure
>     setup.py to toml and friends could have been done already a year ago
>     (python-build was the originally proposed tool iirc) - so this feels to
>     me like a step in the wrong direction (esp. the part that this would
>     rely on a tool **not** supported by upstream)
> 
> 
> Adding support for build is next on the list.
> 
> Ross
> 

Anyway, I think in before this patch series the switch to wheels was 
good enough to work with it, now it's just introducing another tool - 
that doesn't feel right to me, but I will stop arguing about that


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [OE-core] [PATCH 1/2] python3-installer: add installer module
  2022-03-10 19:03     ` Konrad Weihmann
@ 2022-03-10 19:29       ` Ross Burton
  0 siblings, 0 replies; 10+ messages in thread
From: Ross Burton @ 2022-03-10 19:29 UTC (permalink / raw)
  To: Konrad Weihmann; +Cc: openembedded-core

On Thu, 10 Mar 2022 at 19:03, Konrad Weihmann <kweihmann@outlook.com> wrote:
> > It also does one job and just one job, which is A Very Good Thing.
>
> Still doesn't make it the best choice TBH.
> Just diving into the code makes me wonder about a lot, like

Also referenced on https://github.com/brettcannon/mousebender, by a
prominent Microsoft Python engineer.

> - can this tool run on non arm/aarch64/x86/x86-64 hosts
> (https://github.com/pradyunsg/installer/blob/fad2894a572d5497a3dceec58407c276f21e8c11/src/installer/utils.py#L140)

Line 137 makes that moot, that's all Windows-specific.

> - support of this here https://github.com/pradyunsg/installer/issues/98,
> should be given by a matured tool

That's moot: it installs where the Python sysconfig module says to
install, which is told where to install when we build Python.

The Nix people want to override it per-package because they use
per-package prefixes, but we don't.  The prefix Python is built with
is the prefix we want to install into.

> > I should make it clear that this class is not for installing arbitrary
> > wheels, it installs a wheel we just built and in the future will build
> > the wheel too.
>
> Then that's definitely missing in the commit message, that this should
> be an option and not the default

If you want to install arbitrary packages with pip, then just use pip directly.

Ross


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [OE-core] [PATCH 2/2] pip_install_wheel: use installer instead of pip
  2022-03-10 17:16 ` [PATCH 2/2] pip_install_wheel: use installer instead of pip Ross Burton
@ 2022-03-10 21:19   ` Richard Purdie
  0 siblings, 0 replies; 10+ messages in thread
From: Richard Purdie @ 2022-03-10 21:19 UTC (permalink / raw)
  To: Ross Burton, openembedded-core

On Thu, 2022-03-10 at 17:16 +0000, Ross Burton wrote:
> Instead of battling pip to install a wheel, use installer. Installer
> does one thing, so it's faster and easier to work with.
> 
> This means setuptools, pip, and wheel are no longer part of the
> bootstrap phase, so they can be built normally.  To avoid sysroot file
> conflicts these three recipes can't install .pyc files to the native
> sysroot.
> 
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
>  meta/classes/pip_install_wheel.bbclass        | 16 +++------
>  .../python/python3-flit-core_3.7.1.bb         |  2 +-
>  .../python/python3-pip_22.0.3.bb              | 35 +++----------------
>  .../python/python3-setuptools_59.5.0.bb       | 12 +++----
>  .../python/python3-wheel_0.37.1.bb            | 26 +++-----------
>  5 files changed, 18 insertions(+), 73 deletions(-)

I suspect pip is doing some interpreter patch manipulation we're now missing out
on:

https://autobuilder.yoctoproject.org/typhoon/#/builders/62/builds/4865/steps/12/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/48/builds/4871/steps/13/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/37/builds/4868/steps/12/logs/stdio

and many more :/

including meta-arm:

https://autobuilder.yoctoproject.org/typhoon/#/builders/37/builds/4868/steps/12/logs/stdio

Cheers,

Richard



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [OE-core] [PATCH 1/2] python3-installer: add installer module
  2022-03-10 17:16 [PATCH 1/2] python3-installer: add installer module Ross Burton
  2022-03-10 17:16 ` [PATCH 2/2] pip_install_wheel: use installer instead of pip Ross Burton
  2022-03-10 17:36 ` [OE-core] [PATCH 1/2] python3-installer: add installer module Konrad Weihmann
@ 2022-03-10 21:21 ` Richard Purdie
  2 siblings, 0 replies; 10+ messages in thread
From: Richard Purdie @ 2022-03-10 21:21 UTC (permalink / raw)
  To: Ross Burton, openembedded-core

On Thu, 2022-03-10 at 17:16 +0000, Ross Burton wrote:
> Add a recipe for Installer, a minimal library/tool to install Python
> Wheels.  Unlike PIP, it explicitly only installs wheels and does nothing
> else.
> 
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
>  .../python/python3-installer_0.5.0.bb         | 20 +++++++++++++++++++
>  1 file changed, 20 insertions(+)
>  create mode 100644 meta/recipes-devtools/python/python3-installer_0.5.0.bb
> 
> diff --git a/meta/recipes-devtools/python/python3-installer_0.5.0.bb b/meta/recipes-devtools/python/python3-installer_0.5.0.bb
> new file mode 100644
> index 0000000000..bde9397569
> --- /dev/null
> +++ b/meta/recipes-devtools/python/python3-installer_0.5.0.bb
> @@ -0,0 +1,20 @@
> +SUMMARY = "A library for installing Python wheels"
> +DESCRIPTION = "a low-level library for installing a Python package from a wheel distribution."
> +HOMEPAGE = "https://installer.readthedocs.io/"
> +BUGTRACKER = "https://github.com/pradyunsg/installer/issues"
> +
> +LICENSE = "MIT"
> +LIC_FILES_CHKSUM = "file://LICENSE;md5=5038641aec7a77451e31da828ebfae00"
> +
> +SRC_URI[sha256sum] = "0cd6bdab3b358cf7e8749370b99aef9e12202751271c5ddb22126599b34dc665"
> +
> +inherit pypi flit_core
> +
> +DEPENDS:remove:class-native = "python3-installer-native"
> +DEPENDS:append:class-native = " unzip-native"
> +
> +do_install:class-native () {
> +    pip_install_wheel_do_bootstrap_install
> +}
> +
> +BBCLASSEXTEND = "native nativesdk"

https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/3273/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/80/builds/3230/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/86/builds/3243/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/3274/steps/14/logs/stdio

[missing maintainer entry]

Cheers,

Richard




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [OE-core] [PATCH 1/2] python3-installer: add installer module
  2022-03-10 18:25   ` Ross Burton
  2022-03-10 19:03     ` Konrad Weihmann
@ 2022-03-11  4:17     ` Tim Orling
  1 sibling, 0 replies; 10+ messages in thread
From: Tim Orling @ 2022-03-11  4:17 UTC (permalink / raw)
  To: Ross Burton; +Cc: Konrad Weihmann, openembedded-core

[-- Attachment #1: Type: text/plain, Size: 3547 bytes --]

On Thu, Mar 10, 2022 at 10:26 AM Ross Burton <ross@burtonini.com> wrote:

>
> On Thu, 10 Mar 2022 at 17:36, Konrad Weihmann <kweihmann@outlook.com>
> wrote:
>
>> Sorry to say that - but to me (even though it's more work) pip seems to
>> be the better option - the proposed tool is ~8 months old and not part
>> of pypa community as it seems - so in comparison to pip this could not
>> be labeled "battle proven".
>
>
> It’s not that unheard of, for example the flit_core bootstrap
> documentation says to use it:
>
> https://flit.readthedocs.io/en/latest/bootstrap.html
>
> It also does one job and just one job, which is A Very Good Thing.
>
>
And in fact, this was the first tool in my implementation. At the time it
was only a library and my awkward do_configure() cat << EOF scripts needed
to know the path to the wheel. It wasn’t gelled yet.

In the limited needs of oe-core, pip install “worked” (or seemed to) and so
that is what was submitted. To be clear, if we knew what we know now I
would never have used pip to install _our_ wheels. Never. It is a bloated
code base that wants to fetch your package, its dependencies, build them
all in a virtual environment and install them where it wants to install
things. It is entirely an end-user “desktop” tool.  This entire time, shoe
horning pip to do what we want has been a PITA.

Whether we switch to python3-installer now or later… I have little doubt we
will wish we had switched.


> Especially as the second patch of the series removes the possibility to
>> use the tooling proposed by python upstream for installing stuff.
>
>
> Do you mean Pip here? That’s one option.  Installing a wheel is a
> glorified unzip, pip brings a lot of baggage that we don’t care about.
>
> I should make it clear that this class is not for installing arbitrary
> wheels, it installs a wheel we just built and in the future will build the
> wheel too.
>
>
In fact, the pip_installer_wheel class opens the door to naive users
creating binary-only recipes to install random wheels from the internet.
There is ZERO chance we can support that workflow. Wheels will have
mismatched python ABI, glib, arch, etc. I have absolutely no intent to
answer any requests to do this. We build from source. You can write a
recipe on your own to use python3-pip-native to do this…here’s your spool
of rope. Good luck with your technical debt. You were warned not to do this.


> If one would want to have that kind of tooling the switch from pure
>> setup.py to toml and friends could have been done already a year ago
>> (python-build was the originally proposed tool iirc) - so this feels to
>> me like a step in the wrong direction (esp. the part that this would
>> rely on a tool **not** supported by upstream)
>
>
> Adding support for build is next on the list.
>

And would have already been in this implementation (with python3-build) if
only we could build a time machine. It just wasn’t ready yet. I was close…
the calendar said not close enough.


>
> Ross
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#163035):
> https://lists.openembedded.org/g/openembedded-core/message/163035
> Mute This Topic: https://lists.openembedded.org/mt/89691492/924729
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> ticotimo@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

[-- Attachment #2: Type: text/html, Size: 6078 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [OE-core] [PATCH 1/2] python3-installer: add installer module
  2022-03-10 17:36 ` [OE-core] [PATCH 1/2] python3-installer: add installer module Konrad Weihmann
  2022-03-10 18:25   ` Ross Burton
@ 2022-03-11 13:13   ` Ross Burton
  1 sibling, 0 replies; 10+ messages in thread
From: Ross Burton @ 2022-03-11 13:13 UTC (permalink / raw)
  To: Konrad Weihmann; +Cc: openembedded-core

On Thu, 10 Mar 2022 at 17:36, Konrad Weihmann <kweihmann@outlook.com> wrote:
> Sorry to say that - but to me (even though it's more work) pip seems to
> be the better option - the proposed tool is ~8 months old and not part
> of pypa community as it seems - so in comparison to pip this could not
> be labeled "battle proven".

FWIW, as of today installer is under pypa:

https://github.com/pypa/installer/commit/4495dea3baeab5e0f8059ca72b12ad7b91552832

Ross


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-03-11 13:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-10 17:16 [PATCH 1/2] python3-installer: add installer module Ross Burton
2022-03-10 17:16 ` [PATCH 2/2] pip_install_wheel: use installer instead of pip Ross Burton
2022-03-10 21:19   ` [OE-core] " Richard Purdie
2022-03-10 17:36 ` [OE-core] [PATCH 1/2] python3-installer: add installer module Konrad Weihmann
2022-03-10 18:25   ` Ross Burton
2022-03-10 19:03     ` Konrad Weihmann
2022-03-10 19:29       ` Ross Burton
2022-03-11  4:17     ` Tim Orling
2022-03-11 13:13   ` Ross Burton
2022-03-10 21:21 ` Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.