Skip to main content

Lanyora

一个用于快速开发 Python 工具的轻量级工具库。

Lanyora 提供了一系列常用工具、装饰器以及 YoraGUI 框架,帮助开发者快速将命令行脚本封装为可视化桌面工具。


安装

pip install lanyora

核心模块

YoraGUI

YoraGUI 是 Lanyora 的核心组件。

它可以将普通 Python 函数快速封装为图形界面,无需编写大量 Tkinter 代码。

适用于:

  • 数据处理工具
  • Excel 自动化工具
  • 测试辅助工具
  • 文件转换工具
  • 个人效率工具

示例:10 行代码创建 GUI

from lanyora.yoragui import YoraGUI

gui = YoraGUI(title="Hello YoraGUI")

@gui.button("点击我")
def hello(app):
    app.alert("Hello World!")

gui.run()

配置管理

gui.define_ctx(
    "username",
    "Lanyu",
    label="用户名"
)

gui.define_ctx(
    "output_dir",
    "",
    label="输出目录",
    value_type=ContextValueType.DIRECTORY
)

自动生成设置界面,无需手动创建表单。


支持功能

  • 按钮自动注册
  • 分组按钮面板
  • 配置管理系统
  • 文件选择器
  • 目录选择器
  • 下拉选择框
  • 日志输出窗口
  • 表格展示
  • 文本展示
  • 异步任务执行
  • UI线程安全调用

其他工具

装饰器

from lanyora import timer

@timer
def my_function():
    pass

支持:

  • timer
  • retry
  • timeout(规划中)

工具函数

from lanyora import random_password

提供:

  • 随机密码生成
  • 浏览器快速打开
  • 控制台提示工具

项目结构

lanyora
├─ decorators
├─ utils
├─ ev
└─ yoragui

版本历史

[0.5.2] - 2026-06

Fixed

  • TextWidget 长文本滚动支持(Label → Text + Scrollbar)

[0.5.0] - 2026-06

Added

  • open_web(url) — 从 GUI 打开浏览器链接(线程安全)
  • set_background(image_path) — 空视图背景图片(支持 Pillow 缩放)
  • 对话框 initialdir 参数

Fixed

  • 异步任务中对话框崩溃(线程安全调度器)
  • PrintCapture 缺少 isatty() 等方法
  • tqdm 改为可选依赖

[0.4.0] - 2026-06

第二代 YoraGUI 重构版本。

Added

  • ContextManager 重构
  • ButtonPanel 独立组件
  • Widget 模块拆分
  • FILE 类型配置项
  • DIRECTORY 类型配置项
  • 异步任务支持
  • UI事件队列机制
  • 表格组件优化

Changed

  • YoraGUI 从单文件架构升级为模块化架构
  • 配置系统全面重构
  • 示例代码迁移至独立测试文件

[0.3.0] - 2026-05

Added

  • 初版 YoraGUI
  • CLI 脚本快速 GUI 化支持

[0.2.0] - 2026-03

Added

  • ev 模块
  • 基础倒排索引实现

许可证

MIT License

Metadata

Release files for lanyora 0.5.2

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

Source distribution (sdist)

Source distribution for lanyora 0.5.2
File Size Uploaded Provenance Actions
lanyora-0.5.2.tar.gz 21.7 kB Without provenance Details for lanyora-0.5.2.tar.gz

Built distribution (wheel)

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

Total release size: 43.2 kB

Release files / lanyora-0.5.2.tar.gz

Download URL lanyora-0.5.2.tar.gz
Size 21.7 kB
Tags Source
SHA-256 checksum
How to use checksums
146c558e1f9cfe41d099ea65204e35e19a7f97d3df9f76133464815601ecd341
BLAKE2b-256 checksum
How to use checksums
612a10b246cf63dbc4a3727ab8545b2c215aba15c82c09b1fa5da85429613181
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / lanyora-0.5.2-py3-none-any.whl

Download URL lanyora-0.5.2-py3-none-any.whl
Size 21.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50c302ee7a4adc472e4bf391dea2d9d74371daec8d1dfc9be13bf54b177d3e63
BLAKE2b-256 checksum
How to use checksums
06076df7e8beee95015d2d2cade066b05887c5d735344fe330794366836c183e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for lanyora 0.5.2

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