Issue 30420: [doc] subprocess module: Clarify kwarg handing for convenience APIs (original) (raw)

As per the discussion in https://github.com/python/cpython/pull/1685, the current nominal signatures of the convenience APIs in subprocess is confusing, as they don't make it clear that all Popen keyword arguments are supported, with only the most common ones being listed in the signature.

Proposed fixes:

Background:

The status quo is that while this behaviour is documented, it's documented solely as text in the bodies of the API definitions, using paragraphs like the following:

run(): """The arguments shown above are merely the most common ones, described below in Frequently Used Arguments (hence the use of keyword-only notation in the abbreviated signature). The full function signature is largely the same as that of the Popen constructor - apart from timeout, input and check, all the arguments to this function are passed through to that interface."""

call(), check_call(): """The arguments shown above are merely the most common ones. The full function signature is largely the same as that of the Popen constructor - this function passes all supplied arguments other than timeout directly through to that interface."""

check_output(): """The arguments shown above are merely the most common ones. The full function signature is largely the same as that of run() - most arguments are passed directly through to that interface."""

While it's technically anecdotal, we still have pretty decent evidence that this isn't adequate as:

The working theory behind adding the appropriately named **kwargs parameters to the end of the nominal signatures is that it will give readers a clearer indication that we're not explicitly listing all the parameters, and a hint as to which API to go look at to find out more about the unlisted ones.

The just merged PR covers the "list cwd in the nominal signatures for run(), call(), check_call(), and check_output()" part of the proposal.

The rest of the proposed fixes are still pending a patch (and keeping in mind Martin's caveat on minimising duplication between the "Frequently Used Arguments" section and the full Popen documentation)