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
Unify the shells we use for before-build, test-command etc? #1780
Comments
Unified BashCompletely agree that having (nearly) the same shell across all three operating systems would be really nice. On Windows, the simplest I have seen is the There are alternatives through MSYS2, Cygwin and MinGW, and if the system is configured already,
AlternativeOne alternative I alluded to in #1779 is the possibility of having support for Python scripts directly, given that Python is obviously available. I don't know exactly how support would be added without conflicting with bash. It's just a bit of a quality of life, especially if the Python string has quotes:
|
I don't think this would be a good idea. It would both break existing workflows, be very surprising on Windows to have bash syntax, and likely would cause a lot more issues like with finding MSVC on Windows. We did have this for a while on the GitHub Action, and had to revert it because some tools (like Meson) used GCC instead of MSVC from the bash shell. Note that GitHub Actions chose to select platform specific shells, and a lot of the time, you can actually get by with just writing cross platform commands. Pre-building stuff is very commonly something you'd do in before-all, and calling meson or CMake is easy to do in a way that doesn't depend on your shell, but using bash may cause those to find the wrong compilers on Windows! You can run cibuildwheel yourself today in a bash shell on Windows by using:
However, this will tend to break some things, for example, if you use meson-python. It's pretty rare to have the same commands on all platforms, and when you do, they tend to be simple. Usually you are doing things like installing packages, repairing wheels, etc. All shells support And in general, you should try to set up packages so you don't need these commands, and you shouldn't be constructing long complex commands in your pyproject.toml in a string anyway. It's much better to put the commands (if you have to have them) in an extra file and run that. Also, finally, I think you can use triple quoted TOML strings to reduce escaping. |
Also, if bash was pip installable, it would probably be built by cibuildwheel, and we'd cause chicken-egg problems for every new platform that comes out. I'm strongly in favor of the simple and expected solution of doing the native thing on every platform. It's easy for a user to use bash if that's what they want. |
Or the right compiler. Some projects build wheels with gcc.
Indeed. Maybe the cibuildwheel action could have an option to override default shell? |
The MSVC thing is a good point. I don't really understand the issue though, why would a subshell not inherit the required env vars from the parent?
I'm not sure I follow this logic. Invoking cibuildwheel with bash doesn't mean that cibuildwheel uses bash for the subshells, does it? I think there might be a mechanism involving |
Thinking about #1779, I'm always on the lookout for a distributable
sh
/bash
implementation on windows, it would be really nice to unify this one day. Advantages would beI suppose it would need to be bundleable or pip-installable. Or we could download it at runtime like Python, but we'd need it to be from a trusted source.
Other thoughts-
bash
. Other CId might too. We could let users choose this via an option. That would be nice, but I'd rather the defaults give the best user experience, rather than needing to opt-into it.The text was updated successfully, but these errors were encountered: