Skip to contentSkip to conversation

package/python-remi: fix build when setuptools_scm is installed

PATCH In review Yegor Yefremov via buildroot 3 participants 4 messages Oct 23 – Oct 25

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/python-remi: fix build when setuptools_scm is installed

python-remi fails to build when host-python-setuptools-scm has been built before it:

File ".../setuptools_scm/_integration/setuptools.py", line 174, in get_keyword_overrides
assert isinstance(value, dict), "version_keyword expects a dict or True"
AssertionError: version_keyword expects a dict or True

remi's setup.py first calls setup() with setup_requires=['setuptools_scm']. With a PEP 517 build, setuptools' build_meta backend always raises SetupRequirementsError for it, so the bare except fallback is always used, which calls setup() again with use_scm_version=False. If setuptools_scm is installed, its use_scm_version keyword handler still runs, and since setuptools_scm 8.0 it rejects False.

Add a patch, submitted upstream, that removes the use_scm_version keyword in the fallback instead, so the static version is used whether setuptools_scm is installed or not.

This issue has been present since commit 8937db8dd595 ("package/pkg-python.mk: migrate setuptools to pep517"): before it, setup.py was run directly and the first setup() call succeeded when setuptools_scm was installed. Combined with setuptools_scm >= 8.0 (bumped in 2024.02), it therefore affects 2024.05 and later, including all maintained branches.

Fixes:
https://autobuild.buildroot.org/results/cf1985c008c0af6a0a2dc08f98ae426b3b17874b

Fixes 8937db8dd595e0988751e5dbb568e870b07b39cc ("package/pkg-python.mk: migrate setuptools to pep517")
Assisted-by Claude:claude-opus-5-5
---
 ...drop-use_scm_version-in-the-fallback.patch | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 package/python-remi/0001-setup.py-drop-use_scm_version-in-the-fallback.patch
package/python-remi/0001-setup.py-drop-use_scm_version-in-the-fallback.patch new file +43 -0
new file mode 100644
index 0000000000..67190a4519
@@ -0,0 +1,43 @@
+From c653ab24e36ef6c4190e70e064e8102401247428 Mon Sep 17 00:00:00 2001
+From: Yegor Yefremov <[email protected]>
+Date: Fri, 23 Oct 2026 06:08:41 +0200
+Subject: [PATCH] setup.py: drop use_scm_version in the fallback
+
+The fallback setup() call sets use_scm_version to False. But when
+setuptools_scm is installed, its use_scm_version keyword handler is
+still invoked, and since setuptools_scm 8.0 it only accepts True, a
+dict or a callable:
+
+  File ".../setuptools_scm/_integration/setuptools.py", line 174, in get_keyword_overrides
+    assert isinstance(value, dict), "version_keyword expects a dict or True"
+  AssertionError: version_keyword expects a dict or True
+
+The fallback is always taken when building through a PEP 517 frontend
+such as pypa/build, because setuptools' build_meta backend raises
+SetupRequirementsError for the setup_requires entry. So remi can't be
+built whenever setuptools_scm is installed in the build environment.
+
+Remove the keyword instead, so that the static version is used.
+
+Upstream: https://github.com/rawpython/remi/pull/554
+Assisted-by: Claude:claude-opus-5-5
+Signed-off-by: Yegor Yefremov <[email protected]>
+---
+ setup.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
+index ffcda9a..1abc27d 100644
+--- a/setup.py
++++ b/setup.py
+@@ -26,6 +26,6 @@ try:
+     setup(**params)
+ except:
+     del params['setup_requires']
+-    params['use_scm_version'] = False
++    del params['use_scm_version']
+     params['version'] = '2022.7.27'
+     setup(**params)
+-- 
+2.34.1
+
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Yegor Yefremov

python-remi fails to build when host-python-setuptools-scm has been built before it:

File ".../setuptools_scm/_integration/setuptools.py", line 174, in get_keyword_overrides
assert isinstance(value, dict), "version_keyword expects a dict or True"
AssertionError: version_keyword expects a dict or True

remi's setup.py first calls setup() with setup_requires=['setuptools_scm']. With a PEP 517 build, setuptools' build_meta backend always raises SetupRequirementsError for it, so the bare except fallback is always used, which calls setup() again with use_scm_version=False. If setuptools_scm is installed, its use_scm_version keyword handler still runs, and since setuptools_scm 8.0 it rejects False.

Quoted 3 lines

Add a patch, submitted upstream, that removes the use_scm_version keyword in the fallback instead, so the static version is used whether setuptools_scm is installed or not.

This seems fine as a workaround but probably isn't what upstream would actually want as a proper fix.

Quoted 8 lines

This issue has been present since commit 8937db8dd595 ("package/pkg-python.mk: migrate setuptools to pep517"): before it, setup.py was run directly and the first setup() call succeeded when setuptools_scm was installed. Combined with setuptools_scm >= 8.0 (bumped in 2024.02), it therefore affects 2024.05 and later, including all maintained branches.

Quoted 6 lines

Fixes:
https://autobuild.buildroot.org/results/cf1985c008c0af6a0a2dc08f98ae426b3b17874b

Fixes 8937db8dd595e0988751e5dbb568e870b07b39cc ("package/pkg-python.mk: migrate setuptools to pep517")
Assisted-by Claude:claude-opus-5-5
Quoted 55 lines
---
 ...drop-use_scm_version-in-the-fallback.patch | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 package/python-remi/0001-setup.py-drop-use_scm_version-in-the-fallback.patch
package/python-remi/0001-setup.py-drop-use_scm_version-in-the-fallback.patch new file +43 -1
new file mode 100644
index 0000000000..67190a4519
@@ -0,0 +1,43 @@
+From c653ab24e36ef6c4190e70e064e8102401247428 Mon Sep 17 00:00:00 2001
+From: Yegor Yefremov <[email protected]>
+Date: Fri, 23 Oct 2026 06:08:41 +0200
+Subject: [PATCH] setup.py: drop use_scm_version in the fallback
+
+The fallback setup() call sets use_scm_version to False. But when
+setuptools_scm is installed, its use_scm_version keyword handler is
+still invoked, and since setuptools_scm 8.0 it only accepts True, a
+dict or a callable:
+
+  File ".../setuptools_scm/_integration/setuptools.py", line 174, in get_keyword_overrides
+    assert isinstance(value, dict), "version_keyword expects a dict or True"
+  AssertionError: version_keyword expects a dict or True
+
+The fallback is always taken when building through a PEP 517 frontend
+such as pypa/build, because setuptools' build_meta backend raises
+SetupRequirementsError for the setup_requires entry. So remi can't be
+built whenever setuptools_scm is installed in the build environment.
+
+Remove the keyword instead, so that the static version is used.
+
+Upstream: https://github.com/rawpython/remi/pull/554
+Assisted-by: Claude:claude-opus-5-5
+Signed-off-by: Yegor Yefremov <[email protected]>
+---
+ setup.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
+index ffcda9a..1abc27d 100644
+--- a/setup.py
++++ b/setup.py
+@@ -26,6 +26,6 @@ try:
+     setup(**params)
+ except:
+     del params['setup_requires']
+-    params['use_scm_version'] = False
++    del params['use_scm_version']
+     params['version'] = '2022.7.27'
+     setup(**params)
+--
+2.34.1
+
--
Quoted 2 lines

2.34.1

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

#2 lore raw

Hi James,

Quoted 18 lines · James Hilliard
Quoted 15 lines · Yegor Yefremov

python-remi fails to build when host-python-setuptools-scm has been built before it:

File ".../setuptools_scm/_integration/setuptools.py", line 174, in get_keyword_overrides
assert isinstance(value, dict), "version_keyword expects a dict or True"
AssertionError: version_keyword expects a dict or True

