Skip to main content

Pyzed

Interfaces modernas y rápidas en Python, renderizadas por Iced (Rust). Incluye componentes listos para usar inspirados en el editor Zed.

📖 Documentación: albakore.github.io/pyzed · Novedades

Recreación del editor Zed hecha con Pyzed

Esta captura es una app de Python (examples/zed_editor.py): panel de proyecto, pestañas, editor con resaltado de sintaxis, marcadores de git, barra de estado, paleta de comandos y temas. Todo se dibuja con Iced.

Por qué Pyzed

  • Rendimiento nativo. Python solo describe la interfaz. El layout, el texto y el dibujado (wgpu, con tiny-skia como respaldo por software) los hace Iced 0.14 en Rust, mediante PyO3.
  • Sencillo. Sigue la arquitectura Elm de Iced (estado, update y view). Un botón puede llamar directamente a un método: on_press=self.guardar.
  • Componentes listos. Unos 40 componentes al estilo Zed (botones, pestañas, árbol de archivos, paleta de comandos, editor de código, terminal, menús, notificaciones…), todos personalizables.
  • Temas. Incluye las familias One, Ayu y Gruvbox importadas de Zed, puede leer cualquier tema de Zed, generar uno a partir de tres colores y seguir el modo claro/oscuro del sistema.
  • Async y varias ventanas. async def, generadores y streams en update, temporizadores con pz.every y tantas ventanas como quieras con pz.Window.
  • Multiplataforma. Linux, macOS y Windows. Las fuentes (IBM Plex) y los iconos (Lucide, ~2000) van incluidos.
  • Capturas sin ventana. app.screenshot("ui.png") renderiza fuera de pantalla, sin GPU ni display. Sirve para tests y documentación (así se generaron todas estas imágenes).

Instalación

Por ahora se instala desde el código fuente. Necesitas Rust estable y Python 3.9 o superior.

pip install git+https://github.com/albakore/pyzed

Para desarrollar:

git clone https://github.com/albakore/pyzed && cd pyzed
python -m venv .venv && source .venv/bin/activate
pip install maturin
maturin develop --release   # usa --release: la build debug es mucho más lenta

Inicio rápido

import pyzed as pz
from pyzed import ui


class Counter(pz.App):
    title = "Counter"
    size = (360, 220)

    def __init__(self):
        self.count = 0

    def update(self, message):          # los mensajes pueden ser cualquier valor de Python
        if message == "increment":
            self.count += 1
        elif message == "decrement":
            self.count -= 1

    def view(self):
        return pz.center(
            pz.column([
                ui.heading(str(self.count)),
                pz.row([
                    ui.button("-1", "decrement", icon="minus"),
                    ui.button("+1", "increment", icon="plus", variant="solid"),
                    # ...o un callable, que se llama directamente
                    ui.icon_button("rotate-ccw", lambda: setattr(self, "count", 0), tooltip="Reset"),
                ], spacing=8),
            ], spacing=16, align="center"),
            bg=self.theme.editor,
        )


pz.run(Counter)
Contador

Crear un proyecto nuevo

pyzed new mi-app      # crea mi-app/main.py con barra de título, sidebar, estado y paleta de comandos
cd mi-app && python main.py
pyzed icons folder    # busca nombres de iconos

Hot reload

pyzed dev main.py     # como `python main.py`, pero cada vez que guardas se actualiza la ventana

También con pz.run(MiApp, reload=True) o la variable PYZED_RELOAD=1. Al guardar cualquier .py del proyecto, la ventana muestra el cambio sin reiniciarse y conserva el estado (los atributos de tu app). Si el código nuevo tiene un error, la ventana lo muestra hasta que guardas la corrección.

Antes Después de guardar Con un error
Antes Después Error
sequenceDiagram
    participant Editor as Tu editor
    participant Watcher as Hilo vigilante
    participant UI as Hilo de la UI (Iced)
    participant App as Tu App
    Editor->>Watcher: guardas cards.py
    Watcher->>UI: pz.post(recargar)
    UI->>UI: re-ejecuta cards.py y los módulos que lo importan
    UI->>App: obj.__class__ = clase nueva (mismo estado)
    UI->>App: on_reload() si existe
    UI->>App: view()
    App-->>UI: árbol de widgets nuevo

