Skip to contentSkip to conversation

python3-fastentrypoints: add recipe

PATCH In review Ming Liu 3 participants 5 messages Feb 1, 2020 – Feb 3, 2020

lore
Share & tools
lore

Ming Liu

author
#0 lore raw

PATCH 1/2 python3-fastentrypoints: add recipe

From: Ming Liu <[email protected]>

python3-fastentrypoints is a python module that make entry_points specified in setup.py load more quickly.

---
 .../python/python3-fastentrypoints_0.12.bb             | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 recipes-devtools/python/python3-fastentrypoints_0.12.bb
recipes-devtools/python/python3-fastentrypoints_0.12.bb new file +18 -0
new file mode 100644
index 0000000..7bd1651
@@ -0,0 +1,18 @@
+SUMMARY = "Make entry_points specified in setup.py load more quickly"
+DESCRIPTION = "Using entry_points in your setup.py makes scripts that start \
+really slowly because it imports pkg_resources, which is a horrible \
+thing to do if you want your trivial script to execute more or less \
+instantly. fastentrypoints aims to fix that bypassing pkg_resources, \
+making scripts load a lot faster."
+HOMEPAGE = "https://github.com/ninjaaron/fast-entry_points"
+SECTION = "devel/python"
+
+LICENSE = "BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://README.rst;md5=f212a0cb34eb678477972d2011fb365a"
+
+inherit pypi setuptools3
+
+SRC_URI[md5sum] = "390ad9a9229164a06156a5b1f0ef1b22"
+SRC_URI[sha256sum] = "ff284f1469bd65400599807d2c6284d5b251398e6e28811f5f77fd262292410b"
+
+BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 2/2 python3-docker-compose: import fastentrypoints

From: Ming Liu <[email protected]>

The docker-compose project is using console_scripts which hence imports pkg_resources which is very slow at starting time, see:
https://github.com/pypa/setuptools/issues/510

This could be workaround by importing fastentrypoints module.

Some tests:

Before the patch, on a colibri-imx8x machine:

$ time docker-compose
```

real 0m5.108s
user 0m4.761s
sys 0m0.272s

```

After the patch, on a colibri-imx8x machine:

$ time docker-compose
```

real 0m3.526s
user 0m3.249s
sys 0m0.235s
```

Have verified the patch with:
https://docs.docker.com/compose/gettingstarted

---
 .../0001-setup.py-import-fastentrypoints.patch     | 28 ++++++++++++++++++++++
 .../python3-docker-compose_1.25.0.bb               |  6 ++++-
 2 files changed, 33 insertions(+), 1 deletion(-)
 create mode 100644 recipes-containers/docker-compose/files/0001-setup.py-import-fastentrypoints.patch
recipes-containers/docker-compose/files/0001-setup.py-import-fastentrypoints.patch new file +28 -0
new file mode 100644
index 0000000..df613e8
@@ -0,0 +1,28 @@
+From f3a22f0f14a4b3313e6405dfb6c97df949493a34 Mon Sep 17 00:00:00 2001
+From: Ming Liu <[email protected]>
+Date: Thu, 30 Jan 2020 17:22:19 +0100
+Subject: [PATCH] setup.py: import fastentrypoints
+
+Upstream-Status: Inappropriate [OE specific configuration]
+
+Signed-off-by: Ming Liu <[email protected]>
+---
+ setup.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
+index ad57969..3cccffc 100644
+--- a/setup.py
++++ b/setup.py
+@@ -12,7 +12,7 @@ import sys
+ import pkg_resources
+ from setuptools import find_packages
+ from setuptools import setup
+-
++import fastentrypoints
+ 
+ def read(*parts):
+     path = os.path.join(os.path.dirname(__file__), *parts)
+-- 
+2.7.4
+
recipes-containers/docker-compose/python3-docker-compose_1.25.0.bb +5 -1
index 36e2417..ba35c49 100644
@@ -8,7 +8,11 @@ inherit pypi setuptools3
 SRC_URI[md5sum] = "275b32cffdad6b9816dc8b4c7e55600a"
 SRC_URI[sha256sum] = "2c5fcbfd3ff445b6f3eebb549cb167ef1d8f70c5806aab8f309fc8fa74cd977e"
 
-SRC_URI += "file://0001-setup.py-remove-maximum-version-requirements.patch"
+SRC_URI += "file://0001-setup.py-remove-maximum-version-requirements.patch \
+            file://0001-setup.py-import-fastentrypoints.patch \
+           "
+
+DEPENDS += "${PYTHON_PN}-fastentrypoints-native"
 
 RDEPENDS_${PN} = "\
     ${PYTHON_PN}-cached-property \
Signature · 1 line
2.7.4
#2 lore raw
In reply to Ming Liu

This seems generally useful and should go to meta-python?

Quoted 46 lines · Ming Liu

From: Ming Liu <[email protected]>

python3-fastentrypoints is a python module that make entry_points specified in setup.py load more quickly.