remi's setup.py first calls setup() with setup_requires=['setuptools_scm']. With a PEP 517 build, setuptools' build_meta backend always raises SetupRequirementsError for it, so the bare except fallback is always used, which calls setup() again with use_scm_version=False. If setuptools_scm is installed, its use_scm_version keyword handler still runs, and since setuptools_scm 8.0 it rejects False.

Quoted 6 lines
Quoted 3 lines

Add a patch, submitted upstream, that removes the use_scm_version keyword in the fallback instead, so the static version is used whether setuptools_scm is installed or not.

This seems fine as a workaround but probably isn't what upstream would actually want as a proper fix.

Just in case, i pushed this PR: https://github.com/rawpython/remi/pull/555

Quoted 64 lines
Quoted 8 lines

This issue has been present since commit 8937db8dd595 ("package/pkg-python.mk: migrate setuptools to pep517"): before it, setup.py was run directly and the first setup() call succeeded when setuptools_scm was installed. Combined with setuptools_scm >= 8.0 (bumped in 2024.02), it therefore affects 2024.05 and later, including all maintained branches.

Quoted 6 lines

Fixes:
https://autobuild.buildroot.org/results/cf1985c008c0af6a0a2dc08f98ae426b3b17874b

Fixes 8937db8dd595e0988751e5dbb568e870b07b39cc ("package/pkg-python.mk: migrate setuptools to pep517")
Assisted-by Claude:claude-opus-5-5
Quoted 49 lines
---
 ...drop-use_scm_version-in-the-fallback.patch | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 package/python-remi/0001-setup.py-drop-use_scm_version-in-the-fallback.patch
package/python-remi/0001-setup.py-drop-use_scm_version-in-the-fallback.patch new file +38 -0
new file mode 100644
index 0000000000..67190a4519
@@ -0,0 +1,43 @@
+From c653ab24e36ef6c4190e70e064e8102401247428 Mon Sep 17 00:00:00 2001
+From: Yegor Yefremov <[email protected]>
+Date: Fri, 23 Oct 2026 06:08:41 +0200
+Subject: [PATCH] setup.py: drop use_scm_version in the fallback
+
+The fallback setup() call sets use_scm_version to False. But when
+setuptools_scm is installed, its use_scm_version keyword handler is
+still invoked, and since setuptools_scm 8.0 it only accepts True, a
+dict or a callable:
+
+  File ".../setuptools_scm/_integration/setuptools.py", line 174, in get_keyword_overrides
+    assert isinstance(value, dict), "version_keyword expects a dict or True"
+  AssertionError: version_keyword expects a dict or True
+
+The fallback is always taken when building through a PEP 517 frontend
+such as pypa/build, because setuptools' build_meta backend raises
+SetupRequirementsError for the setup_requires entry. So remi can't be
+built whenever setuptools_scm is installed in the build environment.
+
+Remove the keyword instead, so that the static version is used.
+
+Upstream: https://github.com/rawpython/remi/pull/554
+Assisted-by: Claude:claude-opus-5-5
+Signed-off-by: Yegor Yefremov <[email protected]>
+---
+ setup.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
+index ffcda9a..1abc27d 100644
+--- a/setup.py
++++ b/setup.py
+@@ -26,6 +26,6 @@ try:
+     setup(**params)
+ except:
+     del params['setup_requires']
+-    params['use_scm_version'] = False
++    del params['use_scm_version']
Quoted 8 lines
Quoted 8 lines
package/python-remi/0001-setup.py-drop-use_scm_version-in-the-fallback.patch new file +5 -1
+     params['version'] = '2022.7.27'
+     setup(**params)
+--
+2.34.1
+
--

2.34.1

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

#3 lore raw
Quoted 23 lines · Yegor Yefremov

Hi James,

Quoted 18 lines · James Hilliard
Quoted 15 lines · Yegor Yefremov

python-remi fails to build when host-python-setuptools-scm has been built before it:

