使用 Grayskull 向 conda-forge 贡献软件包
当向 conda-forge 贡献软件包时,Grayskull 可以让您的生活更加轻松。Grayskull 为 PyPI 上托管的 Python 软件包生成 recipe。
正如 Grayskull 的 介绍 中所说;“该项目的主要目标是为 conda-forge 生成简洁的 recipe。” 在本教程中,我们将学习如何使用 Grayskull 生成 recipe,从而向 conda-forge 频道贡献 Python 软件包。
让我们开始吧。
-
使用
conda
通过conda-forge
频道安装grayskull
$ conda install -c conda-forge grayskull
-
从 GitHub 上 Fork 并克隆 conda-forge 的 staged-recipes 仓库。
-
从
master branch
检出一个新分支。 -
通过 CLI,cd 进入 'staged-recipes/recipes' 目录。
-
调用
grayskull
并传递pypi
仓库,后跟您想要贡献给 conda-forge 的软件包名称。例如:grayskull pypi abc
或者您可以使用
grayskull pypi abc --strict-conda-forge
来删除一些对于 conda-forge 不是必要的选择器,并使 recipe 更好地适应 conda-forge 生态系统。Grayskull 将在 'staged-recipes' 目录的 'recipes' 文件夹中创建一个与软件包同名的文件夹(在本例中为:'abc')。此文件夹将包含
meta.yaml
文件,如果软件包在 PyPI 发行版中包含许可证,则还会包含许可证文件。 -
浏览生成的
meta.yaml
文件。对于更简单的软件包,生成的 recipe 几乎是完美的,但对于某些软件包,您可能需要进行某些调整。 -
提交并推送更改。
git add recipe/abc/meta.yaml
git commit -m "添加提交信息"
git push
-
创建 PR。
-
一旦 CI 通过,发布评论说:
This is ready for review
@conda-forge-admin, please ping team
一旦 PR 被合并,您的软件包将在 conda-forge 频道上可用。 成功啦!就这么简单。