A simple update checker and logger for your Python application
Project description
Supdater
通用软件更新检测与日志上报 SDK,基于 PocketBase 后端,框架无关。
适用于 tkinter、PyQt/PySide、Kivy、命令行工具等任何 Python 项目。
功能
- 🔍 版本检测 — 从 PocketBase 拉取最新版本信息,对比本地版本
- 📤 日志上报 — 自动上报启动日志、错误日志、心跳等使用数据
- 🧵 非阻塞 — 所有网络操作支持异步模式,不卡 UI
- 🖥️ GUI 集成 — 内置 tkinter 版本标签组件,PyQt 示例
- 🪶 零依赖 — 仅使用 Python 标准库
安装
pip install supdater
快速开始
from supdater import Supdater
# 1. 初始化
sup = Supdater(
base_url="https://your-pocketbase.com",
soft_id="your_soft_record_id",
app_version="1.0.0",
)
# 2. 启动时上报日志
sup.send_log_async("startup")
# 3. 后台检查更新
def on_version(info):
if info.version != sup.app_version:
print(f"发现新版本: {info.version}")
print(f"更新内容: {info.updatelog}")
sup.check_update_async(callback=on_version)
API 参考
版本检查
# 同步检查(阻塞)
has_update, info = sup.check_update()
if has_update:
print(f"新版本: {info.version}")
# 异步检查(不阻塞,推荐)
sup.check_update_async(callback=on_version)
# 仅拉取远程信息
info = sup.fetch_remote_version()
日志上报
# 启动日志
sup.send_log_async("startup")
# 错误日志(附带元数据)
import json
sup.send_log_async("error", meta=json.dumps({"msg": "除以零"}))
# 同步发送(获取返回值)
result = sup.send_log("startup")
tkinter 集成
import tkinter as tk
root = tk.Tk()
version_widget = sup.create_tk_widget(root, bg="#f0f0f0")
version_widget.pack(side=tk.BOTTOM, anchor=tk.E)
root.mainloop()
PocketBase 数据结构
| 表名 | 用途 | 关键字段 |
|---|---|---|
softs |
软件信息 | name, version(关联 versions) |
versions |
版本记录 | version, updatelog, download |
logs |
使用日志 | relation(关联 softs), type, version, platform, ipaddr, meta |
许可
MIT License
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 Distribution
supdater-0.1.0.tar.gz
(6.5 kB
view details)
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 supdater-0.1.0.tar.gz.
File metadata
- Download URL: supdater-0.1.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","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 |
f0eb9663533be3e11c606ae81cf224c118b05b4bc5f78a846d07313ee70cf61b
|
|
| MD5 |
03bd293d00720dc672312334e792d223
|
|
| BLAKE2b-256 |
310ffdfbb4b41a6a08607ce3104db78a48b66e906f6612733fb861f14247f342
|
File details
Details for the file supdater-0.1.0-py3-none-any.whl.
File metadata
- Download URL: supdater-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","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 |
e2452ff4ffddd51032e54d23f417481ba629a2d8fce75fd766c30cd1d4b047b6
|
|
| MD5 |
8d7155060049ec0ceefb850741b33108
|
|
| BLAKE2b-256 |
0df1f936b2f721eb47e673fbe8051cd7770cfc39d4c497c44cc297990d339f17
|