-
Notifications
You must be signed in to change notification settings - Fork 239
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: support brace expansion in BUILD/SKIP #527
Conversation
Wheels are now available for wcmatch's one dependency, thanks to quick action by @facelessuser! :) |
Wow, this is an amazingly small PR! I don't mind the extra dependency, if it gives us this amount of extra power :-)
I was also just thinking about this. Not sure if I like this behavior, but alternatively you could resolve both |
We could add a ! if one is not there, and remove it if it is, I think that would be the same logic as manually combining them. Implementation aside, it might depend on #529 - if we only allow SKIP there, it could be useful to have |
I don't think so. But exactly why I don't think it will per se be very useful. We should just pick the version that is the most consistent/intuitive to explain, I think :-)
Yes, indeed. That's another thing that we should think about, to be as consistent as possible w.r.t. this as well. In my head, splitting it up into two stages (1. the |
In my mind, I like unifying everything into a single variable ( That said, there are other possibilities, like simply assuming that no one will want to list anything but skips for testing, and seeing this |
Also, to clarify "SKIP is going anywhere" - I mean we hide all references to SKIP in the documentation and examples, using This is the current picture of what I'm thinking, not that we have to go this way, but the different parts needed to be seen together. |
To be honest, I still don't see the attraction or advantage of dropping |
Cool, I think the new But I agree with @YannickJadoul on this one, the
I did a little testing on this PR, and found the same thing... it looks like wcmatch is really just doing saving those 'nots' until the end and then subtracting them from the matched set. So that means you can't deselect something and then reselect it later, as you might expect... So for example, if we wanted to skip PyPy, except the latest version, you might write: $ CIBW_BUILD='!pp* pp37-manylinux_x86_64' cibuildwheel --platform linux --print-build-identifiers No matches. Maybe I need a $ CIBW_BUILD='* !pp* pp37-manylinux_x86_64' cibuildwheel --platform linux --print-build-identifiers
cp27-manylinux_x86_64
cp27-manylinux_x86_64
cp35-manylinux_x86_64
cp36-manylinux_x86_64
cp37-manylinux_x86_64
cp38-manylinux_x86_64
cp39-manylinux_x86_64
cp27-manylinux_i686
cp27-manylinux_i686
cp35-manylinux_i686
cp36-manylinux_i686
cp37-manylinux_i686
cp38-manylinux_i686
cp39-manylinux_i686 Hmm. So it looks like the initial
I think I preferred the logic of building the BUILD and SKIP sets separately, and subtracting one from the other. Perhaps the prepend |
wcmatch does exactly the same thing as BUILD/SKIP, just formalized into one variable. The left to right technique, while a bit more powerful, was too confusing. We can disable |
Because I've been @ in this thread I've been seeing the discussion. So I can assert that wcmatch's behavior in regards to As for braces, you are free to develop them yourselves if you choose, but I should state, that the brace expansion in wcmatch is provided by a separate package (that I also wrote) and follows bash style brace expansion pretty closely: https://github.com/facelessuser/bracex. This is more informative if anything. I do not know what this project actually needs, nor will my feelings be hurt if you guys go in a separate direction from any of these packages I maintain. I more just wanted to clear up any confusion about the package and offered features. |
If we don't want to add |
Especially since you guys are just matching simple, ASCII build names, old-style fnmatch may be more than sufficient. Just running bracex to expand your patterns prior to running through fnmatch is probably all you need. |
That's what I was thinking when I saw the unicode tables that wcmatch has to compile; we are guaranteed never to need unicode here. :) PS: I am assuming the next CPython build identifier would not be |
@joerick, for what it's worth, I would actually be up for having |
I could even do the left-to-right implementation I had in the javascript demo, we don't have to do the simple one. @joerick you have lots of options. :) |
A lot of wcmatch's power comes when you are dealing with full paths (not path names) or if dealing with Unicode. You could argue extmatch functionality is maybe a positive as well, but I think it shines more when you are globbing file systems as it is more efficient than doing braces. Braces expand a pattern to multiple patterns, and when globbing a filesystem, you'll recrawl the file system for each pattern, but extmatch patterns don't expand the pattern and everything happens in one pass. But none of this sounds like things you guys need 🙂. |
You can also get things like this with wcmatch, as well: https://www.linuxjournal.com/content/bash-extended-globbing Though the comment at the end might be a good reason to not worry about this. But Bash does support it. |
fa1ee79
to
df798d4
Compare
df798d4
to
31fa7d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me :)
By the way, I worry that I may have come across as stubborn, apologies if so. I have just learned that it's good to be minimalist with feature additions as you never know what the cost is until later.
I hope this will unblock the TEST_SKIP discussion, too :)
It's not a bad feature, as benevolent dictator of a project, IMO ;-) |
I expect you to be, if I was in charge then I would not feel so free to propose lots of cool stuff! :) |
Added some docs, and changed two examples to be Python 3.10 ready: |
Can I get a second set of eyes on the docs changes? @YannickJadoul or @joerick (or anyone else)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! (if we're ditching the !
; but let's first see what we can already do with this extra syntax, maybe :-) )
build_patterns = itertools.chain.from_iterable(bracex.expand(p) for p in self.build_patterns) | ||
skip_patterns = itertools.chain.from_iterable(bracex.expand(p) for p in self.skip_patterns) | ||
|
||
build: bool = any(fnmatch.fnmatch(build_id, pat) for pat in build_patterns) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not keep the same as before, where match_any
contains the code duplication? (Which also have the nice property of short-circuiting, though it's not like we should be careful about performance here).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine duplicating code twice, especially right next to each other, instead of defining a function in a function that is not a closure (edit; actually it was, didn't notice that, but it didn't need to be). I like the DRY-2 rule, where you are allowed to repeat yourself up to a maximum of twice if it's ugly to combine them into one. Pulling this out into a local function would be okay, but I think I liked the logic here inline better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm easy either way
@joerick my next PR builds on this one, as it turns out, since I'm adding a new condition to the list. What do you think about @YannickJadoul's comments above? Happy to change if desired. Though I'm about to possibly add a third condition to the list, so that might be a better time to change it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
I would auto-merge squash and merge if I could. 😭 |
Co-authored-by: Joe Rickerby <joerick@mac.com>
Finally Travis is finished! |
Great! Another PR that shows off the current design isn't too bad; it's quite amazing how easily we could add this in :-) (well, @henryiii could) |
This adds support for
{}
.TODO for getting this ready:
cp3?-*
example to be compatible with Python 3.10?