Skip to content

Generate a recipe.yaml from pyproject.toml using generate-recipe subcommand #1848

@millsks

Description

@millsks

Summary

Add native support for generating conda recipes from pyproject.toml files to the rattler-build generate-recipe command. This would integrate the core functionality from pyrattler-recipe-autogen directly into rattler-build, eliminating the need for a separate tool.

Motivation

Currently, Python developers need to generate a recipe manually for their own projects that have not been published to PyPI or some other registry. It would be very beneficial to be able to generate conda recipes from their pyproject.toml files. This creates friction in the workflow and requires maintaining separate tooling. By integrating this functionality directly into rattler-build, we can:

  1. Streamline the workflow - One tool for all recipe generation needs
  2. Reduce dependencies - No need to install and maintain separate tools
  3. Improve consistency - Unified interface and behavior across all recipe types
  4. Better maintenance - Single codebase to maintain and update

Proposed Solution

I had originally started working on pyrattler-recipe-autogen to create the recipe.yaml based on the information found in the pyproject.toml. I believe this functionality would be better suited as an integration into the existing rattler-build generate-recipe functionality. I propose adding a new subcommand: rattler-build generate-recipe pyproject [--input <pyproject.toml>] [--output <recipe.yaml>]

Key Features

  • Full pyproject.toml parsing - Extract project metadata, dependencies, and build system requirements
  • Dependency conversion - Convert Python package dependencies to conda format with proper version constraints
  • Schema version support - Configurable schema version with YAML language server headers
  • Conda overrides - Support for tool.conda.recipe.* configuration sections
  • Entry points handling - Convert project.scripts to conda recipe entry points
  • Build system integration - Add build system requirements to host dependencies

Example Usage

# Generate recipe from pyproject.toml
rattler-build generate-recipe pyproject

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions