Bug 293530 - devel/py-setuptools-scm: With Python 3.10 older py-tomli version as in ports tree is required
Summary: devel/py-setuptools-scm: With Python 3.10 older py-tomli version as in ports ...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Michael Osipov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-03-01 17:51 UTC by Michael Osipov
Modified: 2026-03-02 09:02 UTC (History)
5 users (show)

See Also:
vishwin: maintainer-feedback+


Attachments
patched pyproject.toml to not require tomli <= 2.0.2 (for <py311) [v2] (1.62 KB, patch)
2026-03-01 22:05 UTC, John Hein
jcfyecrayz: maintainer-approval? (python)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Osipov freebsd_committer freebsd_triage 2026-03-01 17:51:50 UTC
I get in poudriere for Python 3.10:
adding license file 'LICENSE'
writing manifest file 'src/setuptools_scm.egg-info/SOURCES.txt'

ERROR Missing dependencies:
	tomli<=2.0.2; python_version < "3.11"
*** Error code 1

Stop.
make: stopped in /usr/ports/devel/py-setuptools-scm
=>> Cleaning up wrkdir
===>  Cleaning for py310-setuptools-scm-9.2.2

See: https://github.com/pypa/setuptools-scm/blob/e56b78fcd4c1e79aa36c1e4700fca34c8ff540fe/pyproject.toml#L7
Comment 1 Michael Osipov freebsd_committer freebsd_triage 2026-03-01 18:21:45 UTC
Applied the following patch and it both built for me and the subsequent ports:
root@deblndw011x:/var/poudriere/ports/default-head/devel/py-setuptools-scm (main %=)
# cat files/patch-pyproject.toml
--- pyproject.toml.orig 2026-03-01 18:01:34 UTC
+++ pyproject.toml
@@ -4,7 +4,7 @@
 build-backend = "_own_version_helper:build_meta"
 requires = [
   "setuptools>=61",
-  'tomli<=2.0.2; python_version < "3.11"',
+  'tomli>1; python_version < "3.11"',
 ]
 backend-path = [
   ".",
Comment 2 John Hein 2026-03-01 20:47:43 UTC
See bug 286779, comment 13 and comment 14 (patch, similar to yours).
Comment 3 Michael Osipov freebsd_committer freebsd_triage 2026-03-01 20:52:26 UTC
(In reply to John Hein from comment #2)

Indeed, the exp-run was useless in this case...
Comment 4 John Hein 2026-03-01 21:13:53 UTC
Also see upstream:

https://github.com/pypa/setuptools-scm/issues/1090#issuecomment-3275518020
https://github.com/pypa/setuptools-scm/issues/1222

The latter got some traction upstream after I pinged about the issue yesterday: https://github.com/RonnyPfannschmidt/setuptools_scm/commit/c35b53ac0dcbd0528521886612540ac6478509ee

So a change has been finally committed upstream to address this, but not in any release yet including the 10.0.0 release from a few days ago - not avalaible at pypi.org yet. see https://github.com/pypa/setuptools-scm/releases
Comment 5 Michael Osipov freebsd_committer freebsd_triage 2026-03-01 21:33:36 UTC
(In reply to John Hein from comment #4)

I actually did diff 10 vs 9 and notice the "improvement. https://github.com/RonnyPfannschmidt/setuptools_scm/commit/c35b53ac0dcbd0528521886612540ac6478509ee is exactly my patch. Coincidence. I think we can apply this extra patch unconditionally until 10 lands in ports tree.
Comment 6 John Hein 2026-03-01 22:05:17 UTC
Created attachment 268465 [details]
patched pyproject.toml to not require tomli <= 2.0.2 (for <py311) [v2]

(In reply to Michael Osipov from comment #5)
Agreed.

nitpick: The upstream patch is slightly different than yours (>=1 vs >1). Pointless difference in practice.

The upstream commit will not apply cleanly to 9.2.2 because there is an incompatible context change on the line above.  In addition to some other context conflicts, setuptools 77.0.3 is now required instead of >=61.

The upstream patch will apply cleanly to 10.0.0 (does not have the tomli fix).
That, however, opens a different can of worms for FreeBSD with its very old setuptools still in place.

This is v2 of the patch (vs bug 28677, comment 14) - very slightly different.
Comment 7 commit-hook freebsd_committer freebsd_triage 2026-03-02 08:49:49 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0e25377b0267b96599cf2f02ad3da9cb4ba87cc3

commit 0e25377b0267b96599cf2f02ad3da9cb4ba87cc3
Author:     John Hein <jcfyecrayz@liamekaens.com>
AuthorDate: 2026-03-01 22:05:17 +0000
Commit:     Michael Osipov <michaelo@FreeBSD.org>
CommitDate: 2026-03-02 08:48:26 +0000

    devel/py-setuptools-scm: Fix build with Python 3.10 and py-tomli

    Make this port build and run with an newer version of py-tomli by backporting
    an upstream patch.

    Co-authored-by: Michael Osipov <michaelo@FreeBSD.org>
    PR:             293530
    PR:             286779
    Obtained from:  https://github.com/RonnyPfannschmidt/setuptools_scm/commit/c35b53ac0dcbd0528521886612540ac6478509ee

 .../files/patch-pyproject.toml (new)               | 41 ++++++++++++++++++++++
 1 file changed, 41 insertions(+)
Comment 8 Charlie Li freebsd_committer freebsd_triage 2026-03-02 09:00:50 UTC
This has not been committed upstream. Youse were looking at an individual developer's copy of the repository and not the "source of truth" so to speak. The associated pull request has not been merged as of this writing.

I'll allow it this time but please do better due diligence next time (if there is one), and actually give python@ a chance to review rather than rushing through.
Comment 9 Michael Osipov freebsd_committer freebsd_triage 2026-03-02 09:02:29 UTC
(In reply to Charlie Li from comment #8)

Point taken!