skillfed

QtPy

Provides an abstraction layer on top of the various Qt bindings (PyQt5/6 and PySide2/6).

qtpy v2.4.3 4.4M downloads/30d#2,309 on PyPI1,101
Permissive license MIT Active released

What it is and what it does

QtPy is a thin abstraction layer that lets you write Qt applications using a single, unified API that works with any of the four major Qt Python bindings: PyQt5, PySide2, PyQt6, or PySide6. Instead of importing directly from a specific binding, you import from qtpy, and the library transparently routes your calls to whichever binding is installed and selected via the QT_API environment variable (defaulting to PyQt5 if multiple are present).

The main value is in reducing friction when porting code between bindings or upgrading Qt versions. When you need to switch from PyQt5 to PyQt6, or migrate from PyQt to PySide, you can do so module by module without rewriting your entire codebase. QtPy handles known incompatibilities—such as exposing PyQt's pyqtSignal, pyqtSlot, and pyqtProperty as Signal, Slot, and Property, and handling PyQt6's unscoped enums—so your code stays portable across all four bindings.

Use it for:

  • Develop a desktop application that can run on either PyQt5 or PySide6 without code duplication.
  • Gradually migrate an existing PyQt5 codebase to PyQt6 by updating imports to use QtPy first.
  • Support multiple Qt bindings in a library so users can choose their preferred binding.
  • Write tests that run against multiple Qt bindings to ensure compatibility.
  • Simplify CI/CD by testing a single codebase against PyQt5, PySide2, PyQt6, and PySide6.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

QtPy provides a unified API for writing Qt applications that work across PyQt5, PySide2, PyQt6, and PySide6 without code changes.

Yes, if you are building or maintaining a Qt application and want flexibility in which binding you use or plan to migrate between bindings. The low install friction and active maintenance make it a safe dependency. Not necessary if you are locked into a single binding and have no plans to switch.

Install

qtpy on PyPI

pip

pip install qtpy

uv

uv add qtpy

poetry

poetry add qtpy

Installing QtPy

Before you install

Low friction install with a single runtime dependency (packaging). Active maintenance with recent releases and a stable codebase.

License in practice

MIT license is permissive; you can use QtPy in commercial and proprietary projects with minimal restrictions.

Quickstart

pip install qtpy

import qtpy

# Select binding via QT_API environment variable (pyqt5, pyside2, pyqt6, pyside6)
# QtPy routes calls to the selected binding transparently

Requires PyQt5, PySide2, PyQt6, or PySide6 to be installed separately; QtPy is only the abstraction layer.

Verify before relying

  • Whether the package handles all edge cases between Qt5 and Qt6 enum differences automatically.
  • Performance overhead of the abstraction layer compared to direct binding use.
  • Completeness of compatibility wrappers for less common Qt modules and classes.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies 1 — packaging
Maintenance actively maintained — 549 days since the last release
Last repo commit
First released
Downloads 4,422,359/month — #2,309 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: QtPy-2.4.3-py3-none-any.whl

Keywords: qt, PyQt5, PyQt6, PySide2, PySide6

Development Status :: 5 - Production/StableEnvironment :: MacOS XEnvironment :: Win32 (MS Windows)Environment :: X11 Applications :: QtIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: LibrariesTopic :: Software Development :: User InterfacesTopic :: Software Development :: Widget Sets

Tags

qt abstraction layerpyqt pyside compatibilitycross-qt binding wrapperunified qt apiqt5 qt6 compatibilitypyqt6 pyside6 adapterqt binding abstraction
qt-abstractioncross-platform-uibinding-compatibility

More Libraries packages