-
Notifications
You must be signed in to change notification settings - Fork 247
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
refactor: split generic workflow from OS specific workflow #996
Conversation
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 did a quick first pass. In general, I like this direction as long as it's easy to unit test (mocking and such should be easy?). I'll need to do a second pass looking not at the diff, but at the full code, to see if it is still reasonable to track what is happening as a reader. Also to see why there's a backend and a platform backend.
I'm not sure if @joerick will like it, given https://cibuildwheel.readthedocs.io/en/stable/contributing/#design-goals, but since it's this far, I think a "final version" should be compared with the current version (probably not through a diff) to see if it looks better, to see if it looks easy to make large specific changes without breaking the other platforms, etc. (PS: to be clear, I'm not claiming to like it yet either, just positive about the direction but will need further review later.)
from .virtualenv import VirtualEnv, VirtualEnvBase | ||
|
||
|
||
class BuilderBackend: |
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 think this would be a lot simpler as a dataclass.
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 will need some time to think about what it would look like going this way.
cibuildwheel/backend.py
Outdated
return wheels | ||
|
||
|
||
def test_one( |
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.
Starting with test_
makes this look like a pytest test.
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.
changed to do_test_wheel
cibuildwheel/platform_backend.py
Outdated
from cibuildwheel.util import call, ensure_virtualenv, shell | ||
|
||
|
||
class PlatformBackend: |
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.
Shouldn't this be an ABC? (either through the ABCMeta metaclass or inheriting from abc.ABC)?
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.
done.
PS: Also, regardless of the final comparison, there are some good changes here we should pull out, like more |
By the way, I've thought about this too, and what I likely would have attempted would have been to implement smaller methods and a Protocol that would verify that a backend had the required components. Protocols are generally nicer than ABC's, though it's easier to share code with an ABC (which is not always great for reading the code, which is part of why Protocols are nice...). |
just a quick note - i'm very curious to review this but I won't have time for a few days! Apologies |
Thanks for this @mayeut, it's interesting! Reflections on a quick 30-min skim through...
|
@joerick, @henryiii, thanks for taking the time to review this. I'll try to address the comments but not sure when I'll be able to address all of them. |
I rebased on main. Only the last 3 commits are addressing some of the concerns raised during review. |
@joerick, I probably went too far in |
There are some good ideas here, I think it was worth attempting for sure, but ultimately I don't think that the extra layers of abstraction give us enough upside in maintainability to outweigh the downsides of indirectness. I'm cleaning up PRs, so I'll close this one for now. Ofc feel free to reopen if you'd like to continue discussion. |
This PR started as an attempt to close #560 in the backlog.
As mentioned in the issue, there's probably little benefit in doing just this so I went further than that just to get some ideas where we could go. This is just a draft to see if any of those ideas are worth looking into, I don't expect this PR to be merged ever.
The end game idea was to split generic stuff from OS specific stuff which could help for #78, #676, #966, #971
To help reviewing/checking if anything is of interest:
As a whole:
Pros:
Cons: