1. 开发环境 Get Started
1.1 使用 Anaconda 安装 python 3.13
conda remove -n py313 --all
conda create -n py313 python=3.13
source activate py313
1.2 安装 VS Code 插件
详见文件 .vscode/extensions.json 中的 recommendations 配置
1.3 设置 VS Code
详见文件 .vscode/setting.json
1.4 依赖管理 poetry
python -m pip install poetry==2.4.1
poetry install --no-root
1.5 pre-commit
# Install pre-commit
python -m pip install pre-commit
# Install libcst (only-binary if you don't have rust compiler)
python -m pip install --only-binary=:all: libcst
# Execute below command at root directory to install git hooks into your `.git/` directory.
pre-commit install --config ./.pre-commit-config.yaml
2. 代码风格
规则
- 必须按照该文档的
开发环境 Get Started准备好开发环境 - VS Code 飘红提示必须解决,遇到 python 语言特性导致的飘红可以使用
# type: ignore或# pylint: disable=W0212忽略 - 函数的出入参必须要有类型声明
- 写注释时,字母和汉字之间需要有一个空格
其他
poetry 的注意事项
其他可能会用到的命令
# 增加依赖
poetry add {依赖名}
# 安装依赖
poetry install
# 更新依赖
poetry update {依赖名}
# 删除依赖
poetry remove {依赖名}
# 环境信息
poetry env info
# 展示依赖版本
poetry show -t
如果 poetry.lock 文件冲突,应该删除 rm poetry.lock 并使用 poetry update 重新生成 poetry.lock 文件
sdk 开发和发版
# 开发 sdk 时为了解决 python 项目的路径问题,需要运行下面这个命令(**千万注意修改的代码是不是该项目中的代码**)
cd ..
pip install -e ./rbm_tools
# sdk 发版
cd ./rbm_tools
vi pyproject.toml # 修改 sdk pyproject.toml 的 version
./build.sh
# 修改项目中使用的 sdk 版本
vi pyproject.toml # 修改 pyproject.toml sdk 的 version
rm poetry.lock
poetry update
Metadata
Release files for rbm_tools 0.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| rbm_tools-0.0.0.tar.gz | 26.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rbm_tools-0.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 61.4 kB
Release files / rbm_tools-0.0.0.tar.gz
| Download URL | rbm_tools-0.0.0.tar.gz |
|---|---|
| Size | 26.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9843b60e9de239e922d4cacb36b698b9b8ba5fde884a07eb21b87b8bba328ec6
|
|
BLAKE2b-256 checksum How to use checksums |
017ad723d3276b1cdbe6ffbcaa4821ab9f5137bd85c205b522fca767bdfc0837
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.13.5 Darwin/24.6.0
|
Release files / rbm_tools-0.0.0-py3-none-any.whl
| Download URL | rbm_tools-0.0.0-py3-none-any.whl |
|---|---|
| Size | 35.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c8bff182e43e49f1dd8cc7253134e57d074a1892105d061ab0c55e38e80784e3
|
|
BLAKE2b-256 checksum How to use checksums |
bbfb70cebf205026956ce3a5f0182746de3fdaab0bea87dc8280f93575228e67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.13.5 Darwin/24.6.0
|
Security for rbm_tools 0.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.