对Cartopy的贡献#
Cartopy是一个开源项目,欢迎任何人的贡献。有关版权和许可协议的更多信息,请访问 SciTools Governance page .开始贡献的一个好地方是修复错别字、添加示例或改进功能的解释。
要贡献新功能或错误修复,您可以在GitHub上创建包含代码更改的拉取请求。开始贡献代码的最简单方法是 Fork Cartopy 到您的GitHub帐户,然后将存储库克隆到您的本地系统。之后,您可以安装源代码中包含的conda开发环境来安装所有所需的依赖项
# Clone your forked version of Cartopy
git clone git@github.com:YOUR-USERNAME/cartopy.git
# Set up the development environment and install the dependencies
cd cartopy
conda env create -f environment.yml
conda activate cartopy-dev
# Install cartopy
pip install -e .
# Optionally install pre-commit to help with linting
pre-commit install
这将安装编译代码、运行测试和构建文档所需的所有依赖项。记得激活 cartopy-dev
环境
开发和测试工作流可能类似于下面的代码块。
# Activate your development environment
conda activate cartopy-dev
# Checkout a new feature branch
git checkout -b my-cool-feature
# Make your code changes here, including tests for the changes!
# Add and commit the changes with a useful commit message
# describing what changes you made
git add lib/cartopy/my-changed-file.py
git commit
# Test your code on 4 processors
pytest -n 4 lib/cartopy
# push your changes to your GitHub account
git push --set-upstream origin my-cool-feature
# Go to GitHub and make a Pull Request to Cartopy