Skip to contentSkip to conversation

package/python-types-*: fix build with setuptools < 82.0.1

PATCH In review Yegor Yefremov 2 participants 5 messages Oct 9 – Oct 24

lore
Share & tools
lore
#0 lore raw

cover package/python-types-*: fix build with setuptools < 82.0.1

From: Yegor Yefremov <[email protected]>

The latest typeshed stub packages (types-python-dateutil, types-psutil and types-setuptools) use "<pkg>-stubs" keys in [tool.setuptools.package-data] and require setuptools >= 82.0.1, as older versions reject such keys, see
https://autobuild.buildroot.org/results/1ce798157bff8a423ca8c7c9f0e82620890ec3b3

Bumping setuptools is not an option for now, as 82.x breaks older U-Boot versions using binman (see commit aa8e6bc395fe), so instead of fixing up each pyproject.toml, this series backports the relevant part of the upstream validate-pyproject fix to our setuptools 80.9.0 and skips the now unneeded build dependency check in the three stub packages.

Tested by building python-types-python-dateutil, host-python-types-psutil and host-python-types-setuptools for an i686 Bootlin toolchain and checking that the stubs get installed.

Yegor Yefremov (2):
package/python-setuptools: accept PEP 561 stub names as package-data
keys
package/python-types-{python-dateutil, psutil, setuptools}: skip build
dependency check

 ...-561-stub-names-as-package-data-keys.patch | 42 +++++++++++++++++++
 .../python-types-psutil.mk                    |  3 ++
 .../python-types-python-dateutil.mk           |  3 ++
 .../python-types-setuptools.mk                |  3 ++
 4 files changed, 51 insertions(+)
 create mode 100644 package/python-setuptools/0002-config-allow-PEP-561-stub-names-as-package-data-keys.patch
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 1/2 package/python-setuptools: accept PEP 561 stub names as package-data keys

From: Yegor Yefremov <[email protected]>

The validate-pyproject schema bundled with setuptools 80.9.0 only accepts importable module names (or "*") as keys of [tool.setuptools.package-data]. Recent typeshed stub packages (types-python-dateutil, types-psutil, types-setuptools) use "<pkg>-stubs" keys and thus fail to build with:

ValueError: invalid pyproject.toml config: tool.setuptools.package-data. configuration error: tool.setuptools.package-data keys must be named by:
at least one of the following:
- {type: string, format: 'python-module-name'}
- {predefined value: '*'}

Bumping setuptools to >= 82.0.1 is not an option for now, as setuptools 82.x breaks older U-Boot versions using binman (see commit aa8e6bc395fe "Revert "package/python-setuptools: bump to version 82.0.0""), so backport the relevant part of the upstream fix instead.

Assisted-by Claude:claude-opus-5-5
---
 ...-561-stub-names-as-package-data-keys.patch | 42 +++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 package/python-setuptools/0002-config-allow-PEP-561-stub-names-as-package-data-keys.patch
package/python-setuptools/0002-config-allow-PEP-561-stub-names-as-package-data-keys.patch new file +42 -0
new file mode 100644
index 0000000000..9bfc3a7a06
@@ -0,0 +1,42 @@
+From 7bed5f151ec5bf2f41fa81133ae368a808dc2d69 Mon Sep 17 00:00:00 2001
+From: Yegor Yefremov <[email protected]>
+Date: Fri, 9 Oct 2026 10:08:52 +0200
+Subject: [PATCH] config: allow PEP 561 stub names as package-data keys
+
+The pre-compiled validate-pyproject schema only accepted importable
+module names (or "*") as keys of tool.setuptools.package-data, so
+"<pkg>-stubs" directories as generated by typeshed's stub_uploader
+were rejected with:
+
+  configuration error: `tool.setuptools.package-data` keys must be
+  named by: ... {type: string, format: 'python-module-name'}
+
+Validate the keys against the package-name definition instead, which
+also accepts PEP 561 stub names, as done upstream when the vendored
+validate-pyproject was refreshed.
+
+This is a minimal backport of the relevant hunk only.
+
+Upstream: https://github.com/pypa/setuptools/commit/2235bd0831aa35ec1d0305fd8a7d7ad23731e29c
+Signed-off-by: Yegor Yefremov <[email protected]>
+---
+ .../_validate_pyproject/fastjsonschema_validations.py       | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/setuptools/config/_validate_pyproject/fastjsonschema_validations.py b/setuptools/config/_validate_pyproject/fastjsonschema_validations.py
+index c69368a..848bc02 100644
+--- a/setuptools/config/_validate_pyproject/fastjsonschema_validations.py
++++ b/setuptools/config/_validate_pyproject/fastjsonschema_validations.py
+@@ -317,11 +317,7 @@ def validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_htm
+                             data__packagedata_key_any_of_count4 = 0
+                             if not data__packagedata_key_any_of_count4:
+                                 try:
+-                                    if not isinstance(data__packagedata_key, (str)):
+-                                        raise JsonSchemaValueException("" + (name_prefix or "data") + ".package-data must be string", value=data__packagedata_key, name="" + (name_prefix or "data") + ".package-data", definition={'type': 'string', 'format': 'python-module-name'}, rule='type')
+-                                    if isinstance(data__packagedata_key, str):
+-                                        if not custom_formats["python-module-name"](data__packagedata_key):
+-                                            raise JsonSchemaValueException("" + (name_prefix or "data") + ".package-data must be python-module-name", value=data__packagedata_key, name="" + (name_prefix or "data") + ".package-data", definition={'type': 'string', 'format': 'python-module-name'}, rule='format')
++                                    validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_package_name(data__packagedata_key, custom_formats, (name_prefix or "data") + ".package-data")
+                                     data__packagedata_key_any_of_count4 += 1
+                                 except JsonSchemaValueException: pass
+                             if not data__packagedata_key_any_of_count4:
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

