Skip to content

Disable setuptools injection in Python 3.12+ (whenever distutils gets removed from stdlib) #10487

@pradyunsg

Description

@pradyunsg

What's the problem this feature will solve?

Currently, pip invokes setup.py files in a manner that injects setuptools into sys.modules; which is mainly for compatibility with projects that use distutils.setup in their setup.py files.

With distutils being deprecated and slated for removal, we should drop our compatibility shim for this.

Describe the solution you'd like

Change the logic used for make_setuptools_shim_args, to not attempt the setuptools injection for Python 3.12+ (whenever distutils gets removed).

Alternative Solutions

Do nothing. Continue performing this injection after Python 3.12+, since it'll be a no-op.

Additional context

https://pip.pypa.io/en/stable/cli/pip/#setuptools-injection for the current documentation on this.

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions