|
| 1 | +# MindCV 贡献指南 |
| 2 | + |
| 3 | +欢迎贡献,我们将不胜感激!每一份贡献都是有益的,请接受我们的赞扬。 |
| 4 | + |
| 5 | +## 贡献类型 |
| 6 | + |
| 7 | +### 报告错误 |
| 8 | + |
| 9 | +报告错误至 https://github.com/mindspore-lab/mindcv/issues. |
| 10 | + |
| 11 | +如果您要报告错误,请包括: |
| 12 | + |
| 13 | +* 您的操作系统名称和版本。 |
| 14 | +* 任何可能有助于故障排除的本地设置详细信息。 |
| 15 | +* 重现错误的详细步骤。 |
| 16 | + |
| 17 | +### 修复Bugs |
| 18 | + |
| 19 | +查阅GitHub issues以了解Bugs。任何带有“bug”和“help wanted”标签的issue都对想要解决它的人开放。 |
| 20 | + |
| 21 | +### 实现features |
| 22 | + |
| 23 | +查阅GitHub issues以了解features。任何标有“enhancement”和“help wanted”的issue都对想要实现它的人开放。 |
| 24 | + |
| 25 | +### 编写文档 |
| 26 | + |
| 27 | +MindCV通常可以使用多种方式编写文档,可以编写在官方MindCV文档中,或者编写在docstrings中,甚至可以编写在网络上的博客、文章上。 |
| 28 | + |
| 29 | +### 提交反馈 |
| 30 | + |
| 31 | +发送反馈的最佳方式是在 https://github.com/mindspore-lab/mindcv/issues 上提交问题。 |
| 32 | + |
| 33 | +如果您要提出一项功能: |
| 34 | + |
| 35 | +* 详细说明它将如何工作。 |
| 36 | +* 尽可能缩小范围,使其更易于实施。 |
| 37 | +* 请记住,这是一个志愿者驱动的项目,欢迎贡献 :) |
| 38 | + |
| 39 | +## 入门 |
| 40 | + |
| 41 | +准备好贡献了吗?以下是如何设置 `mindcv` 进行本地开发。 |
| 42 | + |
| 43 | +1. 在 [GitHub](https://github.com/mindlab-ai/mindcv) 上 fork `mindcv` 代码仓。 |
| 44 | +2. 在本地克隆您的 fork: |
| 45 | + |
| 46 | +```shell |
| 47 | +git clone git@github.com:your_name_here/mindcv.git |
| 48 | +``` |
| 49 | + |
| 50 | +之后,您应该将官方代码仓添加为upstream代码仓: |
| 51 | + |
| 52 | +```shell |
| 53 | +git remote add upper git@github.com:mindspore-lab/mindcv |
| 54 | +``` |
| 55 | + |
| 56 | +3. 将本地副本配置到 conda 环境中。假设您已安装 conda,您可以按照以下方式设置 fork 以进行本地开发: |
| 57 | + |
| 58 | +```shell |
| 59 | +conda create -n mindcv python=3.8 |
| 60 | +conda activate mindcv |
| 61 | +cd mindcv |
| 62 | +pip install -e 。 |
| 63 | +``` |
| 64 | + |
| 65 | +4. 为本地开发创建一个分支: |
| 66 | + |
| 67 | +```shell |
| 68 | +git checkout -b name-of-your-bugfix-or-feature |
| 69 | +``` |
| 70 | + |
| 71 | +现在您可以在本地进行更改。 |
| 72 | + |
| 73 | +5. 完成更改后,检查您的更改是否通过了linters和tests检查: |
| 74 | + |
| 75 | +```shell |
| 76 | +pre-commit run --show-diff-on-failure --color=always --all-files |
| 77 | +pytest |
| 78 | +``` |
| 79 | + |
| 80 | +如果所有静态 linting 都通过,您将获得如下输出: |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | +否则,您需要根据输出修复警告: |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | +要获取 pre-commit 和 pytest,只需使用 pip 安装它们到您的 conda 环境中即可。 |
| 89 | + |
| 90 | +6. 提交您的更改并将您的分支推送到 GitHub: |
| 91 | + |
| 92 | +```shell |
| 93 | +git add . |
| 94 | +git commit -m “您对更改的详细描述。” |
| 95 | +git push origin name-of-your-bugfix-or-feature |
| 96 | +``` |
| 97 | + |
| 98 | +7. 通过 GitHub 网站提交pull request。 |
| 99 | + |
| 100 | +## pull request指南 |
| 101 | + |
| 102 | +在提交pull request之前,请检查它是否符合以下指南: |
| 103 | + |
| 104 | +1. pull request应包括测试。 |
| 105 | +2. 如果pull request添加了功能,则应更新文档。将新功能放入带有docstring的函数中,并将特性添加到 README.md 中的列表中。 |
| 106 | +3. pull request应适用于 Python 3.7、3.8 和 3.9 以及 PyPy。检查 |
| 107 | + https://github.com/mindspore-lab/mindcv/actions |
| 108 | + 并确保所有受支持的 Python 版本的测试都通过。 |
| 109 | + |
| 110 | +## 提示 |
| 111 | + |
| 112 | +您可以安装 git hook脚本,而不是手动使用 `pre-commit run -a` 进行 linting。 |
| 113 | + |
| 114 | +运行flowing command来设置 git hook脚本 |
| 115 | + |
| 116 | +```shell |
| 117 | +pre-commit install |
| 118 | +``` |
| 119 | + |
| 120 | +现在 `pre-commit` 将在 `git commit` 上自动运行! |
| 121 | + |
| 122 | +## 发布 |
| 123 | + |
| 124 | +提醒维护者如何部署。确保提交所有更改(包括 HISTORY.md 中的条目),然后运行: |
| 125 | + |
| 126 | +```shell |
| 127 | +bump2version patch # possible: major / minor / patch |
| 128 | +git push |
| 129 | +git push --tags |
| 130 | +``` |
| 131 | + |
| 132 | +如果测试通过,GitHub Action 将部署到 PyPI。 |
0 commit comments