Package: gravitybee
GravityBee helps you generate standalone applications for Windows,
Mac, and Linux from your Python applications.GravityBee is targeted at Python
programs that are already packaged in the standard setuptools
way.These are some benefits of a GravityBee standalone application:You end up with one file that contains everything.Your users do not need Python or any packages installed.You build separate natively executable applications for each of
your target platforms.GravityBee depends onPyppynandPyInstallerand is subject to their limitations.To Build A Standalone ApplicationStep 1 - InstallYou must install the application you wish to build (e.g.,yoursuperapp), as well as GravityBee.$pipinstallyoursuperappgravitybeeThe process will also work fine if you’re installing from a local
version of your app.$cdyoursuperapp$lssetup*setup.cfgsetup.py$pipinstall--editable.$pipinstallgravitybeeStep 2 - Provide (or gather) informationGravityBee will assume all necessary information when run. However,
you may wish to override the assumed
values. You can provide values either through environment variables
or command line flags. If both are
provided, command line flags take precedence.Local logging can be configured ingravitybee/logging.conf.Options:ENV VARCL OptionsDesciptionGB_APP_NAME–app-name, -aThe name that will appear as part of the
final standalone application name.Default:namefrom setup.py and/or
setup.cfg.GB_PKG_NAME–pkg-name, -nThe package name for the application you are
building.Default: First value inpackagesfrom
setup.py and/or setup.cfg,
or if not found, the value from –app-name.GB_SCRIPT–script, -sThe path to the application file installed bypipwhen you installed
your application. Depending on your
configuration, this may be determined byoptions.entry_points.console_scriptsfromsetup.pyand/orsetup.cfg.Default:$VIRTUAL_ENV/bin/app_nameGB_SRC_DIR–src-dir, -dThe relative path of the package containing
your application.Default:.GB_PKG_DIR–pkg-dir, -pThe relative or absolute path of the package
containing your application.
This directory must contain asetup.pyfile.Default:.GB_EXTRA_DATA–extra-data, -eRelative to package directory, any extra
directories or files that need
to be included, that wouldn’t normally
be included as Python code. Can be
used multiple times.Default: NoneGB_WORK_DIR–work-dir, -wDirectory for use by GravityBee to build
application. Cannot be an existing
directory as it will be deleted if the
clean voption is used.Default:.gravitybee/build/<uuid>GB_ONEDIR–onedirInstead of packaging into one file,
package in one directory. This option
is not compatible with producing a SHA
hash since a hash is produced on a
single file. This option may be useful
for debugging runtimes errors in built
applications.Default: NotGB_CLEAN–clean, -cFlag indicating whether to
clean up the work directory
after the build.Default: NotGB_NAME_FORMAT–name-format, -fFormat to be used in naming the standalone
application. Can include
{an}, {v}, {os}, {m}
for app name, version, os, and machine
type respectively. On Windows,.exewill be added automatidally.Default:{an}-{v}-standalone-{os}-{m}GB_SHA_FORMAT–sha-formatFormat to be used in naming the SHA hash
file. Can include
{an}, {v}, {os}, {m}
for app name, version, os, and machine
type respectively.Default:{an}-{v}-sha256-{os}-{m}.jsonGB_LABEL_FORMAT–label-formatFormat to be used in labeling the standalone
application ingravitybee-files.json.
Can include {An},
{an}, {v}, {os}, {m}, and {ft}
for capitalized application
name, lowercase app name, version, OS,
machine, and file type (“Standalone
Executable” or
“Standalone Executable SHA256 Hash”)
respectively. On Windows,.exewill be added automatically.Default:{An} {v} {ft} for {os} [GravityBee Build]GB_NO_FILE–no-fileFlag indicating to not write
the output files (see below).
If the--shaoption is used to
write a hash to a file, that file will
still be written regardless.Default: Will write filesGB_SHA–shaOption of where to put SHA256
hash for generated file.
Valid options arefile(create a separate file with
hash), orinfo(only
include the hash in the file
info output).Default:infoGB_STAGING_DIR–staging-dirOption to indicate where GravityBee
should stage build artifacts
(standalone executable and hash
file). Two subdirectories can
be created, one based on version
and the other called “latest.”Default:.gravitybee/distGB_WITH_LATEST–with-latestFlag to indicate if GravityBee
should create a “latest”
directory in the staging area
with a copy of the artifacts.Default: NotGB_INCLUDE_SETUP_EXTRAS–include-setup-extrasIncludes any ‘extras’ modules listed in
setup.py/cfg standalone application. (Such as
packages marked ‘build’, ‘docs’, ‘check’, etc.)Default: FalseGB_EXTRA_MODULES–extra-modulesAny extra modules to be included with
the standalone executable.Default: NoneGB_EXTRA_PKGS–extra-pkgsAny extra packages to be included with
the standalone executable.Default: NoneVIRTUAL_ENVIf using conda env set VIRTUAL_ENV to
conda env directoryIf you are using environment variables, you could set them up like
this.$exportGB_APP_NAME=coolapp$exportGB_PKG_NAME=coolapp$exportGB_SCRIPT=/usr/var/python/etc/coolappStep 3 - GenerateCreating the standalone application is easy now.$gravitybeeIf you are not using environment variables, you can combine steps 2 and 3.$gravitybee--app-namecoolapp--script/usr/var/python/etc/coolapp--pkg-dircoolappOutput FilesIf the--no-fileflag is not used, GravityBee will create output
files. These include:gravitybee-files.json: A JSON file that contains information
about the standalone application generated by GravityBee includingfilename,path,mime-type, andlabelas a list of
dicts.gravitybee-info.json: A JSON file that contains information
extracted
about the application includingapp_name,app_version,console_script,script_path,pkg_dir,src_dir,name_format,clean,work_dir,gen_file,gen_file_w_path, andextra_data.gravitybee-environs.sh: A shell file that can be sourced on
POSIX platforms
to create environment variables with GravityBee information. Each
is prefixed
withGB_ENV_.gravitybee-environs.bat: A batch file that can be used to
create environment variables with GravityBee information on
Windows. Each
environ is prefixed withGB_ENV_.The Test ExampleHere is the file/package structure of the includedtest application.gbtestapp|--setup.py|--setup.cfg>--src|>--gbtestapp||--__init__.py||--cli.py|>--gbextradata||--__init__.py||--data_file.txtYou would build the application as follows. Since the application
package is under thesrcdirectory, you need to let GravityBee
know. Also, since we need to include thedata_file.txtfile,
we’ll use the--extradataoption to include the containing
directory (gbextradata).$cdgbtestapp$gravitybee--src-dirsrc--extra-datagbextradata--cleanFrom Python ExampleUsing GravityBee from a Python script is also possible. Using the
sample test app, here’s some example code.importgravitybeeargs=gravitybee.Arguments(src_dir="src",extra_data=["gbextradata"],pkg_dir=os.path.join("tests","gbtestapp"),clean=True)pg=gravitybee.PackageGenerator(args)pg.generate()# show path (and name) of standalone appprint("The standalone app: ",pg.gen_file_w_path)AttributionThe idea for GravityBee’s core functionality comes fromNicholas Chammasand his projectflintrock. Huge thanks to Nicholas!ContributeGravityBee is hosted onGitHuband is an open source project that welcomes contributions of all kinds from the community.For more information about contributing, seethe contributor guidelines.CHANGE LOG0.3.0 - 2022.04.21[DEPRECATION] Deprecates Python 3.6 support.0.2.0 - 2021.08.02[FEATURE] Add option –hook-template that allows user to specify their own hook
template for PyInstaller.[FIX] Update the included hook-template to work correctly when the pkg_name and
app_name are different.0.1.29 - 2020.01.15[ENHANCEMENT] Remove pipenv files and update setup.cfg dependency versions.0.1.28 - 2020.01.14[ENHANCEMENT] Bump version to include updated dependencies.0.1.27 - 2019.05.06[ENHANCEMENT] Bump version to include updated dependencies.0.1.26 - 2019.02.05[ENHANCEMENT] Fix distutils issue, improve error handling, update versions.0.1.25 - 2019.01.31[ENHANCEMENT] Add distutils to builds.0.1.24 - 2019.01.29[ENHANCEMENT] Clean up code, add community docs.[ENHANCEMENT] Transfer to Plus3IT.0.1.23 - 2019.01.24[FIX] Properly pin Pip so all dependencies are installed with pinned
Pip version.[ENHANCEMENT] Restructure Travis CI linting, testing, deploying so
deploy only happens when other stages complete successfully.[ENHANCEMENT] Improve speed of MacOS builds significantly.0.1.22 - 2019.01.22[ENHANCEMENT] Pin Pip and Pytest versions, addingrequirements.txt.0.1.21 - 2019.01.10[ENHANCEMENT] Lint code to conform with pylint and flake8 and add them
Travis-CI tests.[ENHANCEMENT] Usepipenvand a lock file for dependency management.[ENHANCEMENT] Adjust for compatibility with Python 3.7.0.1.20 - 2018.08.08[ENHANCEMENT] Add--label-formatoption so that users can customize
the label displayed for their applications ingravitybee-files.json.0.1.19 - 2018.07.11[ENHANCEMENT] Add--extra-pkgsand--extra-modulesoptions for
including additional packages and modules with standalone executables.0.1.18 - 2018.07.05[ENHANCEMENT] Add--onedirflag for improved debugging.0.1.17 - 2018.06.27[FIX] Compatibility issues with CentOS 6 resolved.0.1.16 - 2018.06.21[FIX] Compatibility issues with Windows resolved.0.1.15 - 2018.06.06[FIX] Losing.exeextension with Windows executables in the
latest staging area.0.1.14 - 2018.06.04[FIX]--with-latestwas not working as a CL flag.0.1.13 - 2018.06.04[ENHANCEMENT] Rearrange files created by GravityBee to all be
contained in a.gravitybeesubdirectory of the current
directory.[ENHANCEMENT] Place the distribution artifacts in the staging
directory, with a default value of.gravitybee/dist.[ENHANCEMENT] Add option--staging-dirto specify directory
where artifact staging should take place and export another
environment variableGB_ENV_STAGING_DIR.[ENHANCEMENT] Add option--with-latestto allow creation of
a second artifact staging directory called “latest” containing
the artifacts renamed with “latest” in the place of the version.[ENHANCEMENT] Add option--sha-formatto allow custom naming
of the SHA hash file.0.1.12 - 2018.05.29[ENHANCEMENT] Add OS and machine type to the SHA256 hash file (to
avoid overwriting files if files from different platforms go to the
same location).[ENHANCEMENT] Cleanup code with better variable names.0.1.11 - 2018.05.24[ENHANCEMENT] Create a SHA256 hash for the generated standalone
file and include hash with file information and optionally in
a separate file (using –sha flag).[ENHANCEMENT] Change names of environment variables produced
with output scripts to be prefixed with GB_ENV so that the
environs do not collide with environs consumed by GravityBee.[ENHANCEMENT] Provide a convenience cleanup Bash script to
remove GravityBee output files (e.g., json and generated
executables).[ENHANCEMENT] Cleanup code with more constants.0.1.10 - 2018.05.21[ENHANCEMENT] Provide two additional output files for importing
GravityBee information into the environment on POSIX and Windows
platforms.0.1.9 - 2018.05.14[ENHANCEMENT] Output file with run info in json format for easy
consumption by other tools.0.1.8 - 2018.05.11[ENHANCEMENT] In non-verbose mode, allow for supressing stdout and
stderr from pyinstaller, which can be sizeable.[ENHANCEMENT] Change name ofgravitybee.filetogravitybee-files.json.0.1.7 - 2018.05.11[FIX] Fix exit code (was returning True).[ENHANCEMENT] Automatically find console script installed by
setuptools on Windows and Linux and variety of places.0.1.6 - 2018.05.03[ENHANCEMENT] Follow format prescribed by satsuki for output
file (potential for multiple files).0.1.5 - 2018.05.01[ENHANCEMENT] Add mime-type and label to .json formatted file
information stored in gravitybee.file.0.1.3 - 2018.05.01[ENHANCEMENT] Create gravitybee.file with name of standalone
application.0.1.2 - 2018.04.27[ENHANCEMENT] Provide standalone file and path.[FIX] Path bug.0.1.1 - 2018.04.26[FIX] Many bug fixes.0.1.0 - 2018.04.20Initial release!