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

Adding CIBW_BUILD option #101

Merged
merged 5 commits into from
Sep 23, 2018
Merged

Adding CIBW_BUILD option #101

merged 5 commits into from
Sep 23, 2018

Conversation

YannickJadoul
Copy link
Member

Cfr. #98, this is adding CIBW_BUILD to positively select a set of build targets (rather than deselecting everything else).

I'm not completely happy with the naming of BuildSelector and selection (replacing BuildSkipper and the skip argument to the different platforms), but I can't think of anything better, right now.

Comments, remarks, and identification of bugs are very welcome, @altendky, @astrofrog, and @joerick!

@altendky
Copy link
Contributor

Thanks. Quick look over the code mostly makes sense. I'll give it a shot over in twisted/twisted#1067.

Copy link
Contributor

@joerick joerick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really nice - I can see the usefulness and a very concise changeset!

A few comments within. Might it also be worth adding a little unit test with a couple of cases for BuildSelector? That would really pin down the functionality.

- Only build on Python 3.6: `cp27-* cp34-* cp35-*`

***
- Only build on Python 3.6: `CIBW_BUILD`:`cp36-*`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohhhh CIBW_BUILD can do wildcards too! 🤯that's nice

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your original code, just duplicated ;-)

- Skip Python 2.7 on 32-bit Windows: `CIBW_SKIP`:`cp27-win32`
- Skip Python 3.4 and Python 3.5: `CIBW_SKIP`:`cp34-* cp35-*`
- Skip Python 3.6 on Linux: `CIBW_SKIP`:`cp36-manylinux*`
- Only build on Python 3 and skip 32-bit builds: `CIBW_BUILD`:`cp3?-*` and `CIBW_SKIP`:`*-win32 *-manylinux1_i686`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice :)

@@ -99,7 +99,7 @@ def main():
traceback.print_exc(None, sys.stderr)
exit(2)

skip = BuildSkipper(skip_config)
selection = BuildSelector(build_config, skip_config)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BuildSelector seems like a reasonable name to me. selection is a little confusing though? Maybe just call it build_selector? open to other ideas though

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Myeah, I liked how skip(...) read, but couldn't really reproduce that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other option is to keep this as BuildSkipper, btw, and just add the extra argument of build_config? Depending on your point of view, this class is still determining what builds to skip.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BuildSkipper feels like it relates too closely with CIBW_SKIP. I like it the way it is, I think, just the selection(identifier) is a bit too vague.

return any(fnmatch(build_id, pattern) for pattern in self.patterns)
def match_any(patterns):
return any(fnmatch(build_id, pattern) for pattern in patterns)
return match_any(self.build_patterns) and not match_any(self.skip_patterns)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the logic is 'match any of the build patterns, and none of the skip patterns.' Makes sense!

(b1 or b2 or b3) and not (s1 or s2 or s3)
(b1 or b2 or b3) and not s1 and not s2 and not s3

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Credit to @altendky for coming up with those semantics. But indeed, I've been thinking a little bit more, and this gives a really intuitive interpretation (there's not even really a 'first CIBW_BUILD is applied, and then CIBW_SKIP' kind of sequential semantics)

@@ -0,0 +1,4 @@
{
"CIBW_BUILD": "cp3?-*",
"CIBW_SKIP": "cp33-*"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python 3.3 is about to be removed from cibuildwheel - maybe better to change this to Python 3.4

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving it keeps this PR concise. :]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the folder name anyway, and added the line. So to almost any diff, this file is (almost) completely changed anyway, so might as well clean this up? :-/

@altendky
Copy link
Contributor

https://travis-ci.org/twisted/twisted/builds/429309631?utm_source=github_status&utm_medium=notification

It's a pretty minimal 'test' but I think it did what I wanted.

@YannickJadoul
Copy link
Member Author

Tests are failing because on OSX, there's now only 3 wheels being produced for the 04_build_skip test (i.e., 3.5, 3.6, 3.7, because CIBW_BUILD selects only 3. and CIBW_SKIP skips 3.4, and because 3.3 is already not supported anymore on macOS). I'm seeing if I can find a solution.

@YannickJadoul
Copy link
Member Author

I'm seeing if I can find a solution.

Pfff, I wanted to add a file with the list of files to be produced by a test, but then I need to start detecting the platform, as well.

I could split the test again into one for SKIP and one for BUILD, I suppose, but ... meh :-/ Any suggestions on making this test and its assert work are welcome.

@joerick
Copy link
Contributor

joerick commented Sep 17, 2018

Any suggestions on making this test and its assert work are welcome.

Hmm. We've talked in the past of the need to update how these tests work with a .py file for each script. Maybe we create an issue to track that refactoring, and for now we can reduce that magic number to 3 (there's nothing special about minimum 4 wheels per platform).

@YannickJadoul
Copy link
Member Author

Done. As far as I'm concerned, I think this is ready, then. Let's keep subcommands for a completely different refactoring and PR?

@altendky
Copy link
Contributor

Do we need more review here? Trying it out in twisted/twisted#1067.

@altendky
Copy link
Contributor

Yeah, I'm still happy with it from what I've checked. @joerick, do you see anything else we need to address?

@YannickJadoul
Copy link
Member Author

Seems I'll need to rebase my changes. I'll do that in a bit. But as far as I'm concerned, this is probably OK.

@joerick
Copy link
Contributor

joerick commented Sep 23, 2018

Released in 0.10.0! Thanks both!

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

3 participants