Skip to main content

A Python-first — Declarative-Mode — Backend-Agnostic — UI Library

Project description

CoshUI

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

CoshUI Logo

PyPI version Python License GitLab Docs

What is CoshUI?

CoshUI is a Python-first, declarative UI library inspired by CSS, Godot, 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

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")

To learn more, check out the examples 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coshui-0.3.2.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

coshui-0.3.2-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file coshui-0.3.2.tar.gz.

File metadata

  • Download URL: coshui-0.3.2.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for coshui-0.3.2.tar.gz
Algorithm Hash digest
SHA256 454a05009e6f3b45fb78a2fde37f494df1477a4bdf6909acbcf13bc6beef4ca2
MD5 ff4fd2b89fc0a1e8e96835f480a1834f
BLAKE2b-256 f53b0bb509686f9d1e764280d3c559716e5d2729c23f46bacd8bf6360aedd100

See more details on using hashes here.

File details

Details for the file coshui-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: coshui-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for coshui-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b93491adc7688bb6d948cc65d1890167485f5a996b3d34fd0c37c486ef0893f8
MD5 9094237366e02d4df90e5d55cdf9ef3e
BLAKE2b-256 dcb381b58e884138f56341930fdf78abf90ec43c208e2c0ef89f91318e11e8aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page