PYPI PACKAGE AUDIT v1.19.1b1 Enterprise Healthy

slint

Native GUI toolkit for Python: build desktop and embedded apps with a declarative UI language and live preview

PyPkgScore slint
Methodology & Criteria ♥ Donate
870 / 1000
Quick Install
pip install slint
1. Governance
150/200
2. PEP Metadata
200/200
3. Security
200/200
4. Docs & SEO
155/200
5. CI Engineering
165/200
📣 Share Audit: Share this report and visual preview in the current language
Advertisement
PYPI TELEMETRY

Downloads & Community Adoption

Last 30 days (without mirrors)
Last 7 days
872
Last 30 days
3790
Total (180 days)
13807
Metric / Ecosystem Status / Value Source
Downloads (30d / 180d) — PyPI Stats (without mirrors)
Trusted Publishing (PEP 740) ✓ Verified OIDC PyPI Integrity / Sigstore
Django Packages — djangopackages.org
PyTech / PyPkgScore 870 / 1000 PyPkgScore Engine

Health & Engineering Analysis (5 Pillars)

1. Governance & Community150 / 200 ▾
LICENSE✓ 50 pts
SECURITY.md✓ 50 pts
CONTRIBUTING.md✓ 50 pts
CODE_OF_CONDUCT.md✕ 0 pts
2. PEP Metadata & Packaging200 / 200 ▾
Wheel (.whl)✓ 50 pts
pyproject.toml✓ 50 pts
Project URLs✓ 50 pts
Trove Classifiers✓ 50 pts
3. Security & Supply Chain200 / 200 ▾
Zero CVEs (OSV)✓ 60 pts
Trusted Publishing (OIDC)✓ 50 pts
Snyk / Audit Link✓ 40 pts
HTTPS Repository✓ 50 pts
4. Documentation, SEO & Ecosystem155 / 200 ▾
Structured README✓ 60 pts
Read the Docs✓ 50 pts
Django Packages✕ 0 pts
Website / Technical Articles✓ 45 pts
5. Engineering, CI & Quality165 / 200 ▾
Automated Tests✓ 65 pts
GitHub Actions CI✓ 65 pts
CHANGELOG.md✓ 35 pts
Env & Lockfile (uv/rye/poetry/pdm/hatch)✕ 0 pts
Advertisement
README & DOCS

Official Documentation & Usage Guide — slint

PyPI Metadata v1.19.1b1
Show full original documentation (English README) ▾

Slint-python (Beta)

Slint is a GUI toolkit to build native user interfaces for any device, with Python, Rust, C++, or JavaScript. Slint-python is the Python API for desktop and embedded Linux apps. Describe your UI in the .slint language and connect it to your Python code.

Warning Slint-python is in a beta phase of development: the APIs, while mostly stable, may be subject to further changes. Any changes will be documented in the ChangeLog.

You can track the progress of the Python integration in the python-labeled issues.

Slint Language Manual

The Slint Language Documentation covers the Slint UI description language in detail.

Prerequisites

Installation

Install Slint with uv or pip from the Python Package Index:

uv add slint

The installation uses binaries provided for macOS, Windows, and Linux for various architectures. If your target platform isn't covered by binaries, uv automatically builds Slint from source. In that case, you need some software development tools on your machine, as well as Rust.

Quick Start

  1. Create a new project with uv init.
  2. Add the Slint Python package to your Python project: uv add slint
  3. Create a file called app-window.slint:
import { Button, VerticalBox } from "std-widgets.slint";

export component AppWindow inherits Window {
    in-out property<int> counter: 42;
    callback request-increase-value();
    VerticalBox {
        Text {
            text: "Counter: \{root.counter}";
        }
        Button {
            text: "Increase value";
            clicked => {
                root.request-increase-value();
            }
        }
    }
}
  1. Create a file called main.py:
import slint


# slint.loader looks in `sys.path` for `app-window.slint`.
class App(slint.loader.app_window.AppWindow):
    @slint.callback
    def request_increase_value(self):
        self.counter = self.counter + 1


app = App()
app.run()
  1. Run it with uv run main.py.

API Overview

Instantiating a Component

The following example shows how to instantiate a Slint component in Python:

app.slint

export component MainWindow inherits Window {
    callback clicked <=> i-touch-area.clicked;

    in property <int> counter;

    width: 400px;
    height: 200px;

    i-touch-area := TouchArea {}
}

The exported component is exposed as a Python class. To access this class, you have two options:

  1. Call slint.load_file("app.slint"). The returned object is a namespace that provides the MainWindow class as well as any other explicitly exported component that inherits Window:

    import slint
    
    components = slint.load_file("app.slint")
    main_window = components.MainWindow()
    
  2. Use Slint's auto-loader, which lazily loads .slint files from sys.path:

    import slint
    
    # Look for `app.slint` in `sys.path`:
    main_window = slint.loader.app.MainWindow()
    

    slint.loader searches sys.path for any attribute you look up. If a directory with that name exists, the loader returns it as a loader object; subsequent attribute lookups follow the same logic.

    If the name matches a file with the .slint extension, the loader loads it with load_file and returns the namespace.

    If the file name contains a dash, like app-window.slint, an attribute lookup for app_window tries to locate app_window.slint and then falls back to app-window.slint.

    To load your project file (slint-project.json), look up slint_project in its directory. The loader passes the directory to load_file, which compiles your project's main file with the project's settings:

    # Look for `ui/slint-project.json` in `sys.path`:
    main_window = slint.loader.ui.slint_project.MainWindow()
    

    Note: Other .slint files in that directory load without the project file, so its include paths and library paths don't apply to them.

Accessing Properties

Properties declared as out or in-out in .slint files are visible as properties on the component instance.

main_window.counter = 42
print(main_window.counter)

Accessing Globals

You can access global singletons in Python as properties of the component instance.

For example, this Slint code declares a PrinterJobQueue singleton:

export global PrinterJobQueue {
    in-out property <int> job-count;
}

Access it as a property on the component instance by its name:

print("job count:", instance.PrinterJobQueue.job_count)

Note: Global singletons are instantiated once per component. When you export multiple components to Python, each instance has its own associated global singletons.

Setting and Invoking Callbacks

Callbacks declared in .slint files are visible as callable properties on the component instance. Call them as functions to invoke the callback, and assign a Python callable to set the callback handler.

In Slint, you define callbacks with the callback keyword and connect them to another component's callback with the <=> syntax.

my-component.slint

export component MyComponent inherits Window {
    callback clicked <=> i-touch-area.clicked;

    width: 400px;
    height: 200px;

    i-touch-area := TouchArea {}
}

The callbacks are exposed as properties that you can call as functions:

main.py

import slint

component = slint.loader.my_component.MyComponent()


# Connect to a callback.
def clicked():
    print("hello")


component.clicked = clicked
# Invoke a callback.
component.clicked()

Another way to set callbacks is to subclass the component and use the @slint.callback decorator:

import slint


class Component(slint.loader.my_component.MyComponent):
    @slint.callback
    def clicked(self):
        print("hello")


component = Component()

If the name of your method doesn't match the name of the callback in the .slint file, pass a name argument to the @slint.callback() decorator. Similarly, to bind a method to a callback in a global singleton, pass a global_name argument.

Type Mappings

Each type used for properties in the Slint language translates to a specific type in Python. See the type mappings table in the Slint Python documentation for the complete list.

Arrays and Models

You can set array properties from Python by passing subclasses of slint.Model.

Use the slint.ListModel class to construct a model from an iterable:

component.model = slint.ListModel([1, 2, 3])
component.model.append(4)
del component.model[0]

When sub-classing slint.Model, provide the following methods:

def row_count(self):
    """Return the number of rows in your model"""


def row_data(self, row):
    """Return data at specified row"""


def set_row_data(self, row, data):
    """For read-write models, store data in the given row. When done, call notify_row_changed."""
    ...
    self.notify_row_changed(row)

When adding or inserting rows, call notify_row_added(row, count) on the superclass. Similarly, when removing rows, notify Slint by calling notify_row_removed(row, count).

Structs

Structs that you declare and export in Slint are accessible in the namespace that's returned when instantiating a component.

app.slint

export struct MyData {
    name: string,
    age: int
}

export component MainWindow inherits Window {
    in-out property <MyData> data;
}

main.py

The exported MyData struct can be constructed as follows:

import slint

# Look for for `app.slint` in `sys.path`:
main_window = slint.loader.app.MainWindow()

data = slint.loader.app.MyData(name="Simon")
data.age = 10
main_window.data = data

Enums

Enums that you declare and export in Slint are accessible in the namespace that's returned when instantiating a component. The enums are subclasses of enum.Enum.

app.slint

export enum MyOption {
    Variant1,
    Variant2
}

export component MainWindow inherits Window {
    in-out property <MyOption> data;
}

main.py

Variants of the exported MyOption enum can be constructed as follows:

import slint

# Look for for `app.slint` in `sys.path`:
main_window = slint.loader.app.MainWindow()

value = slint.loader.app.MyOption.Variant2
main_window.data = value

Asynchronous I/O

Use Python's asyncio library to write concurrent Python code with the async/await syntax.

Slint's event loop is a full-featured asyncio event loop. While the event loop is running, asyncio.get_running_loop() returns a valid loop. To run an async function when starting the loop, pass a coroutine to slint.run_event_loop().

For the common use case of interacting with REST APIs, we recommend the aiohttp library.

Known Limitations

  • Pipes and sub-processes are only supported on Unix-like platforms.

Type Hints

PEP 484 introduces a standard syntax for type annotations to Python, enabling static analysis for type checking, refactoring, and code completion. Popular type checkers include mypy, Pyre, and Astral's ty.

Use Slint's slint-compiler to generate .py files with type annotations for your .slint files. They replace calls to load_file and any use of slint.loader.

  1. Create a new project with uv init.
  2. Add the Slint Python package to your Python project: uv add slint
  3. Create a file called app-window.slint:
import { Button, VerticalBox } from "std-widgets.slint";

export component AppWindow inherits Window {
    in-out property<int> counter: 42;
    callback request-increase-value();
    VerticalBox {
        Text {
            text: "Counter: \{root.counter}";
        }
        Button {
            text: "Increase value";
            clicked => {
                root.request-increase-value();
            }
        }
    }
}
  1. Run the slint-compiler to generate app_window.py: uvx slint-compiler -f python -o app_window.py app-window.slint

    If your slint-project.json sets "main": "app-window.slint", pass the project file or its directory: uvx slint-compiler -f python -o app_window.py slint-project.json. The generated module loads that project at run time, too.

  2. Create a file called main.py:

import slint
import app_window


class App(app_window.AppWindow):
    @slint.callback
    def request_increase_value(self):
        self.counter = self.counter + 1


app = App()
app.run()
  1. Run it with uv run main.py.

License

Slint is open source and available under three licenses: you pick the one that fits your app.

  • If your app is open source, use the GNU GPLv3, a widely used, OSI-approved open-source license. It covers any platform, including embedded devices.
  • If your app is closed source and runs on desktop, mobile, or the web, use the Royalty-free License. It's free of charge, and only asks you to credit Slint, with the AboutSlint widget or the Slint badge on your website.
  • If your app is closed source and runs on an embedded device, buy a commercial license. See the pricing.

Your own code can stay under a permissive license such as MIT or Apache-2.0. Anyone who forks it chooses their own Slint license, so they can reuse it in a closed-source app. The Licensing FAQ covers the details.

Third-Party Licenses

For a list of the third-party licenses of all dependencies, see the separate Third-Party Licenses page.