bbfreeze creates stand-alone executables from python scripts. It's similar in purpose to the well known py2exe for windows, py2app for OS X, PyInstaller and cx_Freeze (in fact ancient versions were based on cx_Freeze. And it uses the modulegraph package, which is also used by py2app).
It has the following features:
bbfreeze works on windows and UNIX-like operating systems. bbfreeze has been tested with python 2.4, 2.5 and 2.6. bbfreeze will not work with python versions prior to 2.3 as it uses the zipimport feature introduced with python 2.3.
bbfreeze has been developed by brainbot technologies AG. Questions and suggestions should be send to the bbfreeze-users mailing list: bbfreeze-users@googlegroups.com
You can subscribe by sending email to bbfreeze-users-subscribe@googlegroups.com
An archive is available at http://groups.google.com/group/bbfreeze-users
You can also reach the author via email to schmir@gmail.com
Windows Eggs and the source code can be downloaded from http://cheeseshop.python.org/pypi/bbfreeze/.
http://github.com/schmir/bbfreeze carries a git repository of the in-development version
Use:
git clone http://github.com/schmir/bbfreeze.git
to create a copy of the repository, then:
git pull
inside the copy to receive the latest version.
You need to have setuptools/easy_install installed. Installation should be as easy as typing:
easy_install bbfreeze
This should download bbfreeze and it's dependencies modulegraph and altgraph and install them.
bbfreeze provides a command line utility called bb-freeze, which freezes all python scripts given on the command line into the directory dist, which then contains for each script an executable and all dependencies needed by those executables.
Example Usage:
$ cat hello-world.py #! /usr/bin/env python import sys import email print unicode("hello", "utf8"), unicode("world!", "ascii") print "sys.path:", sys.path print "__file__:", __file__ print "__name__:", __name__ print "locals():", locals() print "sys.argv", sys.argv print "sys.executable:", sys.executable $ bb-freeze hello-world.py *** applied <function recipe_email at 0xb7ba702c> $ dist/hello-world hello world! ... $ dist/py Python 2.5.1c1 (r251c1:54692, Apr 11 2007, 01:40:50) [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2 Type "help", "copyright", "credits" or "license" for more information. (MyConsole) >>> import email $
bbfreeze provides a distutils command which works much like the 'bb-freeze' command line tool, but integrates nicely into distutils and setuptools. It collects all 'console_scripts' 'gui_scripts' entry-points, generates the wrapper scripts (like easy_install would do) and freezes these scripts.
After installing bbfreeze, every setup.py which used setuptools, has a new command 'bdist_bbfreeze'. To show the help message just run:
python setup.py bdist_bbfreeze --help
Usage examples:
# freeze all scripts into ./dist/<egg_name>-<egg_version>/ python setup.py bdist_bbfreeze
# same, but use tagging for "daily build" or "snapshot" releases python setup.py egg_info --tag-build=dev bdist_bbfreeze
The preferred way to use bbfreeze is by writing short python scripts, which use bbfreeze's API. Let's start with a short example:
from bbfreeze import Freezer f = Freezer("hello-world-1.0", includes=("_strptime",)) f.addScript("hello-world.py") f.addScript("hello-version.py") f() # starts the freezing process
bbfreeze.Freezer(distdir="dist", includes=(), excludes=()) instantiates a Freezer object. It will create the frozen executables and dependencies inside the distdir directory. includes is a list or tuple of modules to include, excludes is a list or tuple of modules to exclude. Note that the freezer will delete the directory distdir before freezing!
bbfreeze.Freezer objects have the following members:
Recipes provide a way to control the freezing process. Have a look at bbfreeze/recipes.py if you need to implement your own. Note that the API might change.
The glibc version on the system used for freezing will generally be the minimum glibc version required to run the binaries.
gtk, gdk, pango, glib shared libraries will not be copied by the freezing process. Those need a rather complicated runtime system and copying them would probably only lead to problems.
binaries created with python 2.6 or 2.7 will need the Microsoft Visual C++ 2008 Redistributable Package (download) installed on the target machine.
bbfreeze contains a modified copy of modulegraph, which is distributed under the MIT license and is copyrighted by Bob Ippolito.
bbfreeze contains a modified copy of getpath.c from the python distribution, which is distributed under the python software foundation license version 2 and copyrighted by the python software foundation.
bbfreeze includes a module 'bdist_bbfreeze.py' which is
Copyright 2008 by Hartmut Goebel <h.goebel@goebel-consult.de>
The 'bdist_bbfreeze' module may be distributed under the same licence as bbfreeze itself.
The remaining part is distributed under the zlib/libpng license:
Copyright (c) 2007, 2008 brainbot technologies AG
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: