Skip to content


app-model is a declarative, backend-agnostic schema for a GUI-based application.

The primary goal of this library is to provide a set of types that enable an application developer to declare the commands, keybindings, macros, etc. that make up their application.


Install from pip

pip install app-model

Or from conda-forge

conda install -c conda-forge app-model


See the Getting Started guide for a quick introduction to app-model. See the API Reference for a complete reference of the types and functions provided by app-model.


Why bother with a declarative application model?

  1. It's easier to query the application's state

    If you want to ask "what commands are available in this application?", or "what items are currently in a given menu", you can directly query the application registries. For example, you don't need to find a specific QMenu instance and iterate its actions() to know whether a given item is present.

  2. It's easier to modify the application's state

    For applications that need to be dynamic (e.g. adding and removing menu items and actions as plugins are loaded and unloaded), it is convenient to have an application model that emits events when modified, with the "view" (the actual GUI framework) responding to those events to update the actual presentation.

  3. It decouples the structure of the application from the GUI framework

    This makes it easier to change the GUI framework without having to change the application. (Obviously, as an application grows with a particular framework, it does become harder to extract, but having a loosely coupled model is a step in the right direction)

  4. It's easier to test

    app-model itself is comprehensively tested. By avoiding a number of one-off procedurally created menus, we can test reusable patterns of command/menu/keybinding creation and registration.

GUI Frameworks#

app-model is framework-agnostic, and can be used with any GUI toolkit, but Qt is currently the primary target, and a Qt adapter comes with this library.

See some details in the qt section of the getting started guide.

Example Application#

For a working example of a QApplication built with and without app-model, compare demo/ to demo/ in the demo directory of the app-model repository.