Los atributos que crea __init__ no se vuelven a crear: dale un valor por defecto de clase a los atributos nuevos, o define on_reload(self) para migrar el estado. Ver examples/hot_reload/ y pyzed.hot_reload para vigilar otros archivos (Reloader.watch(ruta, callback)).

Conceptos

Concepto Cómo funciona
App Tu estado vive en el objeto. view() devuelve widgets y update(msg) cambia el estado.
Mensajes on_press=valor envía valor a update. Si es un callable (lambda, método), se llama directamente. Lo que devuelva, si no es None, se envía a update.
Callbacks con datos on_input, on_toggle, on_change… reciben el valor nuevo: on_input=lambda t: setattr(self, "query", t).
Command Efectos que devuelve update o un callback: Command.focus("id"), Command.exit(), Command.set_editor_text(id, txt), Command.set_editor_cursor(id, línea, col), Command.scroll_to(id, x, y), Command.copy(txt), Command.batch([...]) y Command.perform(fn, then), que ejecuta fn (normal o async def) en segundo plano y entrega el resultado a then.
Async update y los callbacks pueden devolver una corrutina, un generador o un generador async: cada resultado vuelve a update. Todo corre en un único loop de asyncio.
Suscripciones subscriptions() devuelve pz.every(segundos, msg) (temporizador) y pz.listen(gen) (streams). Solo existen mientras las devuelves.
Ventanas class Ajustes(pz.Window) con su propio view(), título, tamaño y tema; se abre con return Ajustes().open(). Ganchos: on_open, on_close, on_resize.
Atajos on_key(self, combo) recibe cada tecla al estilo Zed: "ctrl-shift-p", "escape", "up"…
Hilos pz.post(mensaje) envía un mensaje a la app desde cualquier hilo.
Inicio on_start() se ejecuta una vez y puede devolver un Command o una corrutina.
Errores Si view() lanza una excepción, la ventana muestra el traceback en vez de cerrarse.

Widgets base (pyzed)

text, column, row, container, center, button, text_input, scrollable, space, hspace, vspace, rule, mouse_area, stack, opaque, hover, tooltip, checkbox, toggler, slider, vertical_slider, progress_bar, code_editor, svg, icon, image e image_viewer (PNG, JPEG… o píxeles RGBA), canvas (dibujo 2D con pyzed.draw), markdown, rich_text + span, qr_code, pick_list, radio, split, grid, pin y responsive. Los contenedores aceptan gradient=(ángulo, [colores]).

Los tamaños aceptan píxeles, "fill", "shrink" o "fill:2" (proporción). El padding acepta 8, (v, h) o (arriba, derecha, abajo, izquierda). Los colores aceptan "#rrggbb[aa]" o tuplas (r, g, b[, a]).

Componentes (pyzed.ui)

Galería de componentes

Grupo Componentes
Básicos label, muted, heading, button (filled, ghost, outline, solid, error/warning/success; tamaños xs a lg; atajo opcional), icon_button, badge, indicator, kbd, avatar, tooltip, divider, card
Formularios input, search_input, switch, checkbox, slider, progress, segmented, field, select, radio_group, number_field, split_button, toggle_group, chip, disclosure
Datos y feedback table + Column (orden y selección), callout, count_badge, facepile, diff_stat, keybinding_hint, empty_state, settings_group, stat, sparkline, bar_chart, donut, spinner, markdown, split
Listas list_item, list_header, tree + TreeNode.from_paths(...) (panel de proyecto con estados de git), menu + MenuItem
Navegación tab_bar + Tab.for_file(...) (sucia, vista previa, estado git, cierre al pasar el ratón), breadcrumbs, toolbar
Workspace workspace (layout con docks izquierdo, derecho e inferior), title_bar, title_button, status_bar, status_item, panel, panel_header
Overlays layer (capa con fondo y cierre al hacer clic fuera), modal, popover (menús contextuales), picker, command_palette + PaletteItem, fuzzy_filter, toast, toasts
Código editor (resaltado de sintaxis, números de línea, marcadores de git, scroll horizontal con números fijos, ajuste de línea, on_change y on_cursor), terminal (con colores ANSI), ansi

Todos leen sus colores del tema actual y aceptan theme= u otros parámetros para cambiarlos.

Diseñador visual

Un editor de formularios al estilo Visual Basic / Qt Designer, hecho con Pyzed: arrastras componentes a una grilla de puntos con snapping, los alineas, editas sus propiedades y haces doble clic para escribir el código de cada evento. F5 ejecuta el formulario con toda su lógica.

pyzed design login.pzform   # abre el diseñador
pyzed run login.pzform      # ejecuta el formulario

Diseñador visual

Cada formulario son dos archivos: login.pzform (diseño en JSON) y login.py (handlers en Python). Ejemplo en examples/designer; guía completa en docs/src/content/docs/guides/designer.md.

Temas

class MiApp(pz.App):
    theme = "Ayu Dark"                     # cualquier nombre de pz.themes.names()
    # theme = pz.themes.auto("One Light", "One Dark")   # sigue al sistema

oceano = pz.themes.ONE_DARK.derive(name="Océano", syntax={"keyword": "#ff79c6"}).with_accent("#4fb3ff")
propio = pz.Theme.generate("Propio", background="#1b1d23", text="#e6e6e6", accent="#ff8a65")
de_zed = pz.Theme.from_zed("catppuccin.json", name="Catppuccin Mocha")   # temas de Zed

Cambiar self.theme en update cambia el estilo de toda la interfaz al momento.

One Light + terminal + outline Paleta de comandos
One Light Paleta
Buscador de archivos (Gruvbox) Componentes (One Light)
Buscador Componentes claros

Ejemplos

Archivo Qué muestra
examples/counter.py Lo mínimo: estado, mensajes y callables.
examples/todo.py Lista de tareas: formularios, listas, filtros, foco y atajos.
examples/downloads.py Trabajo en segundo plano con Command.perform y pz.post, progreso y notificaciones.
examples/mini_editor.py Un editor tipo Zed en ~150 líneas (árbol, pestañas, editor, paleta).
examples/gallery.py Todos los componentes, interactivos, con selector de tema.
examples/zed_editor.py Un editor tipo Zed sobre una carpeta real: abrir, editar y guardar (ctrl-s), paleta (ctrl-shift-p), buscador (ctrl-p), docks (ctrl-b, ctrl-j, ctrl-alt-b) y temas. El panel de terminal muestra una salida de ejemplo; no ejecuta una shell.
examples/hot_reload/ Hot reload con dos módulos: ejecútalo con pyzed dev examples/hot_reload/main.py y edítalo.
examples/tutorial/ Tutorial en cinco pasos, de una ventana vacía a una app de notas.
examples/todos.py Lista de tareas con edición, filtros y guardado (demo todos de Iced).
examples/game_of_life.py Juego de la vida en un canvas con pz.every.
examples/clock.py, stopwatch.py Reloj analógico y cronómetro con vueltas.
examples/download_progress.py Descargas concurrentes con generadores async.
examples/websocket_stream.py Datos en vivo con pz.listen.
examples/multi_window.py Varias ventanas con estado compartido y temas distintos.
examples/image_viewer.py image e image_viewer con zoom y desplazamiento.
examples/markdown_viewer.py Editor de Markdown con vista previa en un split.
examples/styling.py Selector de temas, tema del sistema y temas generados.
examples/context_menu.py, panes.py, qr_code.py Menú contextual, paneles redimensionables y códigos QR.
examples/screenshots.py Regenera las imágenes de docs/screenshots.

Cómo funciona

Python                         Rust (pyzed._core, PyO3)                 Iced 0.14
App.view() ──► árbol de Widget ──► render.rs: Widget → iced::Element ──► layout + wgpu/tiny-skia
App.update() ◄── mensajes ◄────── app.rs: Message, Command → Task ◄──── eventos (ratón, teclado)
  • Los nodos Widget son objetos inmutables de Rust, así que construir la vista desde Python es barato.
  • El estado interno de cada editor (texto, cursor, deshacer) vive en Rust y se identifica por id.
  • El resaltado usa syntect (gramáticas de two-face) con los colores del tema de Pyzed.
  • El GIL se libera mientras corre el bucle de eventos, así que otros hilos de Python siguen funcionando.

Estado y limitaciones

Es la versión 0.2. Limitaciones conocidas:

  • pz.run() solo puede llamarse una vez por proceso (limitación de winit); usa pz.Window para más ventanas.
  • Con wrap=True, el editor numera la primera fila de cada línea ajustada, como Zed.

Licencia

MIT. Las fuentes incluidas son IBM Plex (SIL Open Font License) y Lucide (ISC); sus licencias están en assets/fonts. Los temas One, Ayu y Gruvbox vienen del repositorio de Zed (MIT); ver python/pyzed/zed_themes/LICENSE.

Metadata

Release files for pyzed-ui 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyzed-ui 0.3.0
File Size Uploaded Provenance
pyzed_ui-0.3.0.tar.gz 8.6 MB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for pyzed-ui 0.3.0
File
pyzed_ui-0.3.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
pyzed_ui-0.3.0-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details
pyzed_ui-0.3.0-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details
pyzed_ui-0.3.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
pyzed_ui-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 62.1 MB

Release files / pyzed_ui-0.3.0.tar.gz

Download URL pyzed_ui-0.3.0.tar.gz
Size 8.6 MB
Tags Source
SHA-256 checksum
How to use checksums
6ca66173ee294f61829ff184875ed9ab6a3cfd4d1e7204a8986c12ff3ff6280a
BLAKE2b-256 checksum
How to use checksums
3edccef7226e7c44746981670ba1880a65aab259e2d3a1491928015641534e97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / pyzed_ui-0.3.0-cp39-abi3-win_amd64.whl

Download URL pyzed_ui-0.3.0-cp39-abi3-win_amd64.whl
Size 10.5 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
868ae4fb74f9b7e1dca65e2f1e92e32bff0449d1f033ad27720874d42f69bdd3
BLAKE2b-256 checksum
How to use checksums
002d70b6a792179691b18ecf736f07aefd37ee1371e60a4ccbebbff089af9bbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / pyzed_ui-0.3.0-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL pyzed_ui-0.3.0-cp39-abi3-manylinux_2_28_x86_64.whl
Size 12.3 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
d3d57a885c599e40e9173dd5a132a71e0bf69ecbfcc6f65f44f464b1f0c8d2fc
BLAKE2b-256 checksum
How to use checksums
01281bb3daf3bb50d06bddd59ef6822e10d57be0021d653bd729e0156f55b452
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / pyzed_ui-0.3.0-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL pyzed_ui-0.3.0-cp39-abi3-manylinux_2_28_aarch64.whl
Size 11.9 MB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
40a6fbb3665ab8609dbac59bd51350b5f4206f4fc25d2b57b57292e9cd939558
BLAKE2b-256 checksum
How to use checksums
c77fce9883853bc2607d22151741690e8494b63c2292df41c00a1c0640601372
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / pyzed_ui-0.3.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL pyzed_ui-0.3.0-cp39-abi3-macosx_11_0_arm64.whl
Size 9.2 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f9c87799cc3c7f278c5ea81b94885129e3128cb8b4d75455f88a4a7f349c4c78
BLAKE2b-256 checksum
How to use checksums
4411cf849ceb2afef296b00962b232bd0a52f4567492b40315d801c27cc26f6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / pyzed_ui-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL pyzed_ui-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 9.5 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
194d40b23ec2b64d8ae3e868800117f4ab2c8d6fb7c7f8ff1cc6efc0de95e892
BLAKE2b-256 checksum
How to use checksums
79e761a382d18b901d9e5c66c695d88c00cfc63140019abe6c8ded54a7146caa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Security for pyzed-ui 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for pyzed_ui-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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