---
 .../python/python3-fastentrypoints_0.12.bb             | 18
++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 recipes-devtools/python/

python3-fastentrypoints_0.12.bb

recipes-devtools/python/python3-fastentrypoints_0.12.bb new file +2 -0
new file mode 100644
index 0000000..7bd1651
@@ -0,0 +1,18 @@
+SUMMARY = "Make entry_points specified in setup.py load more quickly"
+DESCRIPTION = "Using entry_points in your setup.py makes scripts that

start \

recipes-devtools/python/python3-fastentrypoints_0.12.bb new file +9 -0
+really slowly because it imports pkg_resources, which is a horrible \
+thing to do if you want your trivial script to execute more or less \
+instantly. fastentrypoints aims to fix that bypassing pkg_resources, \
+making scripts load a lot faster."
+HOMEPAGE = "https://github.com/ninjaaron/fast-entry_points"
+SECTION = "devel/python"
+
+LICENSE = "BSD-2-Clause"
+LIC_FILES_CHKSUM =

"file://README.rst;md5=f212a0cb34eb678477972d2011fb365a"

recipes-devtools/python/python3-fastentrypoints_0.12.bb new file +5 -0
+
+inherit pypi setuptools3
+
+SRC_URI[md5sum] = "390ad9a9229164a06156a5b1f0ef1b22"
+SRC_URI[sha256sum] =

"ff284f1469bd65400599807d2c6284d5b251398e6e28811f5f77fd262292410b"

recipes-devtools/python/python3-fastentrypoints_0.12.bb new file +2 -1
+
+BBCLASSEXTEND = "native nativesdk"
--

2.7.4

#3 lore raw
Quoted 2 lines · Tim Orling

This seems generally useful and should go to meta-python?

With only the one user, I'd prefer to just merge it here. If anyone else needs it, we can consider it as a move later.

queue my rant about having it where we know we can test it :D

Bruce

Quoted 43 lines · Ming Liu
Quoted 40 lines

From: Ming Liu <[email protected]>

python3-fastentrypoints is a python module that make entry_points specified in setup.py load more quickly.

---
 .../python/python3-fastentrypoints_0.12.bb             | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 recipes-devtools/python/python3-fastentrypoints_0.12.bb
recipes-devtools/python/python3-fastentrypoints_0.12.bb new file +18 -1
new file mode 100644
index 0000000..7bd1651
@@ -0,0 +1,18 @@
+SUMMARY = "Make entry_points specified in setup.py load more quickly"
+DESCRIPTION = "Using entry_points in your setup.py makes scripts that start \
+really slowly because it imports pkg_resources, which is a horrible \
+thing to do if you want your trivial script to execute more or less \
+instantly. fastentrypoints aims to fix that bypassing pkg_resources, \
+making scripts load a lot faster."
+HOMEPAGE = "https://github.com/ninjaaron/fast-entry_points"
+SECTION = "devel/python"
+
+LICENSE = "BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://README.rst;md5=f212a0cb34eb678477972d2011fb365a"
+
+inherit pypi setuptools3
+
+SRC_URI[md5sum] = "390ad9a9229164a06156a5b1f0ef1b22"
+SRC_URI[sha256sum] = "ff284f1469bd65400599807d2c6284d5b251398e6e28811f5f77fd262292410b"
+
+BBCLASSEXTEND = "native nativesdk"
--

2.7.4

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
#4 lore raw
In reply to Ming Liu

both patches are merged.

Bruce

In message: [meta-virtualization][PATCH 1/2] python3-fastentrypoints: add recipe

Quoted 40 lines · on 01/02/2020 Ming Liu wrote:

From: Ming Liu <[email protected]>

python3-fastentrypoints is a python module that make entry_points specified in setup.py load more quickly.

---
 .../python/python3-fastentrypoints_0.12.bb             | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 recipes-devtools/python/python3-fastentrypoints_0.12.bb
recipes-devtools/python/python3-fastentrypoints_0.12.bb new file +18 -0
new file mode 100644
index 0000000..7bd1651
@@ -0,0 +1,18 @@
+SUMMARY = "Make entry_points specified in setup.py load more quickly"
+DESCRIPTION = "Using entry_points in your setup.py makes scripts that start \
+really slowly because it imports pkg_resources, which is a horrible \
+thing to do if you want your trivial script to execute more or less \
+instantly. fastentrypoints aims to fix that bypassing pkg_resources, \
+making scripts load a lot faster."
+HOMEPAGE = "https://github.com/ninjaaron/fast-entry_points"
+SECTION = "devel/python"
+
+LICENSE = "BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://README.rst;md5=f212a0cb34eb678477972d2011fb365a"
+
+inherit pypi setuptools3
+
+SRC_URI[md5sum] = "390ad9a9229164a06156a5b1f0ef1b22"
+SRC_URI[sha256sum] = "ff284f1469bd65400599807d2c6284d5b251398e6e28811f5f77fd262292410b"
+
+BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.7.4