Add your description here
Project description
raytoolsbox
一个不断进化的 个人 Python 工具合集(Toolbox)。
包含常用开发工具、实用脚本、个人算法、桌面应用助手、Web 小工具等。
项目以 模块化、可扩展、易维护 为目标,为日常开发与个人项目提供稳定的工具支持。
✨ 特性(Features)
-
📧 邮件工具 简洁易用的邮件发送函数,支持 QQ、Gmail 等多种 SMTP 服务,自动读取本地或用户目录的配置文件,自动处理 SSL、中文昵称等问题。
-
🔐 现代化加密工具 使用 X25519 密钥交换 + ChaCha20-Poly1305 对称加密 + Ed25519 数字签名,支持文本、字节和文件的加密解密与签名验签。
-
⏱️ 性能监控工具 简易性能计时函数
make_timer()与内存监控函数make_memory_monitor(), 以及完整 benchmark 测试工具to_test_func(),适合代码性能分析和调试。 -
🖥️ 窗口工具 Tkinter 窗口居中显示函数,兼容任意尺寸窗口。
-
📁 资源路径工具 自动获取应用资源路径,兼容 PyInstaller 打包环境。
-
⚡ 子进程/子线程执行器
run_in_subprocess()和run_in_subthread()支持超时控制与异常透传,适合隔离危险操作或限制执行时间。 -
🧰 更多工具持续加入中……
📦 安装(Installation)
使用 uv(推荐)
uv add raytoolsbox
使用 pip
pip install raytoolsbox
🚀 快速开始(Quick Start)
from raytoolsbox.utils.mailToPhone import send_email
from raytoolsbox.utils.monitor_func import make_timer
from raytoolsbox.security.crypto_manager import CryptoManager
# 邮件发送
send_email(
subject="测试邮件",
content="<h1>Hello World</h1>",
to_addr="receiver@example.com",
serverName="Ray",
use_smtp="qq"
)
# 性能计时
tt = make_timer()
tt("开始任务")
# ... 执行代码 ...
tt("任务完成")
# 窗口居中
from raytoolsbox.utils.useful_func import center_window
center_window(window, 800, 600)
# 子进程执行(超时控制)
from raytoolsbox.utils.useful_func import run_in_subprocess, run_in_subthread
result = run_in_subthread(str.upper, "hello") # "HELLO"
result = run_in_subprocess(_add, 40, 2) # 42(函数需可 pickle)
# 加密解密
cm = CryptoManager(key_dir="./keys", PIN="your_password")
cm.generate_keys() # 生成密钥
encrypted = cm.encrypt("Hello", pubkey)
decrypted = cm.decrypt(encrypted)
# 数字签名
signed = cm.sign("重要数据", sign_key)
verified = cm.verify(signed, verify_key)
📂 目录结构(Project Layout)
raytoolsbox/
│
├── pyproject.toml # 项目信息 + 依赖管理(uv)
├── README.md # 项目文档
├── src/
│ └── raytoolsbox/
│ ├── __init__.py
│ ├── utils/
│ │ ├── __init__.py
│ │ ├── useful_func.py # 资源路径、窗口居中、子进程/子线程执行器
│ │ ├── mailToPhone.py # 邮件发送工具
│ │ └── monitor_func.py # 性能计时器、内存监控、benchmark 测试
│ └── security/
│ ├── __init__.py
│ ├── crypto_manager.py # ECC 加密/签名工具
│ ├── authenticator.py
│ └── pin_manager.py
│
└── tests/
├── test_authenticator.py # TOTP 认证测试
├── test_crypto_manager.py # 加密/签名 + fuzz 测试
├── test_mail_to_phone.py # 邮件发送测试
├── test_monitor_func.py # 性能监控测试
├── test_pin_manager.py # PIN 管理测试
└── test_useful_func.py # 路径/窗口/子进程工具测试
🧪 测试(Testing)
本项目使用 pytest:
uv run pytest
全部测试应通过:
58 passed
🛠️ 开发路线图(Roadmap)
已完成
- 邮件发送工具封装(支持多 SMTP 服务)
- 可本地覆盖的配置系统
- pytest 自动化测试(mock 网络发送)
- 现代化加密模块(X25519 + ChaCha20-Poly1305 + Ed25519)
- 数字签名与验签功能
- 计时工具
- 窗口居中工具
- 资源路径获取(PyInstaller 兼容)
开发中 / 计划中
- 屏幕工具(DPI、尺寸测量)
- Tkinter / PySide6 GUI 工具类
- 文件操作工具(临时文件、下载器)
- 日期工具、定时工具、任务提醒系统
- 扩展 CLI(命令行使用工具箱)
如果你有想加入的功能欢迎告诉我!
🤝 贡献(Contributing)
欢迎 Issue 或 PR!
可提交:
- Bug 报告
- 新功能建议
- 工具模块
- 文档改进
📄 License
使用 MIT License,自由商用/修改/发布。
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
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 raytoolsbox-2.0.1.tar.gz.
File metadata
- Download URL: raytoolsbox-2.0.1.tar.gz
- Upload date:
- Size: 182.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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 |
f0184a21867d66c149e2c4b9db020bf7907602052c6b5f2f526da039f9fff675
|
|
| MD5 |
f3043ab2fb1149b586313c5e2743daea
|
|
| BLAKE2b-256 |
3ffd0e2bf558c0c289a69e5dc21ee7a3dbcfb99af4dd2d9bd3a68c80b85f4086
|
File details
Details for the file raytoolsbox-2.0.1-py3-none-any.whl.
File metadata
- Download URL: raytoolsbox-2.0.1-py3-none-any.whl
- Upload date:
- Size: 22.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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 |
8029eda8c74075b58125da4695b9910958c744187482dd99c46c68aea7724966
|
|
| MD5 |
5d9425874415f905dd6be3f0b39c4551
|
|
| BLAKE2b-256 |
831594a91605c4dd33bbda56c9e06c13a2d1665f596f9f38826bf03e1d05c6b1
|