Skip to main content

PyInstaller setuptools integration

Project description

Codacy Badge build status Codecov

What is Subzero?

The goal of subzero is to allow simple and rapid deployment of frozen Python applications with minimal additional effort and developer time. In contrast to other solutions, subzero’s philosophy is that having a working application, quickly is more important than optimizing for size or other factors and that generating your end product (be it an MSI, or other installer) should take only a few minutes to set up. Subzero builds on the extensive development work of other projects, and doesn’t re-invent the wheel. Rather, it ties everything together in a simple and intuitive manner.

How do I use it?

In your setup file, replace the default setup import with the followng:

from subzero import setup, Executable

Then run the following command:

python setup.py bdist_msi

Subzero will the build executables specified in the entry_points and scripts sections and then create an installer that contains those executables.

Example

setup(
    name='Name',
    author='Author',
    packages=find_packages(),
    version=versioneer.get_version(),
    cmdclass=versioneer.get_cmdclass(),
    install_requires=[
        'paramiko',
    ],
    entry_points={
        'gui_scripts': [
            Executable(
                    'gui = app.__main__:gui',
                    icon_file='Icon.ico'),
        ],
        'console_scripts': [
            'console = app.__main__:console',
        ],
    },
    options={
        'build_exe': {
            'pathex':
            [os.path.join(os.path.dirname(PyQt5.__file__), 'Qt', 'bin')],
            'datas':
            [datafile, '.')],
        },
        'bdist_msi': {
            'upgrade_code': '84b31ed7-3985-46ad-9d07-eb4140a6d44a',
            'shortcuts': ['My Program = gui'],
        }
    })

Options are applied first globally from the options dictionary passed to setup, and then for each executable if the Executable class is present for that particular entry_point or script.

The full array of options for build_exe is available in the PyInstaller documentation. Providing an upgrade code is strongly recommended for the bdist_msi command. A license agreement will be added to the installer if there is a license text file in the same directory as setup.py.

Extended import discovery (In beta)

In case PyInstaller cannot discover all of your dependencies, you can set optimize_imports=False, as shown below. This option may discover certain imports previously not found but it may also make your application larger. Note that you must add your package requirements in install_requires for this option to work!

'build_exe': {
    'optimize_imports': False
},

Cython

Cython modules can also be built because Subzero executes the builtin build command before calling PyInstaller. Just add your modules to the ext_modules key:

from setuptools import find_packages, Extension
from subzero import setup

setup(
    name='hello_world',
    ext_modules=[
        Extension(
            'my_module',
            sources=['my_module.pyx'],
        )
    ])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

subzero-0.2.3.3.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

subzero-0.2.3.3-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file subzero-0.2.3.3.tar.gz.

File metadata

  • Download URL: subzero-0.2.3.3.tar.gz
  • Upload date:
  • Size: 27.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for subzero-0.2.3.3.tar.gz
Algorithm Hash digest
SHA256 2f7b70c9f59f56a6106098a33f2a9951293b0d089cd3caced259a4f3321bc37c
MD5 445222854cfda6e6e8fb55f47879b420
BLAKE2b-256 76235c45a18af9d8594e170c07377dd2d562e1fe1c505241b185e2a17fc9dfdc

See more details on using hashes here.

File details

Details for the file subzero-0.2.3.3-py3-none-any.whl.

File metadata

File hashes

Hashes for subzero-0.2.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6aba27501e5a3355d1bbb5452b9a2ded05e5edbfaf51322b075c7b8da73d3c98
MD5 f324b4530a9f69532f38b22ad91465da
BLAKE2b-256 1f239e006faf2f1cfdf8987d5e9cadd176eb06ce8303c893315152b513b35016

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page