Skip to main content

CoshUI

The Python-first, Declarative-Mode, Backend Agnostic, UI Library.

CoshUI Logo

PyPI version Python License GitLab Docs

Table of Contents

What is CoshUI?

CoshUI is a Python-first, declarative UI library inspired by CSS, Godot, React, and Dear ImGui. Unlike most Python UI libraries, CoshUI is fully backend-agnostic — write your UI once and render it with Pygame, Raylib, ModernGL, or any backends you build or are supported.

CoshUI features:

  • Full layout engine with flexbox-inspired sizing
  • Retained-state reconciliation system
  • Tween animation with configurable easing
  • Signal-based event model
  • Theme system with class support
  • CoshML — a markup language for rich inline text styling
  • Built-in debugger with live node inspector and profiler
  • And more...

All within in a declarative API that's simple to pick up without sacrificing flexibility.

How to Install

pip install coshui

CoshUI is backend-agnostic — install with your renderer of choice:

# Pygame
pip install coshui[pygame]

# Raylib
pip install coshui[raylib]

# ModernGL
pip install coshui[moderngl] # or [moderngl-mglw]

# PyOpenGL
pip install coshui[pyopengl]

# All
pip install coshui[all]

How to Use and What it Renders (in Pygame)

CoshUI uses Python's context managers to define UI hierarchy through indentation — familiar if you've worked with HTML or CSS:

import coshui as cui

# Within your loop
with cui.CoshUIRenderer(...):
    with cui.Container(id="main_container", width=cui.FILL, height=cui.FILL, direction=cui.COLUMN, align=cui.ALIGN_CENTER, justify=cui.JUSTIFY_CENTER, gap=20):
        cui.Label(id="menu_label", text="CoshUI", width=200, height=50, font_size=64)
        cui.Button(id="print_btn", text="Print Hello World!", width=210)
        cui.Button(id="color_btn", text="Change Color!", width=210)

# Listen for signals
if cui.get_signal("print_btn", cui.CLICKED):
    print("Hello World!")

# Animate with one line
if cui.get_signal("color_btn", cui.CLICKED):
    cui.animate("background_color", "main_container", (200, 200, 200), 1.5, "ease_in_out")

gif of the top example rendering

To learn more, check out the examples in the repo or visit the documentation.

Documentation

CoshUI's documentation features the basic API coverage and all you need to know about how to use it. It can be viewed here.

Contributing

CoshUI is primarily developed on GitLab. Please open issues and pull requests there.

To learn more about how to contribute, check the contributing markdown.

Author

Main Developer and Maintainer: Jyle Frazier (Terra) Villareal

Contact

Metadata

Release files for coshui 0.3.3

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

Source distribution (sdist)

Source distribution for coshui 0.3.3
File Size Uploaded Provenance Actions
coshui-0.3.3.tar.gz 1.3 MB Without provenance Details for coshui-0.3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for coshui 0.3.3
File Interpreter ABI Platform Actions
coshui-0.3.3-py3-none-any.whl Python 3 none any Details for coshui-0.3.3-py3-none-any.whl

Total release size: 2.7 MB

Release files / coshui-0.3.3.tar.gz

Download URL coshui-0.3.3.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
d493bcbb849d966c0b2170e1c46f2b58c4da3f4dcd10de0b87a103af747d5393
BLAKE2b-256 checksum
How to use checksums
c65130e43163e62d8bf663c31e6478a3e3034c46b7f3674c0b75e42b0bd493e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / coshui-0.3.3-py3-none-any.whl

Download URL coshui-0.3.3-py3-none-any.whl
Size 1.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
4a02180beac610c8bd550341d4fbcc8db111aae1a9cf8708963bd49b953c52dc
BLAKE2b-256 checksum
How to use checksums
19b5c093765b2223ab4364c7c6c347b0e715581647decdbfbf7ec5934e2a8db9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for coshui 0.3.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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