Skip to main content

psi6

给编码 Agent 用的轻量 PySide6 桌面框架。它把应用生命周期、后台任务、Python 主题和通用窗壳收成一套稳定入口。业务窗口留在应用自己的代码里,控件库不塞进框架入口。

安装

pip install psi6

三个最短用法

普通窗口:

from psi6 import App, DesktopWindow

app = App("demo")
window = DesktopWindow(title="Demo")  # 默认 Qt 标题栏;frameless=True 才自绘
raise SystemExit(app.run(window))

后台任务。界面只展示,执行在 TaskRunner。关掉窗口不会取消任务;应用退出时才会取消并等待线程结束。

handle = app.runner.submit(run_job, on_succeeded=show_rows, on_failed=show_error)
handle.cancel()

run_job 用 on_progress、on_log、is_cancelled。失败信息在 on_failed 和 TaskHandle.error_message。没有指定进度位置时,把 StatusProgress 放进 window.statusBar()。开始和取消是页面上分开的按钮。

自定义主题。字段名必须是 Tokens 的字段,写错会在加载时抛错。对比度不足只作为诊断,不阻止加载。

from psi6 import Theme, contrast_notes

class Midnight(Theme):
    name = "midnight"
    base = "dark"
    style = "compact"
    color_primary = "#4F46E5"
    radius = 8

app = App("demo", theme=Midnight)
contrast_notes(app.tokens)

与主题模块同目录的 icons/search.svg 会覆盖同名图标,路径不看当前工作目录。

默认行为

默认可以同时启动多份,也不写窗口位置。单实例锁只在显式打开时存在,退出时也只在那时释放。

app.run(window, tray=True, single_instance=True, restore_geometry=True)

配置文件损坏时使用模型默认值。窗口几何损坏时保持调用方给的尺寸,应用仍能启动。系统没有托盘时,tray=True 不阻止窗口关闭和进程退出。

稳定接口

0.4 的根包只导出这些名字,名单在 src/psi6/api.py:App、TaskRunner、TaskHandle、TaskStatus、JobOutcome、Theme、Tokens、contrast_notes、DesktopWindow、TitleBar、TrayIcon。

DesktopWindow 默认使用 Qt 标题栏。frameless=True 才自绘标题栏。TaskRunner 执行任务。cancel() 只是请求,结束看 TaskHandle.status。JobOutcome 只表示要填进表的结果。其它控件从 psi6.ui 导入。名字以 _ 开头的模块是内部实现。迁移见 MIGRATION.md,破坏性变更写在 CHANGELOG.md。

安装后核对示例:

python -m psi6.examples.minimal --check
python -m psi6.examples.task_job --check
python -m psi6.examples.custom_theme --check
python -m psi6.examples.task_status --check

组件预览:python -m psi6 kit,按组件分组,可切换四种组合,另附 Mono、Obsidian、Pine 内置主题。Agent 约定:skills/psi6-desktop/SKILL.md。新项目复制 skills/psi6-desktop/template/,在该目录执行 python app.py --check。关窗口、点取消、应用退出是三件事。

开发

uv sync --extra dev
uv run pytest

Metadata

Release files for psi6 0.4.1

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

Source distribution (sdist)

Source distribution for psi6 0.4.1
File Size Uploaded Provenance Actions
psi6-0.4.1.tar.gz 97.1 kB Without provenance Details for psi6-0.4.1.tar.gz

Built distribution (wheel)

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

Total release size: 254.7 kB

Release files / psi6-0.4.1.tar.gz

Download URL psi6-0.4.1.tar.gz
Size 97.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f42e17582df7ba8eb9e2a82fe0d9420a0d7813fdd96f719b223c47153e50a97b
BLAKE2b-256 checksum
How to use checksums
761721ac1b43c4dd6aa62dbec586e5f1fae70870f5e4060fc80ba79be5b4fe79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","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 / psi6-0.4.1-py3-none-any.whl

Download URL psi6-0.4.1-py3-none-any.whl
Size 157.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a32e07fcd8d69b7b54667601ffa56e8d2784c797134d647c8e924ad11b6b6a0
BLAKE2b-256 checksum
How to use checksums
93d62de6babbb5e7c0077a4fbf312d9ac74dd732f9c04d212419c789e731c8af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","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}

Security for psi6 0.4.1

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