[issue32392] subprocess.run documentation does not have **kwargs

New submission from Oleh Prypin <blaxpirit@gmail.com>: I was just looking at documentation of https://docs.python.org/3.6/library/subprocess.html#subprocess.run and thought that it doesn't support passing `env` because the list of supported keyword arguments is exhaustive (no **kwargs). But it does support passing **kwargs to Popen, so that should be specified in the docs. ---------- assignee: docs@python components: Documentation messages: 308810 nosy: docs@python, oprypin priority: normal severity: normal status: open title: subprocess.run documentation does not have **kwargs versions: Python 3.7 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue32392> _______________________________________

Xavier de Gaye <xdegaye@gmail.com> added the comment: But the documentation does say "The arguments shown above are merely the most common ones...The full function signature is largely the same as that of the Popen constructor...", no ? ---------- nosy: +xdegaye _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue32392> _______________________________________

Oleh Prypin <blaxpirit@gmail.com> added the comment: Yes, but the most prominent thing to indicate that is **kwargs in the actual function signature. And, as far as I'm concerned, lack of **kwargs means the function signature is exhaustive and there's no point in looking for fine print somewhere in the middle of the textual description. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue32392> _______________________________________

Berker Peksag <berker.peksag@gmail.com> added the comment: I agree with Xavier's comment, but I've bitten by this before so I think it would be better if we add more common arguments to the subprocess.run() signature. Adding **kwargs wouldn't be entirely correct since subprocess.run() doesn't pass all its arguments to subprocess.Popen(). Let's add 'env=None' to the signature of subprocess.run(): .. function:: run(args, *, stdin=None, input=None, stdout=None, stderr=None,\ shell=False, cwd=None, timeout=None, check=False, \ encoding=None, errors=None, text=None) https://github.com/python/cpython/blob/3055c947f98a078bd10d6a8cc352048a1b771... ---------- keywords: +easy nosy: +berker.peksag stage: -> needs patch type: -> enhancement versions: +Python 3.6, Python 3.8 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue32392> _______________________________________

Xavier de Gaye <xdegaye@gmail.com> added the comment:
Let's add 'env=None' to the signature of subprocess.run():
+1 ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue32392> _______________________________________

Change by Tobias Kunze <r@rixx.de>: ---------- keywords: +patch pull_requests: +6916 stage: needs patch -> patch review _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue32392> _______________________________________

Berker Peksag <berker.peksag@gmail.com> added the comment: New changeset af1ec97a6d1dde68b2dc0ee9b78965eb219061a8 by Berker Peksag (Tobias Kunze) in branch 'master': bpo-32392: Document env keyword argument of subprocess.run() (GH-7289) https://github.com/python/cpython/commit/af1ec97a6d1dde68b2dc0ee9b78965eb219... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue32392> _______________________________________

Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- pull_requests: +7048 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue32392> _______________________________________

miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset 23b7ee205270320f836e93e411b28ac995cbabf1 by Miss Islington (bot) in branch '3.7': bpo-32392: Document env keyword argument of subprocess.run() (GH-7289) https://github.com/python/cpython/commit/23b7ee205270320f836e93e411b28ac995c... ---------- nosy: +miss-islington _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue32392> _______________________________________

Change by Berker Peksag <berker.peksag@gmail.com>: ---------- pull_requests: +7114 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue32392> _______________________________________

Berker Peksag <berker.peksag@gmail.com> added the comment: New changeset 279564431e8e2fa4c20e8850420caea484a5d20b by Berker Peksag in branch '3.6': [3.6] bpo-32392: Document env keyword argument of subprocess.run() (GH-7289) https://github.com/python/cpython/commit/279564431e8e2fa4c20e8850420caea484a... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue32392> _______________________________________

Berker Peksag <berker.peksag@gmail.com> added the comment: Thanks! ---------- resolution: -> fixed stage: patch review -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue32392> _______________________________________
participants (5)
-
Berker Peksag
-
miss-islington
-
Oleh Prypin
-
Tobias Kunze
-
Xavier de Gaye