build: 使用 uv 包管理器

This commit is contained in:
2026-01-09 00:47:34 +08:00
parent 5b1a627ddb
commit 016ae16100
12 changed files with 886 additions and 67 deletions

View File

@@ -1,7 +1,19 @@
prompt = """HeurAMS 已经被成功地安装在系统中.
# __main__.py
def main():
prompt = """HeurAMS 已经被成功地安装在系统中.
但 HeurAMS 被设计为一个带有辅助记忆调度器功能的软件包, 无法直接被执行, 但可被其他 Python 程序调用.
若您想启动内置的基本用户界面,
若您想启动内置的基本用户界面:
请运行 python -m heurams.interface,
或者 python -m heurams.interface.__main__
python 代指您使用的解释器, 在某些发行版中可能是 python3, 而 python 命令被指向了 python2.
尽管项目保留了 requirements.txt, 我们仍不推荐使用系统 python 和原始 venv 进行开发.
项目的推荐开发环境工具是 uv.
如果你的环境已经安装了 uv:
先运行 uv sync 同步环境, 此命令只需要执行一遍, uv 会自动处理依赖.
通过运行 uv run tui 启动内置基本用户界面.
此时您的解释器在项目目录里的 .venv/bin 中, 使用 IDE 开发前, 务必切换解释器!
注意: 一个常见的误区是, 执行 interface 下的 __main__.py 运行基本用户界面, 这会导致 Python 上下文环境异常, 请不要这样做."""
print(prompt)
print(prompt)
if __name__ == "__main__":
main()

View File

@@ -12,7 +12,9 @@ from .screens.repocreator import RepoCreatorScreen
logger = get_logger(__name__)
app = HeurAMSApp()
def main():
app = HeurAMSApp()
app.run()
if __name__ == "__main__":
app.run()
main()

View File

@@ -50,7 +50,7 @@ class DashboardScreen(Screen):
yield ScrollableContainer(
Label('欢迎使用 "潜进" 启发式辅助记忆调度器', classes="title-label"),
Label(
f"当前 UNIX 日时间戳: {timer.get_daystamp()} (UTC+{config_var.get()["timezone_offset"] / 3600})"
f"当前 UNIX 日时间戳: {timer.get_daystamp()} (UTC+{config_var.get()['timezone_offset'] / 3600})"
),
Label(f"全局算法设置: {config_var.get()['algorithm']['default']}"),
Label("选择待学习或待修改的项目:", classes="title-label"),
@@ -90,7 +90,7 @@ class DashboardScreen(Screen):
if is_unfinished:
nextdate = min(nextdate, timer.get_daystamp())
need_to_study = is_due or is_unfinished
prompt = f"{title}\0\n 进度: {activated_sum}/{unit_sum} ({round(activated_sum/unit_sum*100)}%)\n {"需要学习" if need_to_study else "无需操作"}"
prompt = f"{title}\0\n 进度: {activated_sum}/{unit_sum} ({round(activated_sum/unit_sum*100)}%)\n {'需要学习' if need_to_study else '无需操作'}"
stat = {
"is_due": is_due,
"unit_sum": unit_sum,

View File

@@ -1,20 +0,0 @@
"""vfs.py
得益于 FSSpec, 无需实现大部分虚拟文件系统的 Providers
"""
from pathlib import Path
import fsspec as fs
class VFSObject:
def __init__(self, protocol, base_url):
self.base_url = base_url
self.protocol = protocol
self.fs = fs.filesystem(protocol=protocol, base_url=base_url)
def open(self, path: Path):
return self.fs.open(path)
def open_by_list(self, path_list: list[Path]):
return self.fs.open_files(path_list)