Skip to content

Set build-time env vars about the current build for scripts to use #944

Closed

Description

@joerick

We already set CIBUILDWHEEL=1 for our builds, so we could add CIBUILDWHEEL_BUILD_IDENTIFIER - the CIBUILDWHEEL prefix distinguishing these variables from CIBW options.

Originally posted by @joerick in #910 (reply in thread)

Or just CIBUILDWHEEL_BUILD might work.
An arch variable was also mooted, which might be easier to switch on. In this naming structure, that would be CIBUILDWHEEL_BUILD_ARCH

Activity

  1. henryiii commented on Nov 30, 2021

    @henryiii
    Contributor

    The build identifier is not singular during the before-all step, though possibly we could set it to a list of build identifiers? That would have the handy feature that the suffix of the list would always be the correct suffix, because that cannot change for a batch.

    The BUILD_ARCH would still be handy, especially for build-all, and easier to set. For @hynek's case, though, I'd argue it's the wrong solution - for making decisions inside your Python build backend (setuptools, in this case), you want to avoid CIBW specific controls so that you can also support Conda-build and other build tooling. It's really only for use in before-all and before-build.

  2. hynek commented on Nov 30, 2021

    @hynek

    I'd be more than more happy to see better solutions – I'm sure I'm not the only one with this problem. :)

    If I could just set ARGON2_CFFI_USE_SSE2=0 whenever cross-compiling to non-amd64, that would be even better. Right now, I'm parsing ARCHFLAGS tho which is unfortunate. :D

  3. henryiii commented on Nov 30, 2021

    @henryiii
    Contributor

    If I could just set ARGON2_CFFI_USE_SSE2=0 whenever cross-compiling to non-amd6

    I'd say this is a non-ideal solution too, as it requires special setup to cross compile unique to your project. An ideal solution would work if anyone was cross compiling (such as in conda-build, etc), and would not tied to cibuildwheel at all. The ARCHFLAGS is how setuptools is configured to cross-compile on macOS, so I don't think it's bad - using that will work for everyone who tries to cross compile, not just a cibuildwheel setup. I left some comments on improving it, though.

  4. henryiii commented on Nov 30, 2021

    @henryiii
    Contributor

    (Correction: not that bad, didn't really pay attention to what you were specifying with the variable. I'd still say that the default for ARGON2_CFFI_USE_SSE2 should be smart, though, and pick up on cross compiling via ARCHFLAGS.)

  5. henryiii commented on Nov 30, 2021

    @henryiii
    Contributor

    If I could just set ARGON2_CFFI_USE_SSE2=0

    I think making this smarter is likely the best way to go, but of course you can do this if you want.

    [[tool.cibuildwheel.overrides]]
    select = ["*_universal2", "*_arm64"]
    environment = {"ARGON2_CFFI_USE_SSE2" = "0"}

    Just be warned that this will replace rather than augment your environment if you've set it at any higher cibuildwheel level.

  6. joerick commented on Jun 17, 2022

    @joerick
    ContributorAuthor

    PRs would be welcome for this!

  7. added a commit that references this issue on May 29, 2026
    80d5810
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions