magicgui
build GUIs from python types
What it is and what it does
Magicgui is a Python library that generates graphical user interfaces from function signatures and type annotations. Instead of writing widget layout code, you decorate a Python function with @magicgui and the library automatically creates form controls for each parameter based on its type. It uses qtpy to support both PyQt5 and PySide2 backends, meaning you choose which Qt implementation to install.
The library handles common types (int, float, str, bool, Enum) and generates appropriate widgets automatically. You can customize behavior with decorator arguments like call_button and result_widget. The generated GUI is interactive—users fill in parameters and click a button to execute the function, with results displayed in the interface. It's designed for scientists, researchers, and developers who want to quickly prototype interactive tools without learning Qt or GUI layout frameworks.
Use it for:
- Rapidly prototype scientific calculators or data analysis tools with minimal GUI code
- Build parameter-tuning interfaces for algorithms where inputs map directly to function arguments
- Create interactive demos of Python functions for presentations or educational materials
- Generate admin or configuration UIs from existing function signatures without rewriting logic
- Develop desktop tools for non-programmers by exposing Python functions as clickable forms
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Magicgui builds graphical user interfaces directly from Python function signatures and type annotations, with minimal boilerplate code.
Yes, if you need to build simple to moderate GUIs quickly and already have PyQt5 or PySide2 available. The decorator-based approach eliminates layout boilerplate for type-driven interfaces. Not suitable if you need complex custom layouts, advanced styling, or have no Qt backend installed. Active maintenance and no known vulnerabilities support adoption.
Install
magicgui on PyPI
pip
pip install magicguiuv
uv add magicguipoetry
poetry add magicguiInstalling magicgui
Before you install
Low install friction; pure Python wheel with five runtime dependencies. Actively maintained as of 2026-08-03 with recent releases. Requires either PyQt5 or PySide2 as a backend, which must be installed separately via extras or manually.
License in practice
MIT license permits commercial and private use with minimal restrictions; suitable for most projects without licensing concerns.
Quickstart
pip install magicgui[pyqt5]
from magicgui import magicgui
@magicgui(call_button="calculate")
def my_function(x: float = 1.0, y: int = 2) -> float:
return x * y
my_function.show()
PyQt5 or PySide2 must be installed separately; magicgui provides only the Qt abstraction layer via qtpy.
Verify before relying
- Whether the package works equally well with both PyQt5 and PySide2 backends or if one is preferred
- Performance characteristics when building complex multi-widget interfaces
- Extent of customization possible beyond the decorator's built-in options
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — docstring-parser, psygnal, qtpy, superqt, typing-extensions |
| Maintenance | actively maintained — 126 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 241,059/month — #8,889 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: magicgui-0.10.2-py3-none-any.whl
Keywords: gui, type annotations, widgets
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
superqtProvides additional Qt widgets and UI…
permissive · top 15,000 on PyPI
PySide2PySide2 provides Python bindings to the Qt…
copyleft · top 15,000 on PyPI
pyqtgraphPyQtGraph is a pure-Python graphics library for…
permissive · top 5,000 on PyPI
PyQt5PyQt5 provides Python bindings for the Qt v5…
copyleft · top 5,000 on PyPI
QtPyQtPy provides a unified API for writing Qt…
permissive · top 5,000 on PyPI
customtkinterCustomTkinter wraps Python's Tkinter to provide…
permissive · top 5,000 on PyPI
PySide6PySide6 provides Python bindings to the Qt 6.0+…
copyleft · top 5,000 on PyPI
PyQt5-Qt5Provides the Qt5 runtime libraries required by…
copyleft · top 5,000 on PyPI
PySide6-EssentialsPySide6 Essentials provides Python bindings to…
copyleft · top 5,000 on PyPI
phoebusgenGenerates Phoebus Display Builder XML format…
copyleft · top 15,000 on PyPI