Skip to content

feat: Add Support for Rattler-Build Build Backend - #1127

Open
seneschall wants to merge 26 commits into
bioconda:masterfrom
seneschall:rattler_support2
Open

feat: Add Support for Rattler-Build Build Backend#1127
seneschall wants to merge 26 commits into
bioconda:masterfrom
seneschall:rattler_support2

Conversation

@seneschall

Copy link
Copy Markdown

This PR adds support for the rattler-build backend which uses the v1 recipe syntax. In order to enable this, I had to make changes in a lot of places in the code base since rattler-build handles a lot of things differently from conda-build. One important change I made e.g. was to introduce a RecipePath class which stores the build-backend for every recipe alongside the path that points to it. This way the rest of the code can automatically determine which build-backend to use for every given recipe based on whether the recipe folder contains a meta.yaml or a recipe.yaml.

During these changes I also added type hints wherever possible in order to better understand the existing codebase and in order to catch type errors via the linter instead of at runtime. Wherever possible, I also changed string based paths to pathlib Path objects to both improve code readability by clearly marking strings that are supposed to be paths and to make the manipulation of paths safer and more idiomatic.

Also, I deprecated the testonly flag because from my understanding of the existing code, bioconda-utils expects to be able to call conda-build --test on the recipe directory. This definitely doesn't work for rattler-build test, as rattler-build expects to be passed a directory of already built packages, but from what I understand conda-build does the same, as per this excerpt from their help: "RECIPE_PATH argument must be a path to built package file". Also, there don't seem to be any existing test cases where testonly is set to True. If I am mistaken, please feel free to revert this change.

I ran all tests from test/test_utils.py and test/test_recipe.py locally, but I only tested for native builds and not for docker based builds. The parts of the code that handle the docker build process should thus be examined more closely. The tests all passed except for test_multi_build. This one also fails on my machine for the version from the master branch, however. I also added a single test case, test/test_utils.py::test_rattler_recipe.

Parts of the code where I was unsure about something or which should be improved, I have marked with TODO (rb). If you have any questions about my code, don't hesitate to ask.

To summarise:

  • Added support for rattler-build
  • Add type hints to a lot of the code
  • Refactored string based paths to pathlib Path objects for safety and to clarify what parameters functions expect to be passed
  • Deprecated the testonly flag, as it seems to be broken as far as I understand and it also isn't covered by any of the existing test cases
  • Linting has not yet been implemented for rattler-build recipes. Rattler recipes are simply skipped when linting

Simon Sack and others added 26 commits July 1, 2026 14:45
utils.parallel_iter was called on a function which forced it to pickle
rattler_build.VariantConfig, which resulted in failure to build
Accidentally added rattler-build args instead of conda-build args prior
to this.
In single_build, the config must be loaded, otherwise utils.RepoData
can't be instantiated. Also the recipe path needed to be converted to a
utils.RecipePath.
@seneschall

Copy link
Copy Markdown
Author

I have done my best to merge with the master branch but as the two were quite divergent it is possible I missed something and caused breaking changes. I will not have time to work on this PR until next week and I didn't get the chance to test the merged code locally yet so please be patient. But if you want you can start reviewing this PR regardless. I will answer you as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant