安装
curl -sSf https://rye.astral.sh/get | bash
使用
创建项目
项目
初始化项目
rye init fvideo --script
# 指定 Python 版本
rye init fvideo --py 3.12 --script
cd fvideo
同步项目
rye sync
运行项目
rye run fvideo
# 或
rye run python -m fvideo
扩展使用
切换项目 Python 版本
rye pin cpython@3.13
# 查看
cat fvideo/.python-version
项目版本管理
# 主版本
rye version -b major
# 次版本
rye version -b minor
# 补丁版本
rye version -b patch
添加依赖
# PyPi 方式
rye add FastAPI
# Git 方式
rye add FastAPI --git https://github.com/tiangolo/fastapi
# 本地项目方式
rye add MyPyPkg --path ~/mypypkg
测试
# 添加测试依赖
rye add --dev pytest
# 运行测试, 同 rye run pytest
rye test
构建
rye build
发布
rye publish
全局安装二进制工具
# 安装
rye install pipx
# 卸载
rye uninstall pipx
# 列出已安装
rye tools list