On 22 May 2017 at 15:23, Nick Coghlan <ncogh...@gmail.com> wrote: > No, that's discussed here: > https://www.python.org/dev/peps/pep-0517/#comparison-to-competing-proposals > > Even though PEP 517 defines a Python API for build backends to > implement, it still expects installation tools to wrap a subprocess > call around the backend invocation.
OK, but is it not acceptable for the child cmdline process (owned by pip) to capture the backend implementation's stdout using reassignment of sys.stdout? I assume, from your response, that it's *not* acceptable to do that - but that needs to be documented somewhere. Specifically, that the child cmdline is not allowed to do something like: out = io.StringIO sys.stdout = out build_backend.hook() print(out.getvalue(), encoding="UTF-8") (Which would otherwise be a very simple way to get guaranteed UTF-8 as the encoding across the process boundary - but it does so by imposing basically the rules I stated on the backend). > That said, the whole "The build backend still runs in a subprocess" > aspect should probably be separated out into its own section > "Isolating build backends from frontend process state", rather than > solely being covered in the "Comparison to PEP 516?" section, as it's > a key aspect of the design - we expect each installation tool to > provide its own CLI shim for calling build backends, rather than > requiring all installation tools to use the same one. Strong +1. And that section needs to be very clear on issues like this, covering what the shim is allowed to do. As the point of the shim is to protect the backend from frontend state, I'm OK with the general principle that the shim must do "as little as possible" before calling the hook - but "reset sys.stdout to protect against encoding errors" could easily be seen as within the realm of acceptable behaviour (as it stops hooks writing arbitrary Unicode to a standard output that the shim knows is limited). I'm happy enough with the idea that pip won't do anything silly in its CLI shim, but we don't want to get into the "implementation as the standard" situation where a backend is allowed to do anything that pip's shim can cope with... Paul _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig