Skip to main content

cx-wealth

⚠️ 已弃用 / DEPRECATED

本包自 v0.9.0 起正式弃用,不再接收新功能或维护更新。

请迁移至 cx-wealthy —— 全新设计的 Rich UI 组件库,不依赖 cx-studio,更轻量、更灵活。

This package is deprecated since v0.9.0. No further updates will be provided. Please migrate to cx-wealthy instead.

语言 / Languages: 中文 | English

基于 Rich 的终端 UI 组件库,为 CLI 应用提供声明式帮助系统、标签渲染、详情面板和自适应布局等扩展。

安装

pip install cx-wealth

要求 Python >= 3.12, < 3.15。

组件

WealthHelp — 声明式帮助系统 DSL

替代 argparse 的原生帮助输出。通过 add_group / add_action / add_note 构建结构化帮助信息,支持 Rich 样式的主题化输出。

from cx_wealth import WealthHelp

help = WealthHelp(prog="myapp", description="My CLI tool")
help.add_action("--input", help="Input file path", nargs=1)
help.add_action("--output", help="Output file path", nargs=1)
help.add_group("Advanced", description="Advanced options")
help.add_note("See docs for more details.")

WealthLabel — 可组合标签渲染

将实现了 __rich_label__() 协议的对象渲染为带 Markup 和样式的紧凑文本行。支持 crop、ellipsis、fold 三种溢出处理方式,可自定义分隔符。

from cx_wealth import WealthLabelMixin

class MyItem(WealthLabelMixin):
    def __rich_label__(self):
        yield "[bold]MyItem[/]"
        yield "status: active"
        yield "[green]●[/]"

WealthDetail / WealthDetailPanel — 详情展示

将实现了 __rich_detail__() 协议的对象渲染为两列键值表格。支持子面板嵌套和 Rich 样式。

IndexedListPanel — 索引列表

在 Rich Panel 中显示带行号索引的列表。支持起始索引、最大行数控制(超出显示省略号)、边框样式自定义。

from cx_wealth import IndexedListPanel

panel = IndexedListPanel(items=["a", "b", "c"], title="Files")

DynamicColumns — 自适应多列布局

根据终端宽度自动计算列数和列宽,将对象集合渲染为多列布局。

链接

返回项目首页:cx-studio-tk

Metadata

Release files for cx-wealth 0.9.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 cx-wealth 0.9.0
File Size Uploaded
cx_wealth-0.9.0.tar.gz 14.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cx-wealth 0.9.0
File Interpreter ABI Platform
cx_wealth-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 31.0 kB

Release files / cx_wealth-0.9.0.tar.gz

Download URL cx_wealth-0.9.0.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
dac5bff7c2eebf6edb705fcf95b468c4bfb5a0020711308bdc7f58cce6c8caa9
BLAKE2b-256 checksum
How to use checksums
4d16b6297efff1dd8aad608dfdccd275415453d4c04d296a6dd5be8696e7dba8
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / cx_wealth-0.9.0-py3-none-any.whl

Download URL cx_wealth-0.9.0-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73975e732a7394047d9a7990dd00ca71fbc303221cad301881340d0178c45acb
BLAKE2b-256 checksum
How to use checksums
22f9fc60fed8a609c087baa60292a3edd8b01f9c3dbd02e0a672ec0136194ccb
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 release files

0.7.5

2 release files

0.7.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

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