PATCH 2/2 package/python-types-{python-dateutil, psutil, setuptools}: skip build dependency check

In reply to Yegor Yefremov

From: Yegor Yefremov <[email protected]>

The latest typeshed stub packages declare a build dependency on setuptools >= 82.0.1, which is only needed to accept PEP 561 stub names as package-data keys. Our setuptools 80.9.0 has been patched to accept them, so skip the build dependency check.

Assisted-by Claude:claude-opus-5-5
---
 package/python-types-psutil/python-types-psutil.mk             | 3 +++
 .../python-types-python-dateutil.mk                            | 3 +++
 package/python-types-setuptools/python-types-setuptools.mk     | 3 +++
 3 files changed, 9 insertions(+)
package/python-types-psutil/python-types-psutil.mk +3 -0
index 0e0875345a..28d5f9f1a7 100644
@@ -10,5 +10,8 @@ PYTHON_TYPES_PSUTIL_SITE = https://files.pythonhosted.org/packages/97/0a/f48b9b0
 PYTHON_TYPES_PSUTIL_SETUP_TYPE = setuptools
 PYTHON_TYPES_PSUTIL_LICENSE = Apache-2.0
 PYTHON_TYPES_PSUTIL_LICENSE_FILES = LICENSE
+# setuptools >= 82.0.1 is required upstream only to accept PEP 561
+# stub names as package-data keys, which our setuptools is patched for
+HOST_PYTHON_TYPES_PSUTIL_BUILD_OPTS = --skip-dependency-check
 
 $(eval $(host-python-package))
package/python-types-python-dateutil/python-types-python-dateutil.mk +3 -0
index f5b44c836f..2cc13750e7 100644
@@ -10,5 +10,8 @@ PYTHON_TYPES_PYTHON_DATEUTIL_SITE = https://files.pythonhosted.org/packages/c8/4
 PYTHON_TYPES_PYTHON_DATEUTIL_SETUP_TYPE = setuptools
 PYTHON_TYPES_PYTHON_DATEUTIL_LICENSE = Apache-2.0
 PYTHON_TYPES_PYTHON_DATEUTIL_LICENSE_FILES = LICENSE
+# setuptools >= 82.0.1 is required upstream only to accept PEP 561
+# stub names as package-data keys, which our setuptools is patched for
+PYTHON_TYPES_PYTHON_DATEUTIL_BUILD_OPTS = --skip-dependency-check
 
 $(eval $(python-package))
package/python-types-setuptools/python-types-setuptools.mk +3 -0
index d0cfdba1bc..a2c8119509 100644
@@ -10,5 +10,8 @@ PYTHON_TYPES_SETUPTOOLS_SITE = https://files.pythonhosted.org/packages/4f/cd/3b2
 PYTHON_TYPES_SETUPTOOLS_SETUP_TYPE = setuptools
 PYTHON_TYPES_SETUPTOOLS_LICENSE = Apache-2.0
 PYTHON_TYPES_SETUPTOOLS_LICENSE_FILES = LICENSE
+# setuptools >= 82.0.1 is required upstream only to accept PEP 561
+# stub names as package-data keys, which our setuptools is patched for
+HOST_PYTHON_TYPES_SETUPTOOLS_BUILD_OPTS = --skip-dependency-check
 
 $(eval $(host-python-package))
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw
In reply to Yegor Yefremov

Am 09.10.26 um 10:34 schrieb Yegor Yefremov:

Quoted 8 lines

From: Yegor Yefremov <[email protected]>

The latest typeshed stub packages (types-python-dateutil, types-psutil and types-setuptools) use "<pkg>-stubs" keys in [tool.setuptools.package-data] and require setuptools >= 82.0.1, as older versions reject such keys, see
https://autobuild.buildroot.org/results/1ce798157bff8a423ca8c7c9f0e82620890ec3b3

