Skip to content

[Bug]: Fromager generates wrong build-backend #1194

@tiran

Description

@tiran

Environment

  • Fromager version: 0.87.0

Bug description

Under some conditions, Fromager generates wrong dependency graph for build-backend and build-sdist requirements. One easy to understand example is biotite 1.6.0, https://github.com/biotite-dev/biotite/blob/v1.6.0/pyproject.toml .

Expected behavior:

biotite 1.6.0 has a static build system requirement on hatch-cython == 0.5 and a dynamic wheel build requirement on hatch-cython. Hatchling uses tool.hatch.build.targets.wheel.* for PEP 517 hook get_requires_for_build_wheel. Since build-system requirements pins hatch-cython and the pin satisfies the dynamic requirement, Fromager should not add a dependency on a newer version.

Actual behavior:

Fromager generates a build graph that has build-system dependency hatch-cython==0.5.0 and build-backend dependency hatch-cython==0.6.0.

{
  "biotite==1.6.0": {
    "download_url": "https://files.pythonhosted.org/packages/59/7b/99153f7bceef01034b5f19a6b123219533132d446ffcf141dfef3e386d33/biotite-1.6.0.tar.gz",
    "pre_built": false,
    "version": "1.6.0",
    "canonicalized_name": "biotite",
    "constraint": null,
    "edges": [
      {
        "key": "numpy==2.4.6",
        "req_type": "build-system",
        "req": "numpy>=2.0"
      },
      {
        "key": "hatchling==1.29.0",
        "req_type": "build-system",
        "req": "hatchling"
      },
      {
        "key": "hatch-vcs==0.4.0",
        "req_type": "build-system",
        "req": "hatch-vcs==0.4"
      },
      {
        "key": "hatch-cython==0.5.0",
        "req_type": "build-system",
        "req": "hatch-cython==0.5"
      },
      {
        "key": "cython==3.2.5",
        "req_type": "build-system",
        "req": "cython>=3.0"
      },
      {
        "key": "hatch-cython==0.6.0",
        "req_type": "build-sdist",
        "req": "hatch-cython"
      },
      {
        "key": "hatch-cython==0.6.0",
        "req_type": "build-backend",
        "req": "hatch-cython"
      }
  ]
}

Steps to reproduce / logs:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions