Specify build backend via pyproject.toml#7190
Specify build backend via pyproject.toml#7190hugovk wants to merge 12 commits intopython-pillow:mainfrom
Conversation
There was a problem hiding this comment.
Maybe replace the build_pillow.cmd call entirely, and use something like https://pypi.org/project/build/ to call python -m build --wheel?
Does this build a wheel from the previously compiled Pillow without invoking the compiler?
If so, that sounds like a great solution!
(I expect the --disable-imagequant flag will no longer be needed when building the wheel if that is the case.)
Edit to clarify: The first build_pillow.cmd call when building Pillow is needed to make sure the correct compiler is used. The second one is needed because setuptools requires passing the same parameters to avoid rebuilding Pillow before making a wheel. If the second call can be avoided in some way, it would greatly simplify building wheels from an already built and tested build. However, I can't quite understand how build works in the time I have available at the moment, so it is possible I am misunderstanding it.
Note that I have a ton of work this week so I cannot look into this in detail until next week.
Switching to Edit: actually
Otherwise, we can keep the current |
No, it actually does rebuild (hence the name!) but does so in an isolated environment. It's a "build frontend" so it can do a full build, like pip. We might want to replace
Thanks! We're not in a rush for this. The July release will have beta wheels for Python 3.12, it would be nice this in there to get feedback before releasing with full support for 3.12 in the October release. Otherwise, it can likely wait until October. |
Co-authored-by: nulano <nulano@nulano.eu>
The essential part of this - adding pyproject.toml - is part of #7171, which we do plan to release in July. So I would think this should also be part of that release? |
Wrap arguments before passing in documentation
For #6941.
#7188 added setuptools to the CI installation for Python 3.12, because 3.12 dropped setuptools:
This is actually a bit bigger problem than the CI because users could theoretically have a system that does not have setuptools installed.
With pyproject.toml, we can specify the "build backend". In our case, this is setuptools. (The "build frontend" is what reads this file and does the install, often pip.)
So when installing, the frontend will install the required backend, so we don't need to worry whether users have already installed it. We can also specify a minimum version. I just went with the current latest, and it also seems we can remove the extra
PILLOW_VERSIONdouble quotes hack we needed for Windows on Python 3.8.It's also possible to move more config from
setup.cfgtopyproject.toml, but I ran into some problems when moving[options]and[options.extras_require]over, so let's leave those for later. We can also move the tools config, but that can also wait to keep the diff smaller here and the PR focused.About
winbuild/build_prepare.py: it had a direct invocation ofsetup.pywhich is a no-go because it assumes setuptools is already installed. So we needpip installinstead (reminder of https://blog.ganssle.io/tag/setuptools.html).I went with
--global-optionfor now, to follow the current approach elsewhere, but that will need changing as part of #7167.I did hit one blocker though:
test-windows.ymlbuilds a wheel, it calls:Before, that was handled by this:
Which wrote out a command that was called like:
Now, those two args
--disable-imagequant bdist_wheeleach need wrapping as--global-option="--disable-imagequant" --global-option="bdist_wheel"But this PR does:
And those two args were both passed into
%*meaning they both were wrapped in a singleglobal-optionwhich doesn't work, so it doesn't build the wheel:Any ideas?
Maybe replace the
build_pillow.cmdcall entirely, and use something like https://pypi.org/project/build/ to callpython -m build --wheel?