Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add formatted indentifier printout #1262

Closed
wants to merge 3 commits into from

Conversation

henryiii
Copy link
Contributor

@henryiii henryiii commented Sep 8, 2022

See #1261 - this would enable easier production of dynamic matrix outputs from cibuildwheel.

Example:

$ cibuildwheel --print-build-identifiers '{{"CIBW_BUILD": "{identifier}", "CIBW_ARCHS":"{arch}", "os": "ubuntu-latest"}}' --platform linux | jq -s
[
  {
    "CIBW_BUILD": "cp36-manylinux_x86_64",
    "CIBW_ARCHS": "x86_64",
    "os": "ubuntu-latest"
  },
  {
    "CIBW_BUILD": "cp37-manylinux_x86_64",
    "CIBW_ARCHS": "x86_64",
    "os": "ubuntu-latest"
  },
  ...

You should be able to concat multiple platforms as well.

Todo:

  • Verify this is a good idea / makes using this easier in Dynamically generating GitHub Actions matrix to avoid timeouts when emulating architectures #1261.
  • Tests
  • Any other values useful in the format string?
  • Is there any way to use this from the action, so the version stays locked with the cibuildwheel invocation that runs the builds?
  • This does not have a way to group smaller chunks of runs, sadly, but maybe that could be done via jq? I did include version if that's useful - so we have version, identifier, and arch. You'd have to combine the contents of the build field. But you could write a processor to do this at least much easier than now.

I could have done this by just processing the build identifier, and not touching get_build_identifiers - version, pp/cp, os, and arch are all obtainable by processing the identifier. Maybe that would be better. Edit: trying that in a new commit. Also added impl and os.

@henryiii henryiii force-pushed the henryiii/feat/formatted_ident branch from c80aa97 to da8d18c Compare September 8, 2022 15:03
cibuildwheel/__main__.py Outdated Show resolved Hide resolved
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
@henryiii henryiii force-pushed the henryiii/feat/formatted_ident branch from 1760f15 to 8c6862c Compare September 8, 2022 15:33
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
@henryiii henryiii force-pushed the henryiii/feat/formatted_ident branch from 8c6862c to 543f799 Compare September 8, 2022 16:06
@henryiii
Copy link
Contributor Author

henryiii commented Sep 9, 2022

One issue with making --print-build-identifiers be the formatter too is that cibuildwheel --print-build-identifiers $PWD (or any other non-option string) will pass the string to --print-build-identifiers. We could add a --fmt or similar flag instead. Though I'd expect this would not be too bad, sticking --print-build-identifiers at the end / not adding a string path is likely common, and this has been heavily an interactive option. Open for opinions.

@henryiii
Copy link
Contributor Author

henryiii commented Sep 9, 2022

While we'd lose a little extra info, and it would not work with grouping (not that this does, but at least its closer), #1098 might allow this to be used directly without having to be able to change the formatting. You'd still have to format JSON to build the entry, but maybe it would be doable.

@henryiii
Copy link
Contributor Author

henryiii commented Sep 9, 2022

cibuildwheel --print-build-identifiers --platform linux \
  | sed 's/^.*$/{"only": "&", "os": "ubuntu-latest"}/g' \
  | jq -s

This could be fed into --only. Maybe we should add --only to the GHA?

@henryiii henryiii mentioned this pull request Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant