Pysual
Python interfaces for Window, Terminal, and Web.
Assign controls, change their properties, and name event handlers. The same application runs in a native window, a terminal, or an SVG browser interface. Python 3.11+. MIT licensed. Early development; APIs may change.
See the 0.1.2 release notes for fixes and supported scope.
Install
A published release installs with pip. Python 3.11 or newer:
python -m pip install pysual
Windows x64, Linux x64, and Apple Silicon wheels include the native window host and the SDL libraries it needs. Other platforms receive the pure-Python wheel, whose Python terminal and web backends are ready to use. Building a window host for another platform is described in building.
Start in a browser
git clone https://github.com/PabloMP2P/Pysual.git
cd Pysual
python -m venv .venv
# Activate .venv using your shell, then:
python -m pip install -e '.[dev,build]'
python examples/hello.py --backend web
Activate with .venv\Scripts\Activate.ps1 in PowerShell or
source .venv/bin/activate on macOS/Linux. The live Web host and Python terminal
renderer need no graphics packages or C compiler. For library-only installation,
use python -m pip install ..
python examples/hello.py --backend terminal --terminal python
python -m pysual native
python examples/hello.py --backend window
The native builder finds a C compiler and provisions checksum-pinned SDL
development packages on Windows. Linux/macOS require a C11 compiler,
pkg-config, SDL3, SDL3_ttf, and SDL3_image development libraries.
See building for compiler and platform details.
Write an application
from pysual import App, Button, Label
class Hello(App):
def build(self):
self.title = "Hello"
self.layout, self.padding, self.spacing = "stack", 24, 12
self.message = Label(text="Ready")
self.greet = Button(text="Say hello")
def greet_on_click(self, event):
self.message.text = "Hello, Pysual!"
Hello().run_blocking(backend="web")
Assignment adopts and names each control; greet_on_click binds automatically.
Names must not collide with existing members: the factory names label,
button, image, slider, menu and the other snake-case control names are
taken, so prefer descriptive names such as message or save_button
(a BindingError names the conflict). Handlers can be synchronous or async def. Properties and public methods route
to the UI owner automatically. run() returns after the first frame for REPLs
and scripts doing other work; wait() waits for closure. run_blocking() combines
the two. Import pysual.autoconfig before creating controls to enable
--backend, --terminal, --pysual-theme, and --pysual-scale in your own script.
Three backends
| Backend | Runtime | Distribution |
|---|---|---|
window |
Standalone C renderer with SDL3, text, images, effects, retained scenes, and native animations | Executable for the build machine's OS and architecture |
terminal |
C character renderer; auto, c, or python renderer selection |
Executable, including a Python-only option requiring no C build |
web |
SVG with local Python when served; Python in Pyodide when bundled | One HTML file embedding the application, fonts, and runtime |
Terminal auto prefers an available C host and falls back to Python when it
cannot start. Choose --terminal c to require C, or --terminal python for a
dependency-free renderer. Terminal typography follows the emulator's cell grid.
python -m pysual examples/hello.py --backend window -o dist/hello.exe
python -m pysual examples/hello.py --backend terminal --terminal python -o dist/hello-terminal.exe
python -m pysual examples/hello.py --backend web -o dist/hello.html
Use extensionless executable names on Linux/macOS. Build on each target OS;
these commands do not cross-compile. Outside a checkout the same commands are
pysual build … (or python -m pysual build …) after pip install. Web builds fetch a checksum-pinned Pyodide
runtime once; --runtime PATH makes subsequent builds fully local. Serve the
bundled HTML from a static HTTP host. Application handlers remain Python and
need no application Python server. See Web delivery.
Included
- 43 catalog controls: editable grids, virtual lists/trees, tabs, menus, dialogs, text and value editors, charts, range selection, navigation, choice cards, disclosure groups, badges, actionable alerts, meters, and progress.
- Five layout modes, nine theme families in light and dark (18 themes), 44 icons, bundled fonts, shadows, gradients, surfaces, interaction motion, and custom painting.
- Unicode text editing, selection, clipboard where supported, undo/redo, async events, drag/drop, and batched property updates.
- Retained rendering, bounded caches, on-demand frames, and incremental native scene updates.
| Example | What it demonstrates |
|---|---|
| hello.py | Automatic binding, text input, async events |
| dashboard.py | Editable data, filtering, charts |
| showcase.py | Controls, themes, layout, effects |
| theme_gallery.py | An interactive control studio with all nine theme families, light/dark switching, and desktop-inspired materials |
| stress_test.py | Configurable control mixes, workloads, timing, and JSON reports |
| custom_control.py | Observable properties and portable drawing |
| composite_control.py | Reusable compound controls with independent child state and handlers |
| catalog_controls.py | Thirteen catalog ideas in a responsive review workspace with collapsible filters, review plans, status feedback, and live theme switching |
Choose Modern, Windows, macOS, Terminal, Win31, WinXP, Macintosh, Analog arcade, or Neon. Each has a light and dark version with its own control surfaces, typography, borders, and interaction states. Preview them with:
python examples/theme_gallery.py --backend web
See the rendered comparison of all 18 appearances.
Use get_theme("winxp") for light and get_theme("winxp_dark") for dark.
See themes and custom painting for the
complete catalog and compatibility details.
Stress test
The stress lab mixes 20 control types, including grids, trees, charts, images, and editors. Choose balanced, text, forms, visual, or collections scenes, with presets from 100 to 5,000 controls or an exact count up to 20,000. It opens on the large preset with continuous redraw and VSync off.
python examples/stress_test.py --backend window --controls 2000 --mix balanced --workload local-update
python examples/stress_test.py --backend terminal --terminal python --controls 100 --mix forms
python examples/stress_test.py --backend web --mix visual
python examples/stress_test.py --controls 500 --workload property --fraction 0.25 --rate 60 --warmup 2 --duration 10 --report work/stress.json
Changing a preset or another dashboard control applies it immediately. Pause,
restart measurements, or export a JSON report from the same bar. --help lists
the control mixes and rendering options. Timed runs
measure --duration seconds after warmup. Use the same seed, viewport, theme,
workload, and rendering settings when comparing runs.
Workloads cover idle scenes, paint invalidation, layout changes, property updates, and one-control updates. Rendering options include the presentation cap, redraw interval, VSync, body reuse, and surface-cache budget.
Python submission rates, native presentation loops, and terminal output counters
are reported separately. These do not measure physical screen refresh or browser
paint. Live metrics refresh at 4 Hz by default and add work to a static scene;
pass --no-telemetry to leave them on demand. Collection rows and chart points
are counted separately from widgets.
Develop
Style and commit conventions are in Contributing.
python -m pytest
python tools/check_typing.py
After changing control properties, run python tools/generate_factory_types.py
to refresh the factory typing signatures. Add --check to verify them without
writing changes; the generator needs only the Python standard library.
For new controls, see control composition and catalog development.
The full test suite requires Node.js 24 for the Web JavaScript contracts. Native tests require a built host and report explicit skips otherwise. CI builds and checks the native implementation separately. Applications need no Node.js or npm project.
API guide · Native rendering · Building · Web · Contributing
Controls are custom drawn. OS accessibility bridges, complex-script shaping, full font fallback, mobile hosts, and OS-level modality between separate native processes are outside this release's supported scope. Real display, terminal, clipboard, IME, and packaged-app behavior should be checked on the target system.
Metadata
Release files for pysual 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pysual-0.1.2.tar.gz | 3.4 MB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pysual-0.1.2-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| pysual-0.1.2-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 | Details |
| pysual-0.1.2-py3-none-macosx_26_0_arm64.whl | Python 3 | none | macOS 26.0+ ARM64 | Details |
| pysual-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.3 MB
Release files / pysual-0.1.2.tar.gz
| Download URL | pysual-0.1.2.tar.gz |
|---|---|
| Size | 3.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
893bc8c4b880b96dea83b2fa58706cedb9b376564ee55ace4659b839f0cfc0f9
|
|
BLAKE2b-256 checksum How to use checksums |
72118685c6ec717bc05741aa8da74be9eb7cfbc6de4bddfddb9d3702ee8a92c9
|
| 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 16, 2026.
Transparency logRelease files / pysual-0.1.2-py3-none-win_amd64.whl
| Download URL | pysual-0.1.2-py3-none-win_amd64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b33d879ef145732e653bb186e81cf06840a29b1ddbbda4e04aac4439f69f2b39
|
|
BLAKE2b-256 checksum How to use checksums |
779f680d859845cb6e56a9e836f998648b62bec2ea6c2e009ca9ede400bd823d
|
| 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 16, 2026.
Transparency logRelease files / pysual-0.1.2-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pysual-0.1.2-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.2 MB |
| Tags | Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
9dff3e3f035120617bcba2faea54be2bff3675c18de878125738362bd01e65e6
|
|
BLAKE2b-256 checksum How to use checksums |
61f817e43200af452d8ef1a8194f20a49a3967f66e7b00bd0b36b7d54bb13324
|
| 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 16, 2026.
Transparency logRelease files / pysual-0.1.2-py3-none-macosx_26_0_arm64.whl
| Download URL | pysual-0.1.2-py3-none-macosx_26_0_arm64.whl |
|---|---|
| Size | 4.0 MB |
| Tags | Python 3 macOS 26.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1682f4b279c2026159ba03382801326af5eab3f060d397ace0487cb31104b711
|
|
BLAKE2b-256 checksum How to use checksums |
72b376260eb70a34081a1861c9c6ba8b213b9cb6bb67f8429dd3de4f55d1c109
|
| 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 16, 2026.
Transparency logRelease files / pysual-0.1.2-py3-none-any.whl
| Download URL | pysual-0.1.2-py3-none-any.whl |
|---|---|
| Size | 1.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6f2cb3273a0f944da97a9b7693c72fb883517f9305563548fa6d1e26ef93b5d6
|
|
BLAKE2b-256 checksum How to use checksums |
5c5102ff7ef574208531af21599e296530c90e568b6fa1475554ec030041a691
|
| 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 16, 2026.
Transparency log