Re: [Distutils] get_metadata in Distutils
At 02:11 PM 1/12/2009 +0100, Tarek Ziadé wrote:
Ok, I will introduce in my patch the other formats. I am wondering though, how far this would be from an integration of pkg_resources into Distutils/pkgutil, with some API on the top and if it makes sense.
It makes sense to me, I just wanted you to be aware how deep a job it is. You're probably going to need a generic function by importer type, just like the others in pkgutil.
The only difference I can see is that I am working on an API that would return DistributionMetadata instances
Yep... which means that you're going to have to reinvent (and re-test) a fair number of wheels to get there. pkg_resources just lets you ask for a distribution's PKG-INFO metadata, and get it back as a string, regardless of what egg format is in use (including distutils). But to *just* support PKG-INFO, the irony is that you'll have to recreate a fair amount of stuff.
I'd say then : if setutpools version parsing system is superior to distutils.versionpredicate,
I'm not actually familiar with "versionpredicate", so I couldn't say. It's definitely superior to LooseVersion and StrictVersion, which were the only version tools available in the distutils when I started all this.
wouldn't it make sense to merge it into Distutils ?
Maybe that was the initial plans ?
Yes, and yes. Setuptools version parsing (and name/version escaping) functions at least doesn't have any dependencies on anything else. So that's an easy port. If you want Requirement objects as well (specifying various version ranges), a bit more gets pulled in. However, if all you want is to be able to turn versions into opaquely-comparable values, parse_version() and its dependencies are all you need. (By the way, I previously proposed PEP 365 -- that pkg_resources simply be bundled in the stdlib -- to address these needs.)
Well, being able to query the installed version for a package seem to me like a feature that should live in Distutils or pkgutil
In the same way, being able to do version arithmetic is rather important, and it would be better ihmo to have one and only one way to deal with that in Python,
What are you plans for Setuptools development for the future ?
I hope someday to have some time for it again. :)
On Mon, Jan 12, 2009 at 5:07 PM, Phillip J. Eby <pje@telecommunity.com> wrote:
At 02:11 PM 1/12/2009 +0100, Tarek Ziadé wrote:
Ok, I will introduce in my patch the other formats. I am wondering though, how far this would be from an integration of pkg_resources into Distutils/pkgutil, with some API on the top and if it makes sense.
It makes sense to me, I just wanted you to be aware how deep a job it is. You're probably going to need a generic function by importer type, just like the others in pkgutil.
I am making some progress, now the patch works with zipped eggs, unzipped eggs and regular .egg-info files. I am wondering about other cases though: - it seems that pkg_resources works on .egg-info *directories*. When does this case happen ? - you said that its needs to work on nested packages, but I can't see the difference when grabbing the metadata in such a package There are also some mechanisms I am not sure at a 100% of, like the right way to loop over sys.path entries, and the way to deal with sys.meta_path, etc.. Regards Tarek -- Tarek Ziadé | Association AfPy | www.afpy.org Blog FR | http://programmation-python.org Blog EN | http://tarekziade.wordpress.com/
participants (2)
-
Phillip J. Eby
-
Tarek Ziadé