question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
hugovkcommented, Sep 21, 2021

i.e. weit until 3.12beta1 or so

The 3.12 schedule isn’t published yet, but looking at the 3.11 schedule, I’d expect 3.12beta1 to be some time around May 2023.

1reaction
uranusjrcommented, Sep 20, 2021

Note that while distutils is scheduled for removal in 3.12, it is not guaranteed to be, and if we remove the shim without Python actually removing the module, the bare distutils.core.setup() call would do more harm than we keep the legacy path. So the removal should not happen before distutils is actually gone (i.e. weit until 3.12beta1 or so).

Read more comments on GitHub >

github_iconTop Results From Across the Web

PEP 632 – Deprecate distutils module
Pip has been silently replacing distutils with setuptools when installing packages for a long time ... It is time to remove it from...
Read more >
distutils — Building and installing Python modules — Python ...
distutils is deprecated with removal planned for Python 3.12. ... The distutils package provides support for building and installing additional modules in.
Read more >
PEP 632 - Deprecate distutils module
I think this argument is going a bit in the wrong direction. “setup.py install” is no longer needed nowadays, since pip, ...
Read more >
Issue 41282: Deprecate and remove distutils - Python tracker
Already, Setuptools is identifying emergent bugs and other defects in ... deprecate distutils in 3.10 and 3.11 and remove distutils in 3.12.
Read more >
What's new in PyObjC — PyObjC - the Python to Objective-C ...
Added two options to the build_ext command in the setup.py of pyobjc-core: ... Remove -[OC_PythonArray getObjects:inRange:] , it is not part of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found