Skip to content

V1 conversion should use python_min instead of python in skip conditions for noarch Python recipes #479

Description

@janjagusch

Summary

When converting V0 recipes to V1 format for noarch: python packages, the selector conversion produces match(python, ...) expressions in skip conditions. However, per CFEP-25 standards, V1 noarch Python recipes only define python_min in their variant configuration—not python. This causes rattler-build to skip all variants because the python variable is undefined.

Current Behavior

Converting a V0 recipe with a Python version selector like [py<310] for a noarch Python package produces:

build:
  skip: match(python, "<3.10")
  noarch: python

Expected Behavior

For noarch: python recipes, the conversion should produce:

build:
  skip: match(python_min, "<3.10")
  noarch: python

Root Cause

The _upgrade_selectors_to_conditionals() method in recipe_parser_convert.py (lines 335-351) converts Python version selectors using hardcoded python variable:

bool_expression = Regex.SELECTOR_PYTHON_VERSION_REPLACEMENT.sub(
    r'match(python, "\1\2.\3")', bool_expression
)

The code does not check whether the recipe is a noarch: python package before deciding which variable to use.

Affected Patterns

V0 Selector Current V1 Output Expected V1 Output (noarch)
[py<310] match(python, "<3.10") match(python_min, "<3.10")
[py310] match(python, "==3.10") match(python_min, "==3.10")
[not py310] match(python, "!=3.10") match(python_min, "!=3.10")
[py2k] match(python, ">=2,<3") match(python_min, ">=2,<3")
[py3k] match(python, ">=3,<4") match(python_min, ">=3,<4")

Suggested Fix

In _upgrade_selectors_to_conditionals():

  1. Check if the recipe has noarch: python in the build section
  2. Use python_min instead of python in match expressions when noarch: python is detected

Related Issues

Environment

  • conda-recipe-manager version: latest (v0.9.3)

This issue was generated with the assistance of Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions