Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove bundled setuptools #95299

Closed
sbidoul opened this issue Jul 26, 2022 · 9 comments
Closed

Remove bundled setuptools #95299

sbidoul opened this issue Jul 26, 2022 · 9 comments
Labels
3.12 bugs and security fixes topic-ensurepip type-feature A feature request or enhancement

Comments

@sbidoul
Copy link
Contributor

sbidoul commented Jul 26, 2022

Feature or enhancement

Remove the bundled setuptools so that ensurepip and python -m venv only installs pip.

Context

The setup.py install command of setuptools is deprecated.

However, in an environment where setuptools is installed but wheel is not (such as one created with python -m venv), pip falls back on running the deprecated and non-standard setup.py install.

Since version 22.1 pip works correctly by default in environments where setuptools is not installed, by enabling its PEP 517 mode automatically, leading to unsurprising installations in most cases.

So, in order to progressively expose more users to standard-based installation workflows, we (the pip team) would like that virtual environments are created without setuptools by default.

Users faced with failing installations following this change (likely due to packages with customized setup.py that do not support building a wheel) can easily pip install setuptools to solve the issue.

Previous discussion

pypa/pip#8102 (comment) and following comments has some more context.

Linked PRs

@sbidoul sbidoul added the type-feature A feature request or enhancement label Jul 26, 2022
@sbidoul
Copy link
Contributor Author

sbidoul commented Jul 26, 2022

@pablogsal do you think it is still acceptable to do this in 3.11? If positive we can likely land a PR on time for RC1.

@pablogsal
Copy link
Member

Unfortunately I don't feel comfortable landing this so late in the release cycle, specially so close to RC1 and given the current stability of 3.11 :(

This will need to wait until 3.12.

@rafrafek
Copy link

rafrafek commented Nov 7, 2022

It feels strange that setuptools is included when using -m venv, but wheel is not included.

@pradyunsg
Copy link
Member

I've filed #101039 for this (almost had a number with three 0s), targetting 3.12.

@edmorley
Copy link

Since version 22.1 pip works correctly by default in environments where setuptools is not installed, by enabling its PEP 517 mode automatically, leading to unsurprising installations in most cases.

Do you have some examples of cases where the PEP 517 mode doesn't work for legacy packages? :-)

@FFY00
Copy link
Member

FFY00 commented Mar 4, 2023

PEP 517 is backwards compatible, it should work on legacy packages, the opposite is the issue, pip trying to use the legacy path for packages that need PEP 517.

pradyunsg added a commit to pradyunsg/cpython that referenced this issue Apr 6, 2023
pradyunsg added a commit to pradyunsg/cpython that referenced this issue Apr 9, 2023
# This is the 1st commit message:

pythongh-95299: Rework test_cppext.py to not invoke setup.py directly

# This is the commit message #2:

Add tests/cppextdata data to `TESTSUBDIRS`

# This is the commit message #3:

Revert "Add tests/cppextdata data to `TESTSUBDIRS`"

This reverts commit 635492e.
pradyunsg added a commit that referenced this issue Apr 13, 2023
)

* gh-95299: Rework test_cppext.py to not invoke setup.py directly

* Add tests/cppextdata data to `TESTSUBDIRS`

* Revert "Add tests/cppextdata data to `TESTSUBDIRS`"

This reverts commit 635492e.

* Revert "gh-95299: Rework test_cppext.py to not invoke setup.py directly"

This reverts commit 41c5a66.

* Build and install the extension in a temporary directory instead

* Pull in wheels for setuptools and wheel for testing extension builds
carljm added a commit to carljm/cpython that referenced this issue Apr 13, 2023
* main:
  pythongh-103479: [Enum] require __new__ to be considered a data type (pythonGH-103495)
  pythongh-103365: [Enum] STRICT boundary corrections (pythonGH-103494)
  pythonGH-103488: Use return-offset, not yield-offset. (pythonGH-103502)
  pythongh-103088: Fix test_venv error message to avoid bytes/str warning (pythonGH-103500)
  pythonGH-103082: Turn on branch events for FOR_ITER instructions. (python#103507)
  pythongh-102978: Fix mock.patch function signatures for class and staticmethod decorators (python#103228)
  pythongh-103462: Ensure SelectorSocketTransport.writelines registers a writer when data is still pending (python#103463)
  pythongh-95299: Rework test_cppext.py to not invoke setup.py directly (python#103316)
pradyunsg added a commit that referenced this issue Apr 18, 2023
…101039)

Remove the bundled setuptools wheel from ensurepip, and stop installing setuptools in environments created by venv.

Co-Authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
@pradyunsg
Copy link
Member

https://docs.python.org/3.12/library/venv.html#an-example-of-extending-envbuilder is the final piece of work here -- that example needs to be updated to use something more modern or otherwise behave differently to showcase extending behaviours of the class.

aisk pushed a commit to aisk/cpython that referenced this issue Apr 18, 2023
…python#103316)

* pythongh-95299: Rework test_cppext.py to not invoke setup.py directly

* Add tests/cppextdata data to `TESTSUBDIRS`

* Revert "Add tests/cppextdata data to `TESTSUBDIRS`"

This reverts commit 635492e.

* Revert "pythongh-95299: Rework test_cppext.py to not invoke setup.py directly"

This reverts commit 41c5a66.

* Build and install the extension in a temporary directory instead

* Pull in wheels for setuptools and wheel for testing extension builds
zooba added a commit to zooba/cpython that referenced this issue Apr 18, 2023
carljm added a commit to carljm/cpython that referenced this issue Apr 20, 2023
* main: (24 commits)
  pythongh-98040: Move the Single-Phase Init Tests Out of test_imp (pythongh-102561)
  pythongh-83861: Fix datetime.astimezone() method (pythonGH-101545)
  pythongh-102856: Clean some of the PEP 701 tokenizer implementation (python#103634)
  pythongh-102856: Skip test_mismatched_parens in WASI builds (python#103633)
  pythongh-102856: Initial implementation of PEP 701 (python#102855)
  pythongh-103583: Add ref. dependency between multibytecodec modules (python#103589)
  pythongh-83004: Harden msvcrt further (python#103420)
  pythonGH-88342: clarify that `asyncio.as_completed` accepts generators yielding tasks (python#103626)
  pythongh-102778: IDLE - make sys.last_exc available in Shell after traceback (python#103314)
  pythongh-103582: Remove last references to `argparse.REMAINDER` from docs (python#103586)
  pythongh-103583: Always pass multibyte codec structs as const (python#103588)
  pythongh-103617: Fix compiler warning in _iomodule.c (python#103618)
  pythongh-103596: [Enum] do not shadow mixed-in methods/attributes (pythonGH-103600)
  pythonGH-100530: Change the error message for non-class class patterns (pythonGH-103576)
  pythongh-95299: Remove lingering setuptools reference in installer scripts (pythonGH-103613)
  [Doc] Fix a typo in optparse.rst (python#103504)
  pythongh-101100: Fix broken reference `__format__` in `string.rst` (python#103531)
  pythongh-95299: Stop installing setuptools as a part of ensurepip and venv (python#101039)
  pythonGH-103484: Docs: add linkcheck allowed redirects entries for most cases (python#103569)
  pythongh-67230: update whatsnew note for csv changes (python#103598)
  ...
edmorley added a commit to edmorley/python-build-standalone that referenced this issue Aug 24, 2024
For parity with the `ensurepip` and `venv` modules, which no
longer install setuptools as of Python 3.12:
- python/cpython#95299
- python/cpython@ece20db

Fixes indygreg#300.
edmorley added a commit to edmorley/python-build-standalone that referenced this issue Sep 7, 2024
For parity with the `ensurepip` and `venv` modules, which no
longer install setuptools as of Python 3.12:
- python/cpython#95299
- python/cpython@ece20db

Fixes indygreg#300.
zanieb pushed a commit to indygreg/python-build-standalone that referenced this issue Sep 9, 2024
For parity with the `ensurepip` and `venv` modules, which no
longer install setuptools as of Python 3.12:
- python/cpython#95299
- python/cpython@ece20db

Fixes #300.
dajose added a commit to HPENetworking/topology that referenced this issue Oct 18, 2024
* Remove distutils references (it was removed on python3.12)
* Add setuptools as dependency on tox environments (see
  python/cpython#95299)
stynoo added a commit to stynoo/withings-sync that referenced this issue Oct 20, 2024
dajose added a commit to HPENetworking/topology that referenced this issue Oct 22, 2024
* Remove distutils references (it was removed on python3.12)
* Add setuptools as dependency on tox environments (see
  python/cpython#95299)
thehale added a commit to thehale/datefinder that referenced this issue Nov 20, 2024
As of Python 3.12, `setuptools` is no longer installed by default (see: python/cpython#95299)

At some point I'll migrate this project to the latest approaches for package management, but for now, this is a functional stopgap.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and security fixes topic-ensurepip type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

8 participants