Skip to main content

Compile Qt resource files, UI files and translations in setup.py

Project description

Compile Qt resource files, UI files and translations in setup.py

Can be used with PyQt4, PyQt5, PySide and PySide2. Usage of Qt bindings wrappers like Qt.py or QtPy is also supported.

Requirements

Example

setup.py:

from setuptools import setup
from setup_qt import build_qt

setup(
    name='example',
    version='1.0.0',
    description='setup_qt example',
    author='Monty Python',
    author_email='monty.python@example.com',
    url='https://www.example.com',
    license='MIT',
    packages=['example'],
    package_data={
        'example': [
            '*.ui',
            '*.qrc',
            'languages/*.ts',
            'languages/*.qm',
        ],
    },
    entry_points={
        'gui_scripts': [
            'example=example.__main__:main',
        ],
    },
    install_requires=[
        'PyQt5',
        'Qt.py',
    ],
    options=[
        'build_qt': {
            'packages': ['example'],
            'languages': ['cs'],           # optional
            'languages_dir': 'languages',  # optional ('languages' is default)
            'bindings': 'PyQt5',           # optional ('PyQt5' is default)
            'replacement_bindings': 'Qt',  # optional (for Qt.py wrapper usage)
        },
    ],
    cmdclass={
        'build_qt': build_qt,
    },
)

Usage:

[user@host ~]$ python setup.py build_qt
running build_qt
compiling example Qt resource files...
compiling example Qt UI files...
updating example Qt translation files...
compiling example Qt translation files...

Help

Options for 'build_qt' command:
  --packages              List of comma separated packages in which to
                          recursively find .qrc, .ui and .ts files
  --languages             List of comma separated translation languages (could
                          be empty)
  --languages-dir         Directory with translation files (could be empty,
                          default is "languages")
  --bindings              Qt binding from which to use pyrcc, pyuic and
                          pylupdate commands (default is PyQt5)
  --replacement-bindings  Qt bindings replacement (e.g. if using wrapper like
                          Qt.py or QtPy)
  --pyrcc                 pyrcc command executable
  --pyuic                 pyuic command executable
  --pylupdate             pylupdate command executable
  --lrelease              lrelease command executable
  --filename-qrc          name template for .py files compiled from .qrc files
  --filename-ui           name template for .py files compiled from .ui files
  --filename-ts           name template for newly created .ts files

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

setup_qt-1.0.0.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file setup_qt-1.0.0.tar.gz.

File metadata

  • Download URL: setup_qt-1.0.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for setup_qt-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cdc8d54d72c3024a30bfda2b4ed792e53be11640db77e6f1b0512a8626fcbe6c
MD5 830dde36c120fe36f7a9fdfd4c8ce7e3
BLAKE2b-256 dd13856f21bb1a768f2a8befcae749fb499ba41b217e59e75a4a59aa31243151

See more details on using hashes here.

Supported by

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