Skip to content

Migrating

What to change in an existing app when you upgrade. Each section is the release you are moving to; the changelog has everything else that changed.

To 0.6.3

Tesserae runs on TEL 0.2.0, and the text around slots is split by Tesserae. A TDL view, stylesheet or theme needs no change. Two things can: a Python dict given to App(stylesheet_spec=) or RuleSheet.of that holds "{{ expression }}" as a style value is refused now ({{ }} is not a slot): move the rule into a *_Stylesheet.tdl file (Height: <| h / 2 |>), or build the value with tess_ui.tel.Parts. And a tool that reads the mapping load_tdl_file gives and looks for {{ finds a tess_ui.tel.Parts instead, a str that holds the text as the file writes it (Battery <| level |>%): test isinstance(value, Parts), and for the JSON schemas an expression is a string with <| in it. A text of several slots takes each slot's own evaluation budget, and a message that quotes a slot shows <| x |>, as written.

To 0.6.2

The colour parser and the image decoder come from tesserae-utils. tess_ui.tokens.parse_color is gone: write from tess_utils import parse_color (the same strings parse to the same values). tess_ui.images.decode_image is gone: use tess_utils.decode_image_file(path), which returns (width, height, rgba) where decode_image returned (rgba, width, height).

Images are read by the same package, so three things differ: only PNG, JPEG, GIF and WebP files load (convert a BMP, TIFF or ICO picture first), the EXIF orientation is applied (a photo stored sideways is shown upright), and a file that cannot be read says cannot decode image '<path>': cannot read the image: ....

To 0.6.1

YAML is no longer read. Tesserae 0.6.1 reads TDL only; a .yaml view, stylesheet or theme is refused with a message that points here. A project still in YAML moves first, then upgrades.

Migrating from YAML

  1. Install the last release that has the converter, in a virtual environment of its own or over your project's: pip install "tesserae-ui<0.6.1".
  2. Convert the project: tesserae migrate-tdl PATH --write (PATH is the project's folder, here by default; leave out --write to see what it would do, add --remove-source to delete each YAML file it wrote). A project in the 0.4.x syntax (kind:, id:, component:) goes through tesserae migrate-yaml PATH --write first. What each command does, and what it refuses, is in To 0.6.0.1 below and in tesserae migrate-tdl --help of that release.
  3. Upgrade: pip install --upgrade tesserae-ui (Python 3.14 or newer), and run your app and tests.
  4. Replace what the removed Python API did:
Removed Use instead
app.load("Main_View.yaml", MainViewModel) app.bind(MainViewModel) and app.open_view("Main") (the ViewModel names the views it serves with views = "Main")
app.build_view(path) then app.register(...) app.open_view(...); app.register(name, view, viewmodel) still takes a View built from a spec
App(window_view="Window_View.yaml"), app.load("Window") app.open_view("Window") of a Window_View.tdl whose root is a Window
App.load(..., stylesheet=) (a stylesheet for one screen) App(stylesheet=), the app's stylesheet of Widget: rules
View("Home_View.yaml"), load_view, ViewWatcher app.open_view; hot reload is app.run(hot_reload=True)
tess_ui.instantiate(view, "Card", into=node), Component a call of the view in a view: Card { ... }
tess_ui.Repeater(view, items, "Row", into=node) a For row In <| items |> Key <| row.id |> { Row { ... } } in the view (Lists)
ViewDialog(window, "Settings_View.yaml") a modal Overlay in a view with the view you call as its content, Open bound to a Signal, and surface.dismiss to close it (Overlays)
style: row_Style.yaml, *_Style.yaml the fields in Style, or a rule in a stylesheet that matches through a class or a widget name
Components/Name_Component.yaml, component: Name a view Name with Params, called as Name { ... }
TESS_UI_SHIPPED=yaml nothing: Tesserae's own views are TDL only

TEL: expressions and handlers

Expressions and handlers run on TEL, the Tesserae Expression Language (tesserae-el, installed with Tesserae). Almost every view works unchanged; the view loader now says so when one does not. What to look for:

Before Now
d.get() on a Signal that holds a dict gave the dict it is the dict's own get and needs a key: write d
n.get() on a plain value was an error it is the value
a name _ refused, as every name starting with _ is
a text with <| |> parts: each part up to 2000 characters the whole text is limited to 2000 characters; split a longer one
rows[0] + 1, d.k + 1 with a Signal inside the list or dict an error (a Signal cannot be used in arithmetic): write rows[0].get() + 1; <| rows[0] |> alone still reads it
items.append(x), x.bit_length(), '{}'.format(x), isinstance(x, (int, str)), 2 ** 100000, a call of a name that is not a function: errors when the expression ran errors when the view loads, with the line
an action inside a bigger expression of a handler (ok = copy(t) and 1) an error: an action is a step of its own (Call) or the whole value of a Set (ok = copy(t))
one evaluation budget for a whole handler one per step
messages: cannot call .x(), the limit is 100000, not exposed, allowed: ... the method 'x' is not available, the range is over 100000 items, has no attribute, only did you mean ...; an ExprError has TEL's code too (unknown-name, call-not-function, method-not-available, bad-call, limit-range, ...)

Python code that imported tess_ui.expr (compile_expr, Template, ...) uses tess_ui.tel, which has the same names.

The Python widget factories call the shipped views

tess_ui.widgets.button() and the others (and the dialog, menu, snackbar, popover and side sheet of tess_ui.overlays) are built from the views Tesserae ships, with Tesserae's own stylesheets, so they take those views' looks and behaviour. The functions, their arguments, the Signals (.selected, .expanded, .query, .period, .content), the callbacks, .part(name) and the ids name and name.part are as they were; tess_ui.spec.expand_components_to_spec, tess_ui.spec.fragments and the component: fragments they expanded are gone (ComponentError is tess_ui.spec.ComponentError). What you may see:

Widget Now
every button, FAB, chip, card (with on_click), list item the shipped state changes ease (a fill over 150 ms, corners and shadow over 200 ms), a filled, tonal or elevated button, a FAB and an actionable elevated card lift on hover, a button takes its pressed corner radius; a theme change still re-colours at once
button() the label is as wide as its text and centred by the button (it was as wide as the button inside its padding)
split_button() the chevron is the chevron_down icon at 18 px (it was expand_more at 22); .part("chevron") is trailing.icon
chip() the outline is outline_variant (was outline); a filter chip shows its check as its icon part (.part("check") is .part("icon")), the close button is close (.part("remove"))
badge() the pill's width is the shipped one (8 + 6 per character); the label is flat_label (.part("label") still finds it)
accordion_header() the root holds the header and the content area; the interactive part is header (the chevron and title are header.chevron and header.title, .part("chevron") and .part("title") find them); the expanded state is on .part("header")
tree_node() the chevron points right and turns down when open (it pointed down and turned right), over 200 ms
date_picker_day() the state layer and focus ring are on the 48 px root (they were on the 40 px circle, .part("indicator"), now circle)
period_selector() a group of radios (it was a tab list); the halves are half[AM] and half[PM] (.part("am") and .part("pm") find them); one Tab stop by a roving tab_index
search_bar() typing makes the bar active: the leading icon becomes a back arrow, a clear button shows while there is a query, and the trailing icons show only while it is empty
toolbar() the floating one is a full pill;
top_app_bar() the title and icon buttons are in the bar's row (.part("title"), .part("leading"), .part("trailing0") find them); the navigation icon button is 40 px (it was 48); a bar with window_controls, more than three trailing icons or a style height under 64 is built by hand as before
status_bar() a three-column strip; its text part is section[start].note[0].note_text (found by .part("text")) and .text is a Signal
link() underlined while hovered or focused
actions of Dialog, Snackbar and Popover; rows of Menu the shipped text Button (as wide as its label, 40 px tall) and MenuItem; a dialog's action is panel.actions.action0 (.part("panel.action0") still finds it)

An app's own Button_View.tdl (or any shipped name) replaces the shipped view for the app's views, not for these widgets: a factory always calls Tesserae's. A theme's components: entries (card.elevated, fab.small, dialog, ...) reach the factories' widgets as before and still not a view an app writes.

To 0.6.0.1

Views, stylesheets and themes are written in TDL. A view is a <Name>_View.tdl, a stylesheet a <Name>_Stylesheet.tdl and a theme a <Name>_Theme.tdl; Tesserae no longer reads the YAML files of those kinds. The language is the same one (the same nodes, properties, styles, handlers, expressions, rules and themes), written in TDL's syntax, so nothing about how an app behaves changes. The View Language is the whole of it.

What you do:

  1. Use Python 3.14 or newer. TDL is read by tess_dl (tesserae-dl), which Tesserae installs and which needs 3.14.
  2. Run the converter in your project, and read its report:
tesserae migrate-tdl                      # lists what it would convert; writes nothing
tesserae migrate-tdl --write              # writes Name_View.tdl beside each Name_View.yaml (and the stylesheets and themes)
tesserae migrate-tdl --write --remove-source   # and deletes each YAML file it wrote or found already converted

Every result is read back through the TDL loader and compared with the YAML before it is written; a file it cannot write exactly is reported with its line and what to write, and left alone. Comments, blank lines and the order of keys are kept. Running it again changes nothing. The tesserae command has the details. 3. Look at what it reports. An augmented assignment in a handler (x += 1) is written as a Set with the operation spelled out (Value: <| x + 1 |>). A handler the converter cannot turn into steps (an if, a[0] = 1, go(*args)), a text with a {{ }} and a comma, a brace or # around it (make the whole value one expression), a YAML date and an anchor are refused; the report names the line. 4. A file in the older syntax (kind:, id:, component:) is moved with tesserae migrate-yaml first; *_Component.yaml fragments are not converted. 5. Rename what refers to files. app.open_view(HERE / "Main_View.yaml") is Main_View.tdl; a test or a script that reads a view file by its name needs the new one.

What the same thing looks like:

In YAML In TDL
Counter_View.yaml Counter_View.tdl
tesserae: 0.6 on the first line Tesserae: "0.6" in the metadata block between --- lines, with TDL: 0.2 and the view's Name (the metadata block)
widget: Text and its keys Text { ... }, a block headed by the widget
style: {flex_direction: vertical} Style { Flex_Direction: vertical } (every key is Title_Case)
children: Children { ... }
text: "Count: {{ count }}" Text: Count: <| count |>
if: loading on a node If <| loading |> { node } around it
for: row in rows with key: row.id For row In <| rows |> Key <| row.id |> { node } around it
handlers: {on_click: "open = not open; on_toggle()"} Handlers { On_Click { Set { Target: open, Value: <| not open |> } Call { Action: on_toggle } } } (a bare action name stays On_Click: save)
styles: with - widget: Card rules Styles { Rule { Widget: Card, Style { ... } } }
a theme's seed:, colors:, components: {card.elevated: ...} Theme { Seed: ..., Colors { ... }, Components { Card { Elevated { ... } } } }

A node under If or For has the same id, path and name as before, so a ViewModel, a stylesheet rule or a hot reload sees the same tree. A .tdl file that says TDL: 0.1 (its slots are {{ }}) or writes a slot as {{ }} is refused with the line.

To 0.6.0

Two Python packages change name: Tesserae's is tess_ui (it was tesserae) and the engine's is tess_re (it was tre). The name tesserae is also an unrelated project on PyPI, and the Tesserae packages share the tess_ prefix. Nothing is left under the old names: after the upgrade import tesserae and import tre are a ModuleNotFoundError. What did not change: the PyPI names (tesserae-ui, tesserae-engine) and the tesserae command (tesserae new, tesserae add screen; python -m tess_ui is the same). The tesserae: first line of a YAML file stays, but its value is 0.6 now (the last bullet).

  • Rewrite the imports. from tesserae import App is from tess_ui import App, import tesserae.spec is import tess_ui.spec, and a dotted name such as tesserae.spec.themes is tess_ui.spec.themes (a string given to importlib or to monkeypatch.setattr too). A search for import tesserae and from tesserae in your *.py files finds every place; the views and ViewModels you have need nothing else.
  • Environment variables that started TESSERAE_ start TESS_UI_: TESS_UI_FRAMES_REPORT, TESS_UI_ISCC, TESS_UI_MAX_FRAMES, TESS_UI_ONLY, TESS_UI_STATE_DIR and TESS_UI_STATS.
  • The editor schemas are tess-ui-*-schema.json (they were tesserae-*-schema.json), in the package (site-packages/tess_ui/schema/) and on the docs site. A yaml.schemas setting that names them by path or address needs the new names; tesserae schema --project writes .tesserae/tess-ui-widget-schema.json, and leaves the old file in .tesserae/ for you to delete. Editor Support has the setting.
  • The logger is tess_ui: logger.disable("tess_ui") silences Tesserae (it was "tesserae"), and a filter on the module name matches tess_ui.app, tess_ui.spec.watch and the rest.
  • Tesserae needs tesserae-engine 0.6.0, one exact release: pip install --upgrade tesserae-ui brings it. If your code imports the engine itself, import tre is import tess_re and from tre import Window is from tess_re import Window; every name inside is unchanged, so a search and replace is the whole change (the engine's own table). The engine's messages that said tre (a shader error, the default window title) say tess_re, so a test that matches that text needs the new word.
  • The engine's environment variables TRE_* are TESS_RE_*, and the two Tesserae's own tools read follow: TRE_SOURCE_DIR (the engine checkout a font test reads) is TESS_RE_SOURCE_DIR, and TESSERAE_RECORD_TRE (records the engine's answers for the reference tests) is TESS_UI_RECORD_TESS_RE.
  • A file marked tesserae: 0.5 is refused until it is moved up a line. The first line of a view, stylesheet or theme names the release series it was written for, and 0.6 is a new one, so a file that says 0.5 stops loading with written for Tesserae 0.5: run tesserae migrate-yaml. Run tesserae migrate-yaml in the project to see which files, and tesserae migrate-yaml --write to move them: only that first line changes (a comment after the value, Windows line ends and a byte order mark stay), and nothing in the view language changed between the two lines. A file with no first line loads as before, and the shipped files and what tesserae new and tesserae add screen write say 0.6.

The metadata of a file

Nothing has to change in a file that has no Tesserae entry. A view, stylesheet or theme may say which release series it was written for in its metadata block (Tesserae: "0.6"), and the files Tesserae ships and writes do: tesserae new, tesserae add screen and tesserae migrate-tdl. A file without it loads and is noted once in the log (info level); a later series will ask for it, and a file written for an older series is refused with the series it names. To add it to your own files, write it in the metadata block: the metadata block says what is checked. Before 0.6.0.1 the series was the first line of a YAML file, tesserae: 0.6 (To 0.6.0).

To 0.5.1

Nothing in a working app has to change, but one thing that loaded before is now refused: a handler that assigns to a name it cannot write (a plain param, a loop variable, a Computed, a ViewModel attribute that is not a Signal, hovered, or a misspelt name), including one written in the text of an after(...) or every(...), is an error when the view loads, with the file, line and column. It used to fail only when the handler ran, so a handler that could never have worked now stops the view from opening: what a handler may assign says what is writable. A property the user edits, given a bare name that cannot be written back, is also warned about in the log.

To 0.5.0

This release changes the view language. Everything you wrote before still loads: a view in the old syntax is read as it always was, and says once per file how to move on. The new language is one shape (a node with a widget:), a ViewModel that serves several named views, rules in stylesheets, and one expression language. The View Language is the whole of it.

Move a project

tesserae migrate-yaml            # reports what would change; writes nothing
tesserae migrate-yaml --write    # writes it, if every file checked out

It reads every *_View.yaml, *_Component.yaml and *_Stylesheet.yaml in the project, translates them, checks each result with the loader the app uses, and writes only if all of them load (--force writes the ones that did). Keep the project in version control: the old files are rewritten, and a fragment is renamed. The comments at the top of a file are kept; comments inside a file are not, and the report says which files had them. Themes (*_Theme.yaml) are left as they are. A node that names a style file (style: row_Style.yaml) gets the file's fields written into its style:, and the report says so; the style files stay where they are, for you to delete once nothing else reads them.

Before After
kind: X, component: X, view: X_View.yaml, include: X.yaml widget: X
*_Component.yaml *_View.yaml (a view with params:)
id: x name: x; the root's id: root is dropped
with: {a: 1} on a call a: 1
repeat: "{{ items }}" for: item in items with a key: (write the identity, item.id; the tool leaves a stand-in and says so)
when: "{{ x }}", {if: ..., then: ..., else: ...} if: x on the node, or on two nodes
bindings: {text: "{{ x.get() }}"} text: "{{ x.get() }}" (and {{ x }} works)
two_way: checked a bare reference on a model property: checked: "{{ done }}"
kind: TextField (the bare input) widget: TextInput; the Material text field is now widget: TextField
text: {content: Hi, typography_role: ...}, icon: {name: home}, image: {...} text: Hi, typography_role: ..., icon: home, the keys of image as properties
bindings: {background: ...} style: {background: ...}
interaction: {color: X} interaction: X
navigate.{{ screen }} navigate_to(screen)
a stylesheet rule kind: Rect / id: go / classes: [a] widget: Rect / name: go / classes: [a]
a component's <Name>_Stylesheet.yaml, rules by id: rules widget: Name, with part: <id> (root is the widget itself)

A view that has a <Name>_ViewModel.py beside it is named name: <Name>, the bind key. The ViewModels are Python and are not rewritten; the report lists what each needs:

class CounterViewModel(ViewModel):
    views = "Counter"                 # the views it serves

    def __init__(self):               # no `view` argument
        super().__init__()
        self.count = Signal(0)
app.bind(CounterViewModel)
app.open_view("Counter")              # instead of app.load("Counter")

ViewModel(view) and app.load(...) still work for views in the old syntax, so a project can move one view at a time: migrate, then change that view's ViewModel and its line in app.py.

What the tool cannot do

  • A widget name that is a parameter (component: "{{ button }}") has no equivalent: a variant property on one widget replaces it.
  • A call that sets a property its fragment does not declare (disabled on a ButtonText) is reported; the fragment needs to declare it.
  • The shipped fragments that were merged into one view with a property are not renamed by the tool. A call of component: ButtonFilled becomes widget: ButtonFilled, which does not exist, and fails the check with no widget named 'ButtonFilled'. What each one became is below. The shipped fragments that kept their name (NavigationRail, NavigationRailScreens, StatusBar, Menu, Toolbar, ...) are views of the same name and migrate as they are.
  • A view written with kind: TextField was the bare input. It becomes widget: TextInput, and widget: TextField is the Material text field, so a migrated view keeps what it had; move to TextField when you want the label, supporting text and the rest.
  • foreground is valid only on the widgets that draw text or glyphs; on a Container it is now an error that names them.

The shipped fragments that became one view

Several shipped fragments were one fragment per look. They are now one view with a property that picks the look, so write the new form by hand. Each line of the view below is the new form of one or more old names:

Old component: New
ButtonFilled, ButtonFilledTonal, ButtonElevated, ButtonOutlined, ButtonText widget: Button with variant: filled, tonal, elevated, outlined, text
SplitButtonFilled, SplitButtonFilledTonal, SplitButtonElevated, SplitButtonOutlined, SplitButtonText widget: SplitButton with the same variant values
IconButtonStandard, IconButtonFilled, IconButtonFilledTonal, IconButtonOutlined widget: IconButton with variant: standard, filled, tonal, outlined
FabPrimary, FabSecondary, FabTertiary, FabSurface widget: Fab with variant: primary, secondary, tertiary, surface
ExtendedFabPrimary, ExtendedFabSecondary, ExtendedFabTertiary, ExtendedFabSurface widget: Fab with the same variant and a label
BadgeDot, BadgeLabeled widget: Badge; with a value it is the labelled one, without it the dot
CardElevated, CardFilled, CardOutlined widget: Card with variant: elevated, filled, outlined
ChipAssist, ChipFilter, ChipFilterSelected, ChipInput, ChipSuggestion widget: Chip with variant: assist, filter, input, suggestion; the selected filter chip is variant: filter with selected: true
ToolbarDocked, ToolbarFloating widget: Toolbar with variant: docked or floating
SideSheetStandard widget: SideSheet (SideSheetModal for a modal one)
AccordionHeader widget: Accordion (AccordionGroup to hold several)
TreeNodeBranch, TreeNodeLeaf widget: TreeNode, a branch with branch: true
TabsItem the tabs: list of widget: Tabs: each tab is {value, label}, and selected is the chosen tab's value
DatePickerDayToday, DatePickerDaySelected, DatePickerDayOutsideMonth widget: DatePickerDay with today: true, selected: true, outside: true
PeriodSelectorAM, PeriodSelectorPM widget: PeriodSelector with period: AM or PM
Video widget: VideoPlayer
Tooltip the tooltip: key on any node
name: examples
widget: Container
style: {flex_direction: vertical, gap: 8}
children:
  - {widget: Button, label: Save, variant: filled}
  - {widget: SplitButton, label: Save, variant: tonal}
  - {widget: IconButton, icon: home, variant: outlined}
  - {widget: Fab, icon: add, variant: tertiary}
  - {widget: Fab, icon: add, label: New, variant: primary}
  - {widget: Badge, value: 3}
  - {widget: Card, variant: outlined}
  - {widget: Chip, label: Rock, variant: filter, selected: true}
  - {widget: Toolbar, variant: floating}
  - {widget: SideSheet, title: Filters, open: true}
  - {widget: Accordion, title: Details}
  - {widget: TreeNode, label: src, branch: true}
  - {widget: Tabs, tabs: [{value: one, label: One}, {value: two, label: Two}], selected: one}
  - {widget: DatePickerDay, day: 7, today: true}
  - {widget: PeriodSelector, period: PM}
  - widget: Text
    text: Hover me
    typography_role: body_medium
    tooltip: Help
    style: {foreground: on_surface}

To 0.4.6

Nothing has to change if your app already runs on 0.4.5. The old names that 0.4.5 removed each raised an error saying what replaced them; those messages are gone now, and an old name fails as any unknown name does: App(decorations=False) is a TypeError ("unexpected keyword argument"), app.load_shell, app.use_shell and app.decorations are an AttributeError, from tesserae.shell import AppShell is a ModuleNotFoundError, tesserae new --shell is "unrecognized arguments", and a *_Shell.yaml is an ordinary view that doesn't fit the schema. If you meet one of them, To 0.4.5 is the table of what replaces each.

To 0.4.5

This release is breaking. There is one way to describe a window now, a kind: Window view (Windows, Docks & Embedded Views), so the older ways are removed. In this release each removed name raised an error that said what replaces it; from 0.4.6 they fail as unknown names do (To 0.4.6), so this table is where to look.

Removed Use instead
*_Shell.yaml and app.load_shell(...) a Window_View.yaml of kind: Window, loaded with app.load("Window")
tesserae.shell.AppShell and app.use_shell(...) the same window view; for docking from Python, tesserae.docking.Dock
App(decorations=False) App(borderless=True), or borderless: true on the Window
app.decorations (and app.decorations = ...) app.borderless, which is the opposite
tesserae new --shell tesserae new --window
the tesserae-shell-schema.json editor schema none: a window view is a *_View.yaml, which has its schema

From a shell file

Before, app.py loaded the screens, routed them and loaded the shell:

app = App(width=640, height=480, title="Tasks", decorations=False)
app.load("Main")
app.load("Settings")
app.route("", "Main")
app.route("settings", "Settings")
app.load_shell("Tasks")                       # Views/Tasks_Shell.yaml
# Tasks_Shell.yaml
top_bar: {title: Tasks, style: {background: primary_container}}
navigation:
  items:
    - {screen: Main, icon: home}
    - {screen: Settings, icon: settings}
status_bar: {text: Ready, style: {height: 28}}

Now the window view holds the frame and the screens, and app.py loads one file:

app = App(title="Tasks")
app.load("Window")                            # Views/Window_View.yaml
app.navigate_to("")
# Window_View.yaml
id: root
kind: Window
title: Tasks
borderless: true
style: {width: 640, height: 480, background: surface, flex_direction: vertical}
title_bar: {title: Tasks, style: {background: primary_container}, buttons: [minimize, maximize, close]}
children:
  - id: body
    kind: Container
    style: {flex: fill, flex_direction: horizontal}
    children:
      - id: nav
        component: NavigationRailScreens
        with:
          items:
            - {label: Tasks, icon: home, screen: Main}
            - {label: Settings, icon: settings, screen: Settings}
      - id: screens
        kind: Container
        style: {flex: fill}
        children:
          - {id: main, view: Main_View.yaml, route: "", style: {flex: fill}}
          - {id: settings, view: Settings_View.yaml, route: settings, style: {flex: fill}}
  - id: status
    component: StatusBar
    with: {text: Ready, width: "100%"}
In the shell file In the window view
top_bar: {title, leading_icon, trailing_icons, style} title_bar: {title, icon, buttons, children, style}; your icons are children
navigation: {items} (screen, icon) a NavigationRailScreens with items of label, icon, screen
navigation.on_navigate handlers: {on_click: ...} on your own nodes, or navigate.<Screen>
status_bar: {text, style} a StatusBar component
zones: {left: 220}, center, panels a kind: Dock with kind: DockPanels: style: {zone: left, width: 220}; panels in one zone are tabs
a panel named Files (a screen or Files_View.yaml) - {id: files_view, view: Files_View.yaml} inside a DockPanel
app.load("Main") and app.route("", "Main") view: Main_View.yaml with route: "" in the window view
shell.layout() and shell.restore(layout) view.dock_host("dock").layout() and .restore(layout)
shell.size(side) and shell.set_size(side, px) view.dock_host("dock").size(side) and .set_size(side, px)
app.screen("Files") view.embedded("files_view")

From AppShell and use_shell

Build the frame as a window view as above. A Python-built Dock (from tesserae.docking import Dock) is unchanged: Dock(window), add_zone, add_panel, move, show and the rest. AppShell's own layout(), restore(), size() and set_size() are on the DockHost of a kind: Dock (view.dock_host(id)), as in the table.

From decorations

decorations=False is borderless=True, and decorations=True is borderless=False (the default). Read the state as app.borderless; a binding that read app.decorations should be not app.borderless.

To 0.4.4

Nothing had to change: shell files, app.load_shell() and decorations=False worked as before. New apps could write their frame as a kind: Window view (tesserae new notes --window), and the shell file is being phased out, so an app that has one can move over when it likes:

In the shell file In the window view
top_bar: {title: Notes} title_bar: {title: Notes} on the kind: Window root
navigation: {items: [...]} a NavigationRailScreens with the same items (screen: names a screen)
status_bar: {text: Ready} a StatusBar component
zones: a kind: Dock with kind: DockPanels, each style: {zone: left}
app.load("Main") and app.route("", "Main") - {id: main, view: Main_View.yaml, route: ""} in the window view
App(decorations=False) borderless: true on the window (or App(borderless=True))

Then app.load("Window") replaces app.load_shell(...). Windows, Docks & Embedded Views has each form. An app can't load a window view and a shell file together.

To 0.4.3.3

Tesserae needs tre (tesserae-engine) 0.5.5 or newer, below 0.6: pip install --upgrade tesserae-ui brings it. Nothing in your code has to change. Resizing a window, undecorated or with the OS's frame, no longer stalls on KDE Wayland: tre 0.5.4 stalled for up to a second at a time while it was dragged, and 0.5.5 fixes that.

To 0.4.3.1

Nothing has to change. A *_Style.yaml is written with its fields under style: now, and an id: if you like, and the style files you have, which are only the fields, still load. Style files has the form.

To 0.4.2

Tesserae needs tre (tesserae-engine) 0.5.4 or newer, below 0.6: pip install --upgrade tesserae-ui brings it. Nothing in your code has to change, but three things look or behave differently:

  • A window is scaled to its screen (App(dpi_scaling=True) is the default). On a high-density screen a 16-pixel size is now the same size it is on a standard one, drawn with more pixels, and width, height and pointer positions are in those logical pixels. App(dpi_scaling=False) is the old behaviour. See Window Options.
  • Animations stop for a user who asked the OS for less motion, and the theme is made at a higher contrast for one who asked for more. App(reduced_motion=False, high_contrast=False) ignores the OS.
  • Colours are drawn exactly as written, which on some screens is a little darker than before.

To 0.4.1

Nothing in your code has to change. tesserae new makes a project with files in Views/, ViewModels/, Components/, Themes/ and Styles/, found by name, and its first screen is Main, not Home. An app with its files beside app.py keeps working, and tesserae add screen follows whichever layout it finds.

To 0.4.0

Where a node's children go, and how a node takes room, have new names. The engine's names are refused with a message saying what replaces them (style.align_items is now align_content ...), so a view that uses one fails to load and tells you.

Was Is
align_items, justify_content align_content: one of nine positions (top_left, top, top_right, left, center, right, bottom_left, bottom, bottom_right)
justify_content: space_between / space_around / space_evenly spread: between / around / evenly
flex_grow: 1 flex: expand_horizontal (in a row) or expand_vertical (in a column)
flex_shrink: 0 nothing: it is the default now
flex_basis width or height, with flex
align_self, justify_self align_self, one of the nine positions
justify_items align_cells (a grid)
align_content on a wrapping node align_wrapped
align_content and justify_content on a grid align_tracks

What an old pair becomes, in a row (flex_direction: horizontal, the default):

Was Is
align_items: center align_content: left
align_items: center, justify_content: center align_content: center
justify_content: flex_end align_content: top_right
align_items: flex_end align_content: bottom_left
align_items: center, justify_content: space_between spread: between, align_content: left

In a column the same words name the same places: align_items: center (across a column is horizontal) is align_content: top.

Things that change with them:

  • A node is never squeezed by default. Its size is its width and height, or its content. flex_shrink was 1, so a crowded parent shrank its children; now they keep their sizes and overflow. A Text that used to wrap because its parent was narrow now needs flex: expand_horizontal (or a width) to wrap.
  • Not setting align_content still stretches children across the layout and starts them at the start. Setting it places them, so children that were stretched (align_items: stretch, the default) and a position that means centred along the other axis are not the same: use flex: expand_vertical (or expand_horizontal) on the children that should fill.
  • baseline is gone. Nothing replaces it.
  • flex overrides the size across the parent's layout: flex: expand_vertical in a row drops the node's height.
  • Python: a style given to a widget (top_app_bar(style=...)) and AppShell(styles=...) take the new names too. Direct engine calls (window.create(..., align_items=...)) are the engine's, and unchanged.

To 0.3.4

Nothing in your code has to change.

  • The built-in components keep their look in <Name>_Stylesheet.yaml files and their structure in <Name>_Component.yaml. A view that uses component: ButtonFilled expands to exactly what it did. If you copied a built-in *_Component.yaml to restyle it, you can delete the copy and put just a <Name>_Stylesheet.yaml with the fields you change next to your views (in the current language it is read only while the app uses the view).
  • A *_Component.yaml or *_Stylesheet.yaml in a view's own folder is now found. A file there named for a built-in component replaces or restyles it, so check that none is there by accident.

To 0.3.3

  • A view with no theme_seed resolves theme roles (surface, primary, ...) from MD3's baseline palette, where it used to fail. Nothing to change; add a theme_seed= to make the colours your own.
  • A shell's top and status bars keep their height when the window is short.

To 0.3.2

  • Tesserae needs tre (tesserae-engine) 0.5.1 or newer, below 0.6.
  • app.run(keepalive=) is off by default. A hot-reload watcher or a thread calling thread_handle().call_soon reaches an idle window without it. Pass True or a number to tick the loop regularly.

To 0.3.0

  • Tesserae needs tre 0.5.0.1 or newer, below 0.6.
  • A shell file's navigation rail navigates (with history) instead of jumping with show, so back() returns from a rail choice.
  • Window options (decorations, resize_border, min_width, fullscreen, system_menu, icon) are on App, and the actions minimize(), maximize(), restore(), toggle_maximized() and close().

To 0.2

The widgets became Tesserae's own: built from tre's building blocks, and returned as Tesserae objects.

  • Controls. checkbox, radio_button, switch, slider, spin_box, circular_progress, linear_progress, loading_indicator and time_picker_dial return a control, not a tre.Node. Where you read node.get_checked() or get_selected(), read control.checked.get() or control.selected.get(). Where you called set_checked(...), call control.checked.set(...). Use the control's .node where you used the node. A checkbox, switch or radio button toggles itself when clicked, so an on_click that toggled it by hand should go. spin_box returns one SpinBox, not (field, minus, plus). A slider's position is control.value.get().
  • Composed widgets return a Widget: .node, .part(name), on_click(fn), set_theme(theme), destroy().
  • Renamed arguments. Old names raise TypeError:

    Function Was Is
    switch on= selected=
    divider vertical=True orientation="vertical"
    link text content
    dialog text supporting_text
    toolbar tone="vibrant" vibrant=True
  • Images and video. image(window, path, ...) decodes the file itself, so the engine never receives a path. A missing or undecodable file is an OSError. video(...) is a blank surface until you call video.frame(rgba, width, height).

  • Files. load_theme and load_stylesheet refuse a file named for another kind (*_Style.yaml, *_Stylesheet.yaml, *_Theme.yaml); other names load as before.