[Python-Dev] PEP 376

Tarek Ziadé ziade.tarek at gmail.com
Wed Jul 1 01:34:53 CEST 2009


On Wed, Jul 1, 2009 at 12:47 AM, Steven D'Aprano<steve at pearwood.info> wrote:
> On Wed, 1 Jul 2009 05:19:07 am Tarek Ziadé wrote:
>> 2009/6/30 Guido van Rossum <guido at python.org>:
> ...
>> > So what *is* the distutils-sig consensus?
>>
>> The consensus is to have one and only one way to install
>> distributions in Python,
>
> "One and only one way"? Shouldn't that be "one obvious way"?
>
> There is a big difference -- the first implies that Python should
> actively prohibit (somehow!) or at least inhibit any other install
> mechanisms, while the second implies that there should be a preferred,
> obvious, but not compulsory, mechanism.
>
> If you say "one and only one", and I take you at your word, then I can
> only assume that you want to actively prevent me from manually
> dropping .py files into my PYTHONPATH and having them work. I would
> guess that's probably not what you mean, but that's what it sounds like
> you're proposing. I don't like guessing -- would you please clarify
> what you mean?

one and only one way to install a distribution using its setup.py script,
among the ways provided by easy_install, distutils and pip.
e.g. avoiding having different format/location for the generated .egg.info;

>
>
> Some questions and comments regarding the PEP:
>
> Rationale:
> http://www.python.org/dev/peps/pep-0376/#id13
>
> "There are too many ways to do it."
>
> Why is having multiple ways of adding distributions a problem to be
> solved? On my Linux system, I can add packages with rpm/yum, or I can
> compile them from source and manage them myself. I possibly even could
> (but never have!) install apt-get and use it to manage packages.

If you choose not to manually manage them, the packaging system you use
is installing files in standard places where you expect to find them,
and provides
tools to know what is installed.

Right now we don't have this standard in Python stdlib to interact
with the distributions in a Python installation.  And since packaging systems
that are used out there could use the same standard, since we would like
to make distutils a reference package for this kind of need, it seems
like a good
idea to define this standard in here. then each packaging system is free
to implement its features on the top of it, ala wsgiref.

>
> Another rationale which should be added:
>
> There is no standard way of uninstalling distributions.
>
>
> How distributions are installed:
> http://www.python.org/dev/peps/pep-0376/#id14
>
> "The problem is that many people use easy_install (from the setuptools
> project [4]) or pip [5] to install their packages, and these
> third-party tools do not install packages in the same way that
> Distutils does"
>
> Why is that a problem to be solved?

Being able to retrieve the metadata of an installed distribution, or
the list of its installed files,
no matter which tool installed it.

>
>
> Uninstall information:
> http://www.python.org/dev/peps/pep-0376/#id15
>
> "Under some circumstances, you might not be able to know for sure that
> you have removed everything, or that you didn't break another
> distribution by removing a file that is shared among several
> distributions."
>
> I don't see how this proposal will help in the second case. If you
> install distribution Spam, containing file spam.py, and then install
> distribution Ham, which requires spam.py, what is to prevent you from
> removing Spam and breaking Ham?
>
> If you don't propose a solution for the dependency problem, you should
> say so.

This problem is solved as described later in the PEP, with the API
that allows you to get the
list of the distributions that use a given file. (thanks to the RECORD files)

If Spam and Ham use smap.py, and if you uninstall Spam, this file will
not be removed
because the API will tell you its used in both distributions.

>
>
> The RECORD format:
> http://www.python.org/dev/peps/pep-0376/#id19
>
> "Each record is composed of three elements.
> ...
> the MD5 hash of the file, encoded in hex. Notice that pyc and pyo
> generated files will not have a hash because they are automatically
> produced from py files."
>
> What if your distribution is not a source distribution and only provides
> pyc and pyo files?
>

Good question, I have never created such distribution.
Aren't they read-only files ? What happens if someone change them, do we
really want to keep them since it breaks the distribution ? How they
can be changed in the first place,
without the source ?

Tarek


More information about the Python-Dev mailing list