File ".../setuptools_scm/_integration/setuptools.py", line 174, in get_keyword_overrides
assert isinstance(value, dict), "version_keyword expects a dict or True"
AssertionError: version_keyword expects a dict or True

remi's setup.py first calls setup() with setup_requires=['setuptools_scm']. With a PEP 517 build, setuptools' build_meta backend always raises SetupRequirementsError for it, so the bare except fallback is always used, which calls setup() again with use_scm_version=False. If setuptools_scm is installed, its use_scm_version keyword handler still runs, and since setuptools_scm 8.0 it rejects False.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Add a patch, submitted upstream, that removes the use_scm_version keyword in the fallback instead, so the static version is used whether setuptools_scm is installed or not.

This seems fine as a workaround but probably isn't what upstream would actually want as a proper fix.

Just in case, i pushed this PR: https://github.com/rawpython/remi/pull/555

Yeah, I saw that, but from my understanding the project wasn't trying to remove setuptools-scm, I created an alternative minimal fix:
https://github.com/rawpython/remi/pull/556

Quoted 65 lines
Quoted 65 lines
Quoted 9 lines

This issue has been present since commit 8937db8dd595 ("package/pkg-python.mk: migrate setuptools to pep517"): before it, setup.py was run directly and the first setup() call succeeded when setuptools_scm was installed. Combined with setuptools_scm >= 8.0 (bumped in 2024.02), it therefore affects 2024.05 and later, including all maintained branches.

Quoted 6 lines

Fixes:
https://autobuild.buildroot.org/results/cf1985c008c0af6a0a2dc08f98ae426b3b17874b

Fixes 8937db8dd595e0988751e5dbb568e870b07b39cc ("package/pkg-python.mk: migrate setuptools to pep517")
Assisted-by Claude:claude-opus-5-5
Quoted 49 lines
---
 ...drop-use_scm_version-in-the-fallback.patch | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 package/python-remi/0001-setup.py-drop-use_scm_version-in-the-fallback.patch
package/python-remi/0001-setup.py-drop-use_scm_version-in-the-fallback.patch new file +38 -0
new file mode 100644
index 0000000000..67190a4519
@@ -0,0 +1,43 @@
+From c653ab24e36ef6c4190e70e064e8102401247428 Mon Sep 17 00:00:00 2001
+From: Yegor Yefremov <[email protected]>
+Date: Fri, 23 Oct 2026 06:08:41 +0200
+Subject: [PATCH] setup.py: drop use_scm_version in the fallback
+
+The fallback setup() call sets use_scm_version to False. But when
+setuptools_scm is installed, its use_scm_version keyword handler is
+still invoked, and since setuptools_scm 8.0 it only accepts True, a
+dict or a callable:
+
+  File ".../setuptools_scm/_integration/setuptools.py", line 174, in get_keyword_overrides
+    assert isinstance(value, dict), "version_keyword expects a dict or True"
+  AssertionError: version_keyword expects a dict or True
+
+The fallback is always taken when building through a PEP 517 frontend
+such as pypa/build, because setuptools' build_meta backend raises
+SetupRequirementsError for the setup_requires entry. So remi can't be
+built whenever setuptools_scm is installed in the build environment.
+
+Remove the keyword instead, so that the static version is used.
+
+Upstream: https://github.com/rawpython/remi/pull/554
+Assisted-by: Claude:claude-opus-5-5
+Signed-off-by: Yegor Yefremov <[email protected]>
+---
+ setup.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
+index ffcda9a..1abc27d 100644
+--- a/setup.py
++++ b/setup.py
+@@ -26,6 +26,6 @@ try:
+     setup(**params)
+ except:
+     del params['setup_requires']
+-    params['use_scm_version'] = False
++    del params['use_scm_version']
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
package/python-remi/0001-setup.py-drop-use_scm_version-in-the-fallback.patch new file +5 -1
+     params['version'] = '2022.7.27'
+     setup(**params)
+--
+2.34.1
+
--

2.34.1

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