pypa / setuptools

Official project repository for the Setuptools build system
https://pypi.org/project/setuptools/
MIT License
2.38k stars 1.16k forks source link

Deprecate SETUPTOOLS_USE_DISTUTILS=stdlib #3625

Open jaraco opened 1 year ago

jaraco commented 1 year ago

Soon, as Python 3.12 starts to roll out, users will be unable to use SETUPTOOLS_USE_DISTUTILS=stdlib. Moreover, Setuptools supporting this mode also adds complexity to the project and reduces the ability of distutils/setuptools to evolve to consolidate behaviors. Let's deprecate this mode.

kiorky commented 1 year ago

If i am correct, this will break the workaround needed on #3301 on old pythons on Debian based systems.

jaraco commented 1 year ago

Yes, perhaps. The deprecation wouldn't, but the subsequent removal probably would. There are different ways we could possibly ameliorate the situation:

I've added that bug to the project for consideration.

kiorky commented 1 year ago
  • wait for those environments to drop support

This will lead up to 2027+5=2032 at least (ubuntu 22.04LTS end ESM support).

Maybe the simpler would be to make sure that downstream vendor patches handle the new setuptools flawlessly, even on old packaged pythons which are in the official tree (eg python38 on ubuntu 20.04 (support 'til 2030) or python37 on ubuntu18.04 (support 'til 2027) which even does not have the _distutils_system_mod.py file. I think everybody would be happy of that.

hroncok commented 1 year ago

I've been proactively building Fedora packages without distutils to see what breaks. Figured out some setuptools tests fail. Hence: https://github.com/pypa/setuptools/pull/3636

culler commented 1 year ago

I don't think that Python 3.11.2 is considered old. However, I am unable to import setuptools without setting the environment variable that you want to remove. Wouldn't it be better to fix setuptools first?

This is what I am seeing:

Python 3.11.2 (v3.11.2:878ead1ac1, Feb  7 2023, 10:02:41) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import setuptools
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/culler/Library/Python/3.11/lib/python/site-packages/setuptools/__init__.py", line 8, in <module>
    import _distutils_hack.override  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/culler/Library/Python/3.11/lib/python/site-packages/_distutils_hack/override.py", line 1, in <module>
    __import__('_distutils_hack').do_override()
  File "/Users/culler/Library/Python/3.11/lib/python/site-packages/_distutils_hack/__init__.py", line 77, in do_override
    ensure_local_distutils()
  File "/Users/culler/Library/Python/3.11/lib/python/site-packages/_distutils_hack/__init__.py", line 64, in ensure_local_distutils
    assert '_distutils' in core.__file__, core.__file__
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/distutils/core.py
>>> import os
>>> os.environ['SETUPTOOLS_USE_DISTUTILS'] = 'stdlib'
>>> import setuptools
>>> setuptools.__version__
'67.6.0'
jmohan57 commented 1 week ago

Hello, Can I jump your project?