I wanted to make a post to compile some resources for creating Python apps in PortableApps.com Format for interested developers. Currently, we have two apps released in our app store using the PortableApps.com Launcher that are Python-based: gPodder Portable and Solfege Portable. We also have GIMP Portable which utilizes Python for some functionality and Gramps Portable which uses an old-style custom NSIS launcher, but they're outside the scope of what we're discussing here. All of these apps bundle a full Python runtime within them to operate. Solfege Portable instantiates the Python runtime pythonw.exe directly to work while gPodder Portable runs the gPodder.exe launcher to instantiate the bundled Python. Other than this minor difference, the apps themselves aren't much different than any other app we have. gPodder Portable uses environment variables set by its launcher to direct gPodder to store data within the contained Data directory while Solfege Portable relies on its launcher to move directories to and from the local machine's Documents and APPDATA folders for portability.
The relevant beginning of gPodder Portable's launcher INI file is as follows:
[Launch] ProgramExecutable=gPodder\gPodder.exe WorkingDirectory=%PAL:AppDir%\gPodder DirectoryMoveOK=yes SupportsUNC=yes [Environment] PATH=%PAL:AppDir%\Python\PyDLL;%PAL:AppDir%\Python;%PAL:AppDir%\Python\Lib;%PAL:AppDir%\Python\DLLs;%PAL:AppDir%\Python\Lib\lib-tk;%PAL:AppDir%\gPodder\src;%PAL:AppDir\gPodder ;PATH=%PAL:AppDir%\Python\PyDLL LANG=%PAL:LanguageCustom% GPODDER_DOWNLOAD_DIR=%PAL:DataDir%\config\Downloads GPODDER_HOME=%PAL:DataDir%\config PYTHONHOME=%PAL:AppDir%\Python PYTHONPATH=%PAL:AppDir%\Python\Lib;%PAL:AppDir%\Python\DLLs;%PAL:AppDir%\Python\Lib\lib-tk
For completeness, when we used to launch pythonw directly in gPodder Portable, the first two lines were:
ProgramExecutable=Python\pythonw.exe CommandLineArguments="-m gpodder"
The relevant beginning of Solfege Portable's launcher INI file is as follows:
[Launch] ProgramExecutable=Solfege\bin\pythonwSolfegePortable.exe CommandLineArguments='"%PAL:AppDir%\Solfege\bin\win32-start-solfege.pyw" --no-splash' WorkingDirectory=%PAL:AppDir%\Solfege\bin DirectoryMoveOK=yes SupportsUNC=yes [Environment] PYTHONPATH=%PAL:AppDir%\Solfege\bin PYTHONHOME=%PAL:AppDir%\Solfege\bin HOME=%PAL:DataDir% [DirectoriesMove] SolfegeSettings=%APPDATA%\GNU Solfege SolfegeDocuments=%DOCUMENTS%\GNU Solfege
Both apps are available for download for interested developers to use as a starting point for their own Python-based apps they'd like to package in PortableApps.com Format.
I'm looking to make the Windows Python runtimes available as a CommonFiles plugin in the near future as well. This will be similar to how we currently release Ghostscript, GPG, Java, and JDK. We'll make both Python2 and Python3 available and let the apps specify which they need to platform.