Skip to main content

Edifice
Declarative GUI framework for Python and Qt

Edifice is a Python library declarative framework for application user interfaces.

  • Modern declarative UI paradigm from web development.
  • 100% Python application development, no language inter-op.
  • A native Qt desktop app instead of a bundled web browser.
  • Fast iteration via hot-reloading.

Edifice uses PySide6 or PyQt6 as a backend. Edifice is like React, but with Python instead of JavaScript, and Qt Widgets instead of the HTML DOM.

If you have React experience, you’ll find Edifice easy to learn. Edifice has function Components, Props, and Hooks just like React.

Getting Started

Why Edifice?

Declarative

Most existing GUI libraries in Python, such as Tkinter and Qt, operate imperatively. To create a dynamic application using these libraries, you must not only think about what widgets to display to the user, but also how to issue the commands to modify the widgets.

With Edifice the developer need only declare what is rendered, not how the content is rendered.

User interactions update the application state, the state renders to a widget tree, and Edifice modifies the existing widget tree to reflect the new state.

Edifice code looks like this:

    number, set_number = use_state(0)

    with VBoxView():
        Button(title="Add 5", on_click=lambda event: set_number(number+5))
        Label(text=str(number))
        if number > 30 and number < 70:
            Label(
              text="Number is mid",
              style={"color": "green"},
            )

The GUI displays a button and a label with the current value of number. Clicking the button will add 5 to the number. If the number is “mid” then another label will reveal that fact.

Edifice vs. Qt Quick

Qt Quick is Qt’s declarative GUI framework for Qt.

Qt Quick programs are written in Python + the special QML language + JavaScript.

Edifice programs are written in Python.

Because Edifice programs are only Python, binding to the UI is much more straightforward. Edifice makes it easy to dynamically create, mutate, shuffle, and destroy sections of the UI with Python control flow statements if for match. Qt Quick assumes a much more static interface.

Qt Quick is like DOM + HTML + JavaScript. Edifice is like React. QML and HTML are both declarative UI languages but they require imperative logic in another language for dynamism. Edifice and React allow fully dynamic applications to be specified declaratively in one language.

How it works

An Edifice component is a render function which declares a mapping from props and state to UI widgets. props are passed as arguments to the component when it renders. state is the component’s own internal state.

Changes to props or state will trigger a re-render of the component. The old and new component trees will be compared to one another, and a diffing algorithm (similar to the React diffing algorithm) will determine which UI widgets must be added, removed or modified. Then Edifice will issue the minimal commands to update the UI.

MANUFACIA-Vision_capture1

Development Tools

Dynamic hot-reload

Dyanamic hot-reload is very useful for fine-tuning the presentation styles of Elements deep within your application. You can test if the margin should be 10px or 15px instantly without closing the app, reopening it, and waiting for everything to load.

Element Inspector

Similar to the Inspect Elements tool of a browser, the Element Inspector will show you the tree of Elements in a running Edifice application, along with all of the props and state of the Elements.

License

Edifice is MIT Licensed.

Edifice uses Qt under the hood, and both PyQt6 and PySide6 are supported. Note that PyQt6 is distributed with the GPL license while PySide6 is distributed under the more flexible LGPL license.

See PyQt vs PySide Licensing.

Can I use PySide for commercial applications?

Yes, and you don't need to release your source code to customers. The LGPL only requires you to release any changes you make to PySide itself.

Version History / Change Log / Release Notes

See Release Notes (source: versions.rst)

Contribution

Contributions are welcome; please send Pull Requests! See DEVELOPMENT.md for development notes.

When submitting a Pull Request, think about adding tests to tests and adding a line to the Unreleased section of the change log versions.rst.

Setuptools Build System

The Setuptools pyproject.toml specifies the package dependecies.

Because Edifice supports PySide6 and PyQt6 at the same time, neither are required by dependencies. A project which depends on Edifice should also depend on either PySide6-Essentials or PySide6 or PyQt6.

Add an Edifice dependency to pyproject.toml:

dependencies = [
  "pyedifice",
  "PySide6-Essentials",
]

There are optional dependency groups provided for PySide6-Essentials and PyQt6:

dependencies = [
  "pyedifice [PySide6-Essentials]"
]

The requirements.txt is generated by

uv export --format requirements-txt --no-dev > requirements.txt

Release files for pyedifice 5.0.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 pyedifice 5.0.1
File Size Uploaded
pyedifice-5.0.1.tar.gz 399.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyedifice 5.0.1
File Interpreter ABI Platform
pyedifice-5.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 1.3 MB

Release files / pyedifice-5.0.1.tar.gz

Download URL pyedifice-5.0.1.tar.gz
Size 399.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5f73ddae9635a35183f342129b130c23d788b069610cc6a60a00716219151d70
BLAKE2b-256 checksum
How to use checksums
fda4dfa29f534b193820608fbf9eebf0882a32e4e4c92b7916dc1e7b140fabb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.13

Release files / pyedifice-5.0.1-py3-none-any.whl

Download URL pyedifice-5.0.1-py3-none-any.whl
Size 855.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
628c752f0cd78eea701217d3c4fc727a7eff4fb632b647f270084a47a7865948
BLAKE2b-256 checksum
How to use checksums
8b70be8babe92ad611ebc862d2b1c435cc75b471477d8cb3d9c6ec356f4e6029
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.13

Release history Release notifications | RSS feed

This release

5.0.1 This release

2 release files

5.0.0

2 release files

4.4.1

2 release files

4.4.0

2 release files

4.3.0

2 release files

4.2.0

2 release files

4.1.0

2 release files

4.0.1

2 release files

4.0.0

2 release files

3.2.3

2 release files

3.2.2

2 release files

3.2.1

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.13.0

2 release files

2.12.0

2 release files

2.11.4

2 release files

2.11.3

2 release files

2.11.2

2 release files

2.11.1

2 release files

2.11.0

2 release files

2.9.1

2 release files

2.9.0

2 release files

2.8.1

2 release files

2.8.0

2 release files

2.7.1

2 release files

2.7.0

2 release files

2.6.1

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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