Imitate Visual C++ with MinGW or other C++ compilers (for Python packages based on Visual C++)

I was redirected to this forum by a member of github vscode-cpptools.

Please refer to the github link https://github.com/microsoft/vscode-cpptools/issues/5695 to see details of the idea and its comments. It is about how to reduce the size of C/C++ compiler that is required by Python packages, take dtaidistance for instance, among many others. It would be good to be able to run them with MinGW instead, or to reduce MSVC strongly in size.

There was a workaround until Python 3.4 which might also be an approach now: Use MinGW compiler till Python 3.4 by adding a “distutils.cfg” to the folder “\Lib\distutils” in Python install directory. It would be nice to have that MinGW “distutils.cfg” workaround for the recent Python versions as well.

It was I who gave the redirect. Welcome!

The people who need to see this question are likely the setuptools and pip folk, since what you need is some kind of option to override the compiler used for build options. (Historically, this would also have involved contributing code to the distutils module in CPython, but now that it’s moving into setuptools you’re best to start there).

If anyone knows the current active MinGW folk, it may be valuable to loop them in. I have no idea what their status is on making it look more like MSVC.

I do know that both the MSVC and Windows teams are very aware of the size of their respective packages and the complexity in acquiring/installing them. I’m not sure what changes will come about yet, but as those are the tools that are properly supported we’ll make sure that Python continues to work with them.

As for the distutils.cfg workaround, I doubt that was ever removed, so not sure why it stopped working there. It may be when setuptools started being injected by pip, in which case you’ll still want to work with someone from that project (@jaraco probably) to figure out what broke it, though it’s also possible that MinGW will say they shouldn’t be used anymore.

1 Like