fbpx
dirtSimple.orgwhat stands in the way, becomes the way
EasyInstall – A new era in Python package management?

EasyInstall – A new era in Python package management?

Okay, maybe that’s a bit bold. But the new EasyInstall command-line tool can take any number of distutils source package URLs (or local filenames), download them, build them, and install them with or without a .pth file. Better yet, you can also easily upgrade, downgrade, and/or uninstall packages, as well as select desired package versions at runtime.

This is the very first alpha release, so there might be some rough edges. I plan to start systematically working my way through PyPI to test it with different packages. (Well, first I plan to try cases that are likely to be tough.)

EasyInstall doesn’t absolve you from needing to have a C compiler, though, if you’re installing a package that includes extensions. However, if someone has packaged a Python Egg for that package for your platform, you can simply run EasyInstall on the .egg file’s URL (or local filename) to download and install it on your system. So, perhaps we’ll soon see people packaging eggs for various platforms, and making those download URLs available.

EasyInstall is at this point still something of a sketch. An ideal version would probably let you search PyPI for the desired packages, without needing to know an exact download URL. Maybe it would have a GUI, too. Who knows? But it’s open source, so feel free to create your own extensions. In the meantime, I’ll continue to add features to both EasyInstall and the underlying “setuptools” package as I need them.

I also hope that package authors will consider making their packages more “egg-friendly” by using the ‘pkg_resources’ module supplied by setuptools, and especially by including dependency information in their source distributions (in a ‘PackageName.egg-info/depends.txt’ file) so that the pkg_resources dependency manager can automatically activate the right package versions at runtime. This is where things will start to get really different, because it will then be a lot easier for people to break up large packages into smaller packages with dependencies.

But before that can start happening, I really need to finish the Python Eggs developer documentation, which is still lacking a bit, contentwise. However, given the widespread interest in “CPAN clones” of late, I felt it was important to get a real package management solution out there right away, before people started trying to implement package managers based on PEP 262 or similar approaches that don’t work – at least, not as well as Python Eggs do – for applications, multiple version support, or any number of other scenarios.

So, here’s hoping that those of you who are working on CPAN clones will take a look at EasyInstall, and see whether you can save some work by importing a few classes from the easy_install and pkg_resources modules. But, if you find that what’s there isn’t helpful, I’d really like to hear from you. Similarly, if you’ve found a package that EasyInstall won’t build correctly, please let me know via the Distutils-SIG mailing list.

Update: There was a problem with the original EasyInstall “eggsecutable” for Python 2.4 that I uploaded; it seems that the “-m” option to Python will only work with modules that are actual .py files, which means you can’t use it inside of eggs. Darn. Oh well, the “eggsecutable” recipe for Python 2.3 also works with 2.4, so I just rebuilt the Python 2.4 egg to work the same way.

Join the discussion
9 comments
  • I take it that you find this a better “eggsplanation” and “eggsample” of why Python Eggs aren’t just a .jar clone in search of a purpose? 🙂

  • If you’re going to create a GUI, look at ZeroInstall. If you’re going to distribute pre-compiled C, look at autopackage. If you’re going to get tired of me saying so, tell me that you have. 🙂

  • In relation to the dependency management aspects, have you had a look at Robin Dunn’s attempt at building a versioning mechanism for wxPython? (http://wiki.wxpython.org/index.cgi/MultiVersionInstalls)

    As for -m only working for real .py files, it’s a limitation inherited from the execfile() infrastructure. PEP 338 aims to lift some of the restrictions, and as it suggests an execmodule function written in Python, it should be easier to later solve problems like the zipfile one.

  • “””If you’re going to create a GUI, look at ZeroInstall. If you’re going to distribute pre-compiled C, look at autopackage. If you’re going to get tired of me saying so, tell me that you have. :)”””

    I have. I didn’t see where either one had anything that made sense for Python libraries. (ZeroInstall is actually a filesystem, for one thing.) As for C, I was under the impression that autopackage still has a build step.

  • “””In relation to the dependency management aspects, have you had a look at Robin Dunn’s attempt at building a versioning mechanism for wxPython?”””

    Yes; but EasyInstall already does this, and better; it works for any package, not just wxPython. To do the equivalent with EasyInstall, your script does something like ‘pkg_resources.require(“wxPython==2.5”)’ to select an exact version, or ‘pkg_resources.require(“wxPython>=2.5”)’ to select the latest available version >= 2.5.

    Just try running EasyInstall on a couple of different versions of a package; the latest version of EasyInstall outputs a short report after installing each package, giving examples of how to switch versions using pkg_resources.require(), if you installed using the –install-dir or –multi-version options.

  • .. & this relates to Gentoo’s Portage in some fantastic way too, right?

    I’m sure familiarity with their more general package management system would be valuable in the design of a python-centric one.

  • “””I’m sure familiarity with their more general package management system would be valuable in the design of a python-centric one.”””

    And I’m sure that familiarity with EasyInstall would be valuable in helping you figure out whether you’d like to make a feature request or contribute a patch for something that EasyInstall doesn’t yet do. 🙂

    Translation: please stop sending me comments about random package management systems, apparently without so much as reading the documentation I linked to. If you want me to add some feature to EasyInstall, the way to make that happen is to first read the wiki pages and make sure you understand what EasyInstall is and what it does. Then, if it doesn’t do what you want (and is still in the project’s scope), write an explanation of the feature you want and how you expect it to work in Python, and send it to the distutils-sig mailing list.

    Or, you can do what Ian Bicking and other people have been doing, and offer to *contribute patches* to support the additional functionality you want.

  • “I didn’t see where either one had anything that made sense for Python libraries. (ZeroInstall is actually a filesystem, for one thing.)”

    There is an old implementation that uses a filesystem. The new one is actually written itself in Python:

    http://0install.net/injector.html

    The ROX project (most of which is written in Python) is using this. In fact, the tutorial shows running a Python programs, which depends on a Python library (both fetched via Zero Install):

    http://0install.net/injector-using.html

dirtSimple.org

Menu

Stay In Touch

Follow our feeds or subscribe to get new articles by email on these topics:

  • RSS
  • RSS
  • RSS

 

Get Unstuck, FAST

Cover photo of "A Minute To Unlimit You" by PJ Eby
Skip to toolbar