Version 1 of conda-forge recipe.yaml#
TLDR 1; Add “conda_build_tool: rattler-build” to “conda-forge.yml” and then “conda smithy rerender”.
TLDR 2; Maybe wait for conda-forge to convert the feedstocks to use the new recipe.yaml format.
rattler-build is a new build tool for conda packages that is designed to be faster and more efficient than the current conda-build tool. It is the build tool for version 1 of the conda-forge recipe.yaml format.
Three Blind Mice#
There are three ways to make a conda-forge recipe.yaml file:
Convert recipe/meta.yaml to recipe/recipe.yaml with conda-recipe-manager. In my opinion this was the best one.:
# install conda-recipe-manager conda install conda-recipe-manager # typically run this in the root of the feedstock # I recommend using the --also-test-latest-python option to test the recipe # with the latest version of Python conda-recipe-manager convert --also-test-latest-python recipe/meta.yaml > recipe/recipe.yaml
Use “grayskull” to create a fresh recipe.yaml file from “pypi”.:
# install grayskull conda install grayskull # typically run this in the root of the feedstock grayskull pypi <package-name> --use-v1-format --strict-conda-forge --output recipe/recipe.yaml
Use “rattler-build” to create a fresh recipe.yaml file from “pypi”. This is the recommended way to create a new recipe.yaml file for conda-forge.:
# install rattler-build conda install rattler-build # typically run this in the root of the feedstock rattler-build generate-recipe pypi --write <package-name>
There was no consistency in the three generated recipe.yaml files. If you already have a recipe/meta.yaml file, I recommend using the first method to convert it to recipe.yaml. If you are creating a new recipe.yaml file, I recommend using the third method with rattler-build.
Clean Up#
If you are converting from and existing package, once you have a recipe.yaml file, you have to delete the recipe/meta.yaml file.
Then there are some tools that you can use to check the recipe.yaml file for errors. I recommend:
# install conda-smithy
conda install conda-smithy
# typically run this in the root of the feedstock
# note you have to give it the directory of the recipe.yaml file, not the
# file itself
conda smithy recipe-lint recipe
# then make sure it builds locally
./build-locally.py
The Undocumented#
I could not find any documentation for this next part and only discovered by looking at existing recipe.yaml feedstocks. You must add the following to the “conda-forge.yml” file in the root of the feedstock:
conda_build_tool: rattler-build
Once you have that line added to the “conda-forge.yml” file, you have to run “conda smithy rerender” to update the feedstock to use the new recipe.yaml format.:
# install conda-smithy
conda install conda-smithy
# typically run this in the root of the feedstock
conda smithy rerender
That took a long time to figure out. To see all of the existing feedstocks that have been converted to the new recipe.yaml format, you can use the link search
Soapbox#
Why they didn’t have an if statement where recipe/meta.yaml uses conda-build and recipe/recipe.yaml uses rattler-build is beyond me. There can only be one or the other in the recipe directory.
Comments
comments powered by Disqus