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

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.

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/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.2.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.2.0
File Size Uploaded Provenance
pyzed_ui-0.2.0.tar.gz 7.8 MB With provenance Details

Built distributions (wheels)

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

Total release size: 60.8 MB

Release files / pyzed_ui-0.2.0.tar.gz

Download URL pyzed_ui-0.2.0.tar.gz
Size 7.8 MB
Tags Source
SHA-256 checksum
How to use checksums
c2aab8299b4d425c755ad9239c243bd521cf95c1da01d18ea6cc39dac45b4458
BLAKE2b-256 checksum
How to use checksums
5254cc4cb1e4c43b31c49f213021705ac0eacb91521ad6eaa27917d23af891c9
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.2.0-cp39-abi3-win_amd64.whl

Download URL pyzed_ui-0.2.0-cp39-abi3-win_amd64.whl
Size 10.4 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
653fcee4db4c82027305268b89391bb46585e08106d7a664f181f0695cf67809
BLAKE2b-256 checksum
How to use checksums
7c8cddf34b418aae2e97544fcc4dcb3883e7a21e9672f8bf278df405a4ce965f
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.2.0-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL pyzed_ui-0.2.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
9c8c331ba11fb4d4473dc6b4326e528e9e45ad9fe62d006927e0b0cb4a5d7369
BLAKE2b-256 checksum
How to use checksums
0d9271d677a0d1e1bd211449172d2409cd32a9e7d49abd1642bdf42861285a0e
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.2.0-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL pyzed_ui-0.2.0-cp39-abi3-manylinux_2_28_aarch64.whl
Size 11.8 MB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
e11c3574c9cb588acc0a581d57db84057daa0ec24c47bd8d0e6603007c1cc26a
BLAKE2b-256 checksum
How to use checksums
ddf6e7ee216032f745af76864fb80198de61e27f6399442aaf6f6c900fe3d02a
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.2.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL pyzed_ui-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
Size 9.1 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1ea4bef61cce6e91ed6e9986d50605f741739e1dbd11a71049e6fce3a99b8579
BLAKE2b-256 checksum
How to use checksums
758a6b8c586b7108a82b520d257672c73754dc6650034a7c348565726df06c3f
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.2.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL pyzed_ui-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 9.4 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
98869850248aa180064ce2ac7e003eec414c790c3faa187ac099775ebeedcf66
BLAKE2b-256 checksum
How to use checksums
2539bea86bb1be59efb2569c58a7e4c4a48601129c2cc9f800b4678c72671128
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.2.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.2.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