setuptools_scm: TypeError: setuptools_scm.config.Configuration() got multiple values for keyword argument 'relative_to'
My project build recently stopped working, failing with:
TypeError: setuptools_scm.config.Configuration() got multiple values for keyword argument ‘relative_to’
My setup.py looks like so:
import setuptools
setuptools.setup()
…and my pyproject.toml thusly:
[build-system]
requires = [
"setuptools>=42",
"wheel",
"setuptools_scm>=6.2"
]
build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
relative_to = "__file__"
fallback_version = "0.0.0"
If I comment out the relative_to
configuration line in pyproject.toml
, the build completes.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 16 (10 by maintainers)
Commits related to this issue
- FIXUP: Previous TypeError Refs: - https://github.com/pypa/setuptools_scm/issues/738#issuecomment-1170314143 modified: pyproject.toml — committed to tallamjr/astronet by tallamjr 2 years ago
- FIXUP: Previous TypeError Refs: - https://github.com/pypa/setuptools_scm/issues/738#issuecomment-1170314143 modified: pyproject.toml — committed to tallamjr/astronet by tallamjr 2 years ago
- fix #738: protect relative_to of Configuration.from_file users assumed it makes sense to use in the configfile, where we actually have to use the config file name itself as ancor — committed to RonnyPfannschmidt/setuptools_scm by RonnyPfannschmidt 2 years ago
- fix #738: protect relative_to of Configuration.from_file users assumed it makes sense to use in the configfile, where we actually have to use the config file name itself as ancor — committed to RonnyPfannschmidt/setuptools_scm by RonnyPfannschmidt 2 years ago
- Merge pull request #739 from RonnyPfannschmidt/fix-738-protect-relative-to fix #738: protect relative_to of Configuration.from_file — committed to pypa/setuptools_scm by RonnyPfannschmidt 2 years ago
Thanks for the quick response @FlorianWilhelm ! Yes, removing the
use_scm_version = {"relative_to": __file__}
worked! 🎉 🙏In conclusion, the fix was simply removing
relative_to = "__file__"
from mypyproject.toml
.Yes, I will release a version that takes the value out of the config and warns the user
Hi @RonnyPfannschmidt, thanks I guess an error message with a better warning would help.
Regarding the source of this error, we never had
relative_to = "__file__"
inpyproject.toml
to the best of my knowledge, right @abravalheri? In our FAQ, we only say that in Monorepos it might make sense to haverelative_to = "setup.py"
inpyproject.toml
, which should work, right? The actual problem is that__file__
is not resolved withinpyproject.toml
.