Quoted 5 lines

Bumping setuptools is not an option for now, as 82.x breaks older U-Boot versions using binman (see commit aa8e6bc395fe), so instead of fixing up each pyproject.toml, this series backports the relevant part of the upstream validate-pyproject fix to our setuptools 80.9.0 and skips the now unneeded build dependency check in the three stub packages.

Adding patches and is the wrong way to approach the problem. The build log linked in the aa8e6bc395fe11070cab29f2ef8f848a1a871c4e commit message indicates the problem is that the "pkg_resources" module has been removed from setuptools with version 82.

So the correct approach would be to package a backport [1], allow builds with old U-Boot versions and binman to depend on that (and test such a build). Then we can merge that and the setuptools{,-scm} updates James has posted almost 2 weeks ago [2, 3] (I already have those in my local repository and they work fine).

The quick fix would be to revert the typeshed updates until then, I don't see anything critical about them.

Best regards,
Fiona

[1] https://pypi.org/project/pkg-resources-backport/
[2] https://patchwork.buildroot.org/project/buildroot/patch/[email protected]/
[3] https://patchwork.buildroot.org/project/buildroot/list/?series=960

Quoted 10 lines

Tested by building python-types-python-dateutil, host-python-types-psutil and host-python-types-setuptools for an i686 Bootlin toolchain and checking that the stubs get installed.

Yegor Yefremov (2):
package/python-setuptools: accept PEP 561 stub names as package-data
keys
package/python-types-{python-dateutil, psutil, setuptools}: skip build
dependency check

Quoted 7 lines
  ...-561-stub-names-as-package-data-keys.patch | 42 +++++++++++++++++++
  .../python-types-psutil.mk                    |  3 ++
  .../python-types-python-dateutil.mk           |  3 ++
  .../python-types-setuptools.mk                |  3 ++
  4 files changed, 51 insertions(+)

create mode 100644 package/python-setuptools/0002-config-allow-PEP-561-stub-names-as-package-data-keys.patch

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

I've merged James' series to add a pkg_resources backport together with setuptools update, and marked this as rejected.

Best regards,
Fiona

Am 13.10.26 um 22:21 schrieb Fiona Klute via buildroot:

Quoted 47 lines

Am 09.10.26 um 10:34 schrieb Yegor Yefremov:

Quoted 8 lines

From: Yegor Yefremov <[email protected]>

The latest typeshed stub packages (types-python-dateutil, types-psutil and types-setuptools) use "<pkg>-stubs" keys in [tool.setuptools.package-data] and require setuptools >= 82.0.1, as older versions reject such keys, see
https://autobuild.buildroot.org/ results/1ce798157bff8a423ca8c7c9f0e82620890ec3b3

Quoted 5 lines

Bumping setuptools is not an option for now, as 82.x breaks older U-Boot versions using binman (see commit aa8e6bc395fe), so instead of fixing up each pyproject.toml, this series backports the relevant part of the upstream validate-pyproject fix to our setuptools 80.9.0 and skips the now unneeded build dependency check in the three stub packages.

Adding patches and is the wrong way to approach the problem. The build log linked in the aa8e6bc395fe11070cab29f2ef8f848a1a871c4e commit message indicates the problem is that the "pkg_resources" module has been removed from setuptools with version 82.

So the correct approach would be to package a backport [1], allow builds with old U-Boot versions and binman to depend on that (and test such a build). Then we can merge that and the setuptools{,-scm} updates James has posted almost 2 weeks ago [2, 3] (I already have those in my local repository and they work fine).

The quick fix would be to revert the typeshed updates until then, I don't see anything critical about them.

Best regards,
Fiona

[1] https://pypi.org/project/pkg-resources-backport/
[2] https://patchwork.buildroot.org/project/buildroot/ patch/[email protected]/
[3] https://patchwork.buildroot.org/project/buildroot/list/?series=960

Quoted 10 lines

Tested by building python-types-python-dateutil, host-python-types-psutil and host-python-types-setuptools for an i686 Bootlin toolchain and checking that the stubs get installed.

Yegor Yefremov (2):
   package/python-setuptools: accept PEP 561 stub names as package-data keys
   package/python-types-{python-dateutil, psutil, setuptools}: skip build dependency check

Quoted 7 lines

  ...-561-stub-names-as-package-data-keys.patch | 42 +++++++++++++++++++ .../python-types-psutil.mk                    |  3 ++ .../python-types-python-dateutil.mk           |  3 ++ .../python-types-setuptools.mk                |  3 ++

  4 files changed, 51 insertions(+)

  create mode 100644 package/python-setuptools/0002-config-allow- PEP-561-stub-names-as-package-data-keys.patch

Quoted 4 lines

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot