pypa / cibuildwheel

🎡 Build Python wheels for all the platforms with minimal configuration.
https://cibuildwheel.pypa.io
Other
1.78k stars 227 forks source link

Split `utils.py` into multiple coherent modules #1857

Open MusicalNinjaDad opened 3 weeks ago

MusicalNinjaDad commented 3 weeks ago

1851 introduced a change into utils.py which required an in-function import in order to avoid a circular import with logger.py

_Originally posted by @henryiii in https://github.com/pypa/cibuildwheel/pull/1851#discussion_r1629782369_

We can probably split utils up later to avoid the circular import, it's pretty big. Not something to worry about for this PR.

Needs design input

MusicalNinjaDad commented 3 weeks ago

I'd be happy to collaborate on this if it is something considered worth doing ... (please at-tag me to get my attention ;))

henryiii commented 3 weeks ago

Sort of related: I'd also like to put the four platform files in a folder (macos, linux, windows, and pyodide).

mayeut commented 3 weeks ago

I guess it can be done incrementally rather than all at once. So I'd say for util.py, it could be made as a folder, rename the file as misc.py in that folder and then start splitting this up. If trying to break-up by family, I'm seeing (not exhaustive at all, to be extended):

MusicalNinjaDad commented 3 weeks ago

Hi both, I see that you've suggested to remove the logging from move_file, mayeut, so this potentially loses importance.(?) But it's probably still a nice clean up, which I'd be happy to help with if you agree it is worthwhile.

I've tried a quick check - moving everything to util/misc.py leads to plenty of import errors found by pylint. Adding a from .misc import * to util/__init__.py then fixes all those errors - so that appears a viable approach to allow for an incremental move.

I'll take a good look through util.py and maybe try moving out the first family as an initial PR ...

MusicalNinjaDad commented 2 weeks ago

I've made a suggestion of how we could approach this with the above PR. Would be interested in feedback from both of you on your thoughts ...