When contributing packages to conda-forge, Grayskull can make your life much easier. Grayskull generates recipes for Python packages hosted on PyPI.
As the introduction for Grayskull reads; "The main goal of this project is to generate concise recipes for conda-forge." In this tutorial we learn how to contribute a Python package to the conda-forge channel using Grayskull to generate the recipe.
Let us get started.
-
Install
grayskull
usingconda
through theconda-forge
channel:$ conda install -c conda-forge grayskull
-
Fork and clone the conda-forge staged-recipes repository from GitHub.
-
Checkout a new branch from the
master branch
. -
Through CLI, cd inside the 'staged-recipes/recipes' directory.
-
Call
grayskull
and pass thepypi
repository, followed by the name of the package you want to contribute to conda-forge. For example:grayskull pypi abc
Or you could use
grayskull pypi abc --strict-conda-forge
to remove some selectors which are not necessary for conda-forge and adapt recipes to fit better in the conda-forge ecosystem.Grayskull will create a folder with the same name as the package (in this case: 'abc') in the 'recipes' folder of the 'staged-recipes' directory. This folder will contain the
meta.yaml
file and also the license file if the package includes a license in the PyPI distribution. -
Go through the generated
meta.yaml
file. For simpler packages, the generated recipes are nearly perfect, but for some packages you might need to make certain tweaks. -
Commit and push the changes.
git add recipe/abc/meta.yaml
git commit -m "add a commit message"
git push
-
Create a PR.
-
Once the CI is passing, post a comment saying:
This is ready for review
@conda-forge-admin, please ping team
Once the PR gets merged, your package will be available on the conda-forge channel. Tada! It's that easy.