[Python-Dev] Proposing PEP 376

Tarek Ziadé ziade.tarek at gmail.com
Sun Apr 4 01:05:34 CEST 2010


On Fri, Apr 2, 2010 at 1:56 AM, Glyph Lefkowitz <glyph at twistedmatrix.com> wrote:
> First: thank you distutils-sig, and especially Tarek, for spearheading this
> effort!

Thanks :)

> I'm particularly excited about the "Distribution" object that this PEP
> specifies.  I've been waiting for a long time to be able to load an object
> describing a distribution, rather than running setup.py and hoping that it
> mutated the right state!

Notice that this Distribution class will work with installed
distributions, where the info where built by running setup.py. As
opposed to distritbutions that are not yet installed where these infos
are still hidden in setup.py.

Although we are currently working in distutils2 to get rid of setup.py
and have a pure static metadata file.


> On Apr 1, 2010, at 5:51 PM, Tarek Ziadé wrote:
>
> - to provide a basic *uninstaller* feature in the distutils2 project.
>
> Second: It seems to me that a major missing feature in the PEP is the
> ability to run some code during installation and uninstallation, especially
> since it is so easy to run ad-hoc code in setup.py with no way of un-doing
> what it did.

That was a feature request for distutils: install/removal hooks like
what RPM or the msi installer
offers.   I think this could be done in distutils2 no matter what
happens to the PEP. I am adding this in the bug tracker.

> Third: The PEP is silent on what happens to files whose hash _has_ changed
> from its install-time value.  I guess the implied plan would be to leave
> them in place.  However, this may have nasty side-effects; for example, if
> the files are test files, then they might be loaded during test discovery,
> and report exceptions since the code that they're testing has been removed.
>  My suggestion would be to have a specific "quarantine" area where the
> distutils uninstaller can put modified files that would have been removed as
> part of a specific distribution, so they aren't still present on PYTHONPATH.
>  I can also think of reasons why you might not want to do this, but either
> way, the consequence of changing an installed file should be made explicitly
> clear in the PEP: if they are to be left in place, it should emphasize that
> point.

The strategy about what should be done with modified files upon
uninstallation is up to the implementation I guess. But the PEP should
mention what Distutils2 basic uninstall function should do. The
quarantine strategy sounds like a great idea. I propose to add this in
the PEP in the implementation details section, and say in the specs
that it's up to the implementation to decide.


> Finally, one minor bit of bikeshedding, of which I promise to say nothing
> more if there is not unanimous agreement: I dislike the use of "get_" in
> function names, since it adds more characters without really adding more
> information.  get_file_users is particularly bad, since it makes me think
> that it's going to return a list of processes with a file open, or a list of
> UIDs or something like that.  I suggest these names instead:
>     get_distributions() -> active_distributions()
>     get_distribution(name) -> active_distribution_named(name)
>     get_file_users(path) -> distributions_using_path(path)
> where "active" means "on the current sys.path and thereby accessible by
> 'import'".

"active" sounds superfluous too I think, since all distributions that
are found *are* active.
So it could be "distributions()". But I am not comfortable with this
single word because
it sounds to me like a sequence object rather than a function. But
that might be just me..

> This naming would also make the behavior of get_file_users a bit
> clearer; if the intention is to return only active, loadable distributions
> (you don't want to be able to use get_file_users to inspect other Python
> installations or virtualenvs) it could be called
> active_distributions_using_path.

+1 on distributions_using_path()

> Thanks again to the PEP's author and many contributors,

Thanks for the feedback !

-- 
Tarek Ziadé | http://ziade.org


More information about the Python-Dev mailing list