libcollect – collecting Python distributions

July 3rd, 2008 at 8:05 pm

Here’s an excerpt from the documentation of libcollect:

Motivation:

Imagine that you’ve written a script that uses several libraries, some of which you’ve written and some you’ve downloaded and installed (for example PyYAML). You want to distribute the script to your friends and co-workers, who already have Python installed with all the standard library. But your script won’t run on their machines, because they have neither your personal libraries, nor PyYAML installed. So what can you do ?

* You can ask them to install PyYAML and other libraries your script uses, and send them your own libraries. This is a lengthy and inconvenient process.
* You can use a tool like py2exe to package your delivery. This has a downside, however. py2exe produces large files (several MBs) and you may not want that.
* You can painstakingly collect the libraries into a directory where your script can find them, and package the directory together with the script.

LibCollect makes the third option trivial, by doing all the dirty work for you.

libcollect really fills a need for me, and I’m much happier about easy distribution of my scripts after I’ve written it. I post it online in the hope that other people will find it useful as well.

Related posts:

  1. Collecting Python insights
  2. Packaging DLLs with executables made by py2exe
  3. A Tetris clone in Python / wxPython
  4. Plotting in Python: matplotlib vs. PyQwt
  5. matplotlib – plotting with Python

3 Responses to “libcollect – collecting Python distributions”

  1. blaineNo Gravatar Says:

    awesome. thanks for the link, i’m sure libcollect will be useful.

  2. dpetersonNo Gravatar Says:

    Aren’t you leaving out the option of creating a setup.py such that you can publish your script as an egg which lists its dependencies on these other libs and then your users can just easy_install your egg and all the dependencies get installed too? Of course, your dependencies then have to be available from PyPi or somewhere that easy_install can find them at. But at that point, no one has to go around manually installing dependencies anymore.

    BTW, if you don’t like easy_install there are other alternatives just as PIP, Enstaller, and (I think) a couple others.

  3. elibenNo Gravatar Says:

    @dpeterson,

    I’m not sure you’ve got my point about libcollect. It’s not about publishing my code on PyPi, I can indeed use easy_install for that. It’s about collecting my code with all the non-standard dependency modules it uses, so that my client who wants to run code can run it with a clean Python installation, without having easy_install download dependencies from PyPi. This would not work for me, for two reasons:

    My clients have no web access sometimes
    Many of the “dependencies” are my own modules that are not found on PyPi