On Sat, 2 Oct 2021 at 03:27, Illia Volochii <illia.voloc...@gmail.com> wrote:
>
> Hi everyone,
>
> ensurepip includes private copies of pip and setuptools. But PEP 453 states 
> that "once pip is able to run pip install --upgrade pip without needing 
> setuptools installed first, then the private copy of setuptools will be 
> removed from ensurepip in subsequent CPython releases."
> https://www.python.org/dev/peps/pep-0453/#automatic-installation-of-setuptools

Interesting. Pip does not need setuptools installed to upgrade itself,
so a strict reading of the PEP would seem to imply that we need to
remove setuptools, as you say. However, looking at things more
practically, pip still needs setuptools to do "legacy" installs of
source distributions (when the project does not include a
`pyproject.toml`) and for editable installs of setuptools-based
projects. If we stopped shipping setuptools as part of ensurepip, I
imagine people would complain that we'd "broken" things. Telling them
that it's not broken, all they need to do is `pip install setuptools`,
and we only ever promised that the supplied pip could be used to
bootstrap a full environment, doesn't seem likely to go down well IMO.

(Technically, some aspects of pip don't work, or fall back to "legacy"
code paths, if the `wheel` project isn't installed, so ensurepip
"needs" wheel in the same sense as it "needs" setuptools, but the
breakage is less significant, and people who care are used to the
current situation and know what to do. So yes, that argues we could do
the same to setuptools, it's just a bigger impact.)

> At the moment pip itself includes a needed part of setuptools.
> https://github.com/pypa/pip/tree/9c474d4862907ae220ced0fcdbd76660955ff732/src/pip/_vendor/pkg_resources

That's internal to pip, and the pip code that uses that, does not need
an externally-supplied setuptools.

> I experimented with modifying ensurepip in the main branch not to install 
> setuptools, and then used it to install pip. It worked fine.
> Then I run `./python -m pip install --upgrade pip`, and it upgraded pip 
> successfully.
>
> Does this mean that we can drop the copy of setuptools?

IMO, it's too early to consider dropping setuptools, notwithstanding
what a strict reading of the PEP says. When pip has removed more of
the "legacy" code paths, this situation could change, but we're not
there yet.

Paul
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/AM7ATX4IWLNXKG54Z34GYZ2D7RJWQUNC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to