Closed oprypin closed 8 months ago
I proposed a fix, someone can create a PR from this example:
https://github.com/python-babel/babel/issues/1005#issuecomment-1728105742
Indeed I have created https://github.com/python-babel/babel/pull/1033
It's a bit rough that this forces setuptools on everyone that has babel in their dependency chain - is there a plan to remove it again eventually? Could this be made an optional feature?
@sigma67 It wouldn't be impossible, but right now CLI use will require it (since it was, way back when, easier to wrap the setuptools-based commands in optparse magic than the other way around).
I wish I knew how many people actually depended on the setuptools command extensions.
Let's discuss further at https://github.com/python-babel/babel/issues/1040
@sigma67 This issue is unrelated, it's not adding a new dependency. The setuptools dependency was always there, but before Python 3.12 it was built-in but now just need to declare it.
Thanks for addressing this so quickly despite initial concerns 💖
Overview Description
babel has some code that tries to use "setuptools" or fall back to "distutils". https://github.com/python-babel/babel/blob/76677eacd10cc35bea0a11ec1d2f0566cadd4066/babel/messages/frontend.py#L54
"distutils" used to be shipped with Python. Additionally, "setuptools" used to be ensured by virtualenvs. But both of these are gone with Python 3.12 so now babel ends up using a dependency that it never declared. https://github.com/python-babel/babel/blob/76677eacd10cc35bea0a11ec1d2f0566cadd4066/setup.py#L64
From my assessment, it seems it would be correct to add a dependency on setuptools directly. Either only for python_version>=3.12 or perhaps always add this dependency and drop the distutils fallback code.
Workaround:
pip install setuptools
Steps to Reproduce
Install babel not in virtualenv and run it under Python 3.12
Actual Results
https://github.com/mkdocs/mkdocs/actions/runs/6382007433/job/17355070257
Expected Results
No error
Background
https://docs.python.org/3.12/whatsnew/3.12.html#distutils