-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PEP 517: The "complete, working build backend" shown doesn't actually work #2536
Comments
@brettcannon is this a valid issue? If so, is it worth updating the PEP text for? |
PEP 517 is a historical document from 2017, so it's expected that something would break. |
@encukou That link seems to only talk about the source tree sdist layout, it's not mentioning the python hooks at all. Anyone implementing a build backend would have a hard time without seeing some hook specification .. :) |
PEP 517 (and 518, and 660) haven't yet been migrated to a specification on the PyPA specifications site; see pypa/packaging.python.org#955 . Its on my to-do list to help with, but its a fairly substantial project. I'm not sure its really that necessary to continue to keep a (self-described "terrible") toy example in an appendix up to date with changes in the internal implementation details of the |
I agree with CAM that I don't think it's worth updating the example. Best to put the effort into moving the spec over to packaging.python.org. |
@CAM-Gerlach Well, I'm not convinced it was ever working, even at the time of writing, because when I still think it would be good to have a real working example in there, especially while there is no better alternative on https://packaging.python.org/en/latest/specifications/ , the PEP is kind of an important one and is the closest thing we have to a spec currently. Maybe it could use an existing lib with an actual API such as distlib or wheelfile? |
It's been over two years now and there still doesn't appear to be any proper documentation of this - the PR for documentation on packaging.python.org has been held up for almost exactly two years, and the PEP has not been amended. Even with fixes to incorporate actual wheel creation (via
However, the example implements:
That is, the order of the optional
The different order in the example could lead the reader to expect keyword arguments, or could simply be overlooked (as I did). As a result, when I tested my custom backend I found that If it was intended that the frontend must pass the arguments by keyword, then they should have been documented as keyword-only arguments (i.e., using a bare IMO and in general, using keyword-or-positional parameters (especially ones with default values) when describing an interface for others to implement, is a bad idea. It isn't clear to the implementer whether the parameter name is important (because it's allowed to be passed by keyword) and/or whether the order is important (because it's allowed to be passed positionally). The safe assumption, of course, is that both are important; but this is user-unfriendly and defies some informal conventions (when there are multiple parameters that default to |
Determined that the order of parameters in the Appendix A example code was wrong, and fixed it. This matters because `pyproject_hooks` passes them positionally, despite that both default to `None` and it's not at all obvious what order they "should" be in. I commented on python/peps#2536, and cited pypa/packaging.python.org#1111, to draw attention to the issue in the PEP. The corresponding documentation issue, pypa/packaging.python.org#955, still appears not to be resolved.
The minimal example
mypackage_custom_build_backend.py
shown in the pep doesn't work.This is what you see using pip 22.0.4 if you try to use it:
I didn't bother seeing what happened to
wheel.archive
because the readme for that project clearly says:So probably it shouldn't be used as a library in this PEP?
The text was updated successfully, but these errors were encountered: