Cxalio Rich UI component library — declarative structured document rendering for terminal applications.
Project description
cx-wealthy
语言 / Languages: 中文 | English (TODO)
基于 Rich 的终端结构化文档与 UI 组件库。
本包是 cx-wealth 的继任者,从头重新设计,修复了旧版的协议语义混淆、抽象覆盖缺口、封装泄漏等问题。
设计文档
完整的背景、设计意图、决策依据与功能规格见 DESIGN.md。
安装
uv add cx-wealthy
要求 Python >= 3.12, < 3.15。
主要模块
| 模块 | 能力 |
|---|---|
theme |
cx.* 命名空间主题样式预设(success / error / warning / info 等)。 |
rich_types |
对外的 Rich 高频类型便利出口。 |
label |
紧凑标签协议 RichLabelMixin + RichLabel 包装器。 |
detail |
详情键值面板协议 RichDetailMixin + WealthDetailPanel / WealthDetailTable。 |
document |
通用结构化文档核心:Node / Group / Note / WealthyDocument。 |
help |
帮助系统特化层:Action / WealthyHelp。 |
indexed_list |
带索引的列表面板 IndexedListPanel。 |
columns |
固定最大列数布局 MaxColumnsLayout。 |
tutorial |
本地化教程渲染 render_tutorial()。 |
基本用法
继承 mixin,让对象直接可被 Rich 渲染:
from cx_wealthy import RichLabelMixin
from rich.console import Console
console = Console()
class Mission(RichLabelMixin):
def __init__(self, name: str, target: str) -> None:
self.name = name
self.target = target
def __rich_label__(self):
yield "[bold]M[/]"
yield self.name
yield f"-> {self.target}"
console.print(Mission("encode", "output.mp4"))
使用声明式帮助系统:
from cx_wealthy.help import WealthyHelp, Action
help_doc = (
WealthyHelp(title="mytool")
.add_group("输入")
.add_action(Action(flags=["-i", "--input"], metavar="PATH", help="输入文件路径"))
.add_group("输出")
.add_action(Action(flags=["-o", "--output"], metavar="PATH", help="输出文件路径"))
)
help_doc.render()
与 cx-wealth 的关系
cx-wealthy 是 cx-wealth 的继任者,二者在迁移期内共存于 monorepo。
cx-wealthy 从头重新设计,修复了旧版在协议语义、抽象覆盖、封装泄漏等方面的问题;
cxalio-studio-tools 将逐步从 cx-wealth 切换到 cx-wealthy。
迁移完成后,cx-wealth 将从 workspace 移除并停止维护。
返回项目首页
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cx_wealthy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cx_wealthy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e7196cfe17262be2104c5de82e857b40680408cb37ba9e5b7b4d21f31eb3fec
|
|
| MD5 |
083232268c28b55b79b9432c6a907566
|
|
| BLAKE2b-256 |
bdd57e158690c0fd771cef331445ff6e24b6cf36c1360607a7c986da34b46697
|