开发 (Development)
设置开发环境。
先决条件
- Python 3.10+
- Poetry (或使用
pip管理依赖)
安装
-
克隆仓库:
git clone https://github.com/caru-ini/novelai-sdk.git
cd novelai-sdk -
安装依赖:
poetry install
代码质量
我们要保持高代码质量。 提交前请运行以下命令。
格式化
使用 ruff 格式化代码。
poetry run ruff format .
Linting
使用 ruff 检查 lint 问题。
poetry run ruff check . --fix
类型检查
使用 pyright 进行静态类型检查。
poetry run pyright
测试
运行测试以确保一切正常。 注意:某些测试可能需要 API 密钥。
poetry run pytest
贡献
- Fork 仓库
- 创建功能分支 (
git checkout -b feature/amazing-feature) - 提交更改 (
git commit -m 'Add some amazing feature') - 推送到分支 (
git push origin feature/amazing-feature) - 开启 Pull Request
许可证
MIT License.