Skip to main content

PyQt Distutils

A set of distutils extension to work with PyQt applications and UI files.

The goal of this tiny library is to help you write PyQt application in a pythonic way, using setup.py to build the Qt designer Ui files.

This works with PyQt4, PyQt5 and PySide (tested with python3 only).

Usage

Add the following lines to your setup.py:

# import build_ui
try:
    from pyqt_distutils import build_ui
    cmdclass = {'build_ui': build_ui}
except ImportError:
    build_ui = None  # user won't have pyqt_distutils when deploying
    cmdclass = {}

...

setup(...,
      cmdclass=cmdclass)

To build the ui/qrc files, run:

python setup.py build_ui

UI Files

The compilation of ui files is driven by a pyuic.cfg file, which is a plain json file with the following format:

{
    "files": [
        [
            "forms/main_window.ui",
            "package/forms"
        ]
    ],
    "pyrcc": "pyrcc5",
    "pyrcc_options": "",
    "pyuic": "pyuic5",
    "pyuic_options": "--from-imports"
}

Here is a brief description of the fields:

  • files: list of file pairs made up of the source ui file and the destination package

  • pyrcc: the name of the pyrcc tool to use (e.g: ‘pyrcc4’ or ‘pyside-rcc’)

  • pyrcc_options: pyrcc options (optional)

  • pyuic: the name of the pyuic tool to use (e.g: ‘pyrcc4’ or ‘pyside-rcc’)

Command line tool

Starting from version 0.2, you can use the pyuicfg command line tool to manage your pyuic.cfg file:

# generate pyuic.cfg in the current directory, for use with PyQt4
pyuicfg -g

# generate pyuic.cfg in the current directory, for use with PyQt5
pyuicfg -g --pyqt5

# generate pyuic.cfg in the current directory, for use with PySide
pyuicfg -g --pyside

# add files
pyuicfg -a forms/main_window.ui foo_package/forms
pyuicfg -a resources/foo.qrc foo_package/forms

# remove file
pyuicfg -r resources/foo.qrc

Requirements

The following packages are required:

  • enum34 (python enums)

  • docopt

Install

You can either install from pypi:

(sudo) pip install pyqt-distutils

Or from source:

pip install .

License

This project is licensed under the MIT license.

Changelog

0.2.1

  • fix missing install requirements (docopt and enum34).

0.2.0

  • add pyuicfg command line tool to administrate your pyuic.cfg file.

0.1.2

  • Improve readme

0.1.1

  • Fix description and examples when pyqt-distutils has not been installed.

0.1.0

  • Initial release

Metadata

Release files for pyqt-distutils 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyqt-distutils 0.2.1
File Size Uploaded Provenance Actions
pyqt-distutils-0.2.1.tar.gz 4.5 kB Without provenance Details for pyqt-distutils-0.2.1.tar.gz

Release files / pyqt-distutils-0.2.1.tar.gz

Download URL pyqt-distutils-0.2.1.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fa268a7bc174a3a1ad2f274139c36ae0cd0ab20c4ece7aa076dee17e88ebfef2
BLAKE2b-256 checksum
How to use checksums
7cd2d27cbf70e11c5c4d187016fa2db147d48aca83dde36a6c32d2f1193bf0b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pyqt-distutils 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page