bbfreeze

Create standalone executables from Python scripts
Download

bbfreeze Ranking & Summary

Advertisement

  • Rating:
  • License:
  • zlib/libpng License
  • Publisher Name:
  • Ralf Schmitt
  • Publisher web site:
  • http://github.com/schmir/

bbfreeze Tags


bbfreeze Description

Create standalone executables from Python scripts bbfreeze is a Python module to create 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:easy installation bbfreeze can be installed with setuptools' easy_install command.zip/egg file import tracking bbfreeze tracks imports from zip files and includes whole egg files if some module is used from an eggfile. Packages using setuputils' pkg_resources module will now work (new in 0.95.0)binary dependency tracking bbfreeze will track binary dependencies and will include DLLs and shared libraries needed by a frozen program.multiple script freezing bbfreeze can freeze multiple scripts at once.python interpreter included bbfreeze will create an extra executable named 'py', which might be used like the python executable itself.automatic pathname rewriting pathnames in tracebacks are replaced with relative pathnames (i.e. if you import package foo.bar from /home/jdoe/pylib/ tracebacks generated from functions in foo.bar will not show your local path /home/jdoe/pylib/foo/bar.py. They will instead show foo/bar.py)distutils command 'bdist_bbfreeze' A new distutils/setuptools command bdist_bbfreeze integrates bbfreeze into your setup.py.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.InstallationYou need to have setuptools/easy_install installed. Installation should be as easy as typing:easy_install bbfreezeThis should download bbfreeze and it's dependencies modulegraph and altgraph and install them.bb-freeze - command line toolbbfreeze 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 pythonimport sysimport emailprint unicode("hello", "utf8"), unicode("world!", "ascii")print "sys.path:", sys.pathprint "__file__:", __file__print "__name__:", __name__print "locals():", locals()print "sys.argv", sys.argvprint "sys.executable:", sys.executable$ bb-freeze hello-world.py*** applied $ dist/hello-worldhello world!...$ dist/pyPython 2.5.1c1 (r251c1:54692, Apr 11 2007, 01:40:50) on linux2Type "help", "copyright", "credits" or "license" for more information.(MyConsole)>>> import email$bdist_bbfreeze - distutils commandbbfreeze 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 --helpUsage examples: # freeze all scripts into ./dist/-/ python setup.py bdist_bbfreeze # same, but use tagging for "daily build" or "snapshot" releases python setup.py egg_info --tag-build=dev bdist_bbfreezebbfreeze - APIThe 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 Freezerf = Freezer("hello-world-1.0", includes=("_strptime",))f.addScript("hello-world.py")f.addScript("hello-version.py")f() # starts the freezing processbbfreeze.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: * use_compression: flag whether to use compression inside the created zipfile (default True). * include_py: flag whether to create the included python interpreter py (default True) * addScript(path, gui_only=False): register a python script for freezing. path must be the path to a python script. The freezer will scan the file for dependencies and will create an executable with the same name in distdir. The gui_only flag only has a meaning on windows: If set, the executable created for this script will not open a console window.RecipesRecipes 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.Linux NotesThe 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. Requirements: · Python Limitations: · documentation is a bit sparse What's New in This Release: · workaround console.exe not being executable. · switch to ez_setup.py from setuptools-0.6c11. · make win32com work by using a temporary directory as it's __gen_path__.


bbfreeze Related Software