Skip to content

[confusion report] CIBW_ENVIRONMENT seems to leak into the test stage #1666

@webknjaz

Description

@webknjaz

Description

The docs @ https://cibuildwheel.readthedocs.io/en/stable/options/#environment say:

Set environment variables needed during the build

And that "during the build" wording is reiterated a few times in the paragraph. So I set environment = { PIP_CONSTRAINT="requirements/cython.txt" } in the YARL project to pin the build deps (composed manually so far, pending the jazzband/pip-tools#1681 release to make the automation possible).

The file contains just one line — cython==3.0.5. And this is the only place where this constraint is defined.

cibuildwheel is also configured to run tests (not by me). So it does that after the build. I was surprised that it failed with a pip install errorring out on attempt to build PyYAML from sdist:

        ERROR: Cannot install Cython<3.0 because these package versions have conflicting dependencies.
        
        The conflict is caused by:
            The user requested Cython<3.0
            The user requested (constraint) cython==3.0.5
        
        To fix this you could try to:
        1. loosen the range of package versions you've specified
        2. remove package versions to allow pip attempt to solve the dependency conflict
        
        ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
        [end of output]
    
    note: This error originates from a subprocess, and is likely not a problem with pip.
  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.

This is because PyYAML caps Cython under 3.0 since yaml/pyyaml@27f9a99#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711R2. Which is fine normally, since PEP 517 builds are isolated.

The problem is that PIP_CONSTRAINT="requirements/cython.txt" set via CIBW_ENVIRONMENT doesn't seem to actually be scoped to just the build stage as the docs advertise, but looks like it remains in the environment.

I think that cibuildwheel should either apply stage-specific settings in isolation, or at least document this surprise side effect...

Build log

https://github.com/aio-libs/yarl/actions/runs/6918060335/job/18819918206#step:6:10219

CI config

https://github.com/aio-libs/yarl/blob/560dd38/.github/workflows/reusable-build-wheel.yml + https://github.com/aio-libs/yarl/blob/560dd38/pyproject.toml#L68

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions