This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: subprocess.run documentation does not have **kwargs
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: berker.peksag, docs@python, miss-islington, oprypin, xdegaye
Priority: normal Keywords: easy, patch

Created on 2017-12-20 20:47 by oprypin, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 7289 merged rixx, 2018-05-31 20:20
PR 7423 merged miss-islington, 2018-06-05 11:43
PR 7489 merged berker.peksag, 2018-06-07 19:01
Messages (9)
msg308810 - (view) Author: Oleh Prypin (oprypin) Date: 2017-12-20 20:47
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.
msg308823 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2017-12-20 21:26
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 ?
msg308824 - (view) Author: Oleh Prypin (oprypin) Date: 2017-12-20 21:28
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.
msg316776 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2018-05-16 07:53
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/3055c947f98a078bd10d6a8cc352048a1b771d60/Doc/library/subprocess.rst#using-the-modsubprocess-module
msg316869 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2018-05-16 21:09
> Let's add 'env=None' to the signature of subprocess.run():

+1
msg318738 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2018-06-05 11:41
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/af1ec97a6d1dde68b2dc0ee9b78965eb219061a8
msg318740 - (view) Author: miss-islington (miss-islington) Date: 2018-06-05 12:03
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/23b7ee205270320f836e93e411b28ac995cbabf1
msg318962 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2018-06-07 19:22
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/279564431e8e2fa4c20e8850420caea484a5d20b
msg318963 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2018-06-07 19:23
Thanks!
History
Date User Action Args
2022-04-11 14:58:55adminsetgithub: 76573
2018-06-07 19:23:19berker.peksagsetstatus: open -> closed
resolution: fixed
messages: + msg318963

stage: patch review -> resolved
2018-06-07 19:22:37berker.peksagsetmessages: + msg318962
2018-06-07 19:01:05berker.peksagsetpull_requests: + pull_request7114
2018-06-05 12:03:04miss-islingtonsetnosy: + miss-islington
messages: + msg318740
2018-06-05 11:43:02miss-islingtonsetpull_requests: + pull_request7048
2018-06-05 11:41:44berker.peksagsetmessages: + msg318738
2018-05-31 20:20:01rixxsetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request6916
2018-05-16 21:09:04xdegayesetmessages: + msg316869
2018-05-16 07:53:58berker.peksagsettype: enhancement
versions: + Python 3.6, Python 3.8
keywords: + easy
nosy: + berker.peksag

messages: + msg316776
stage: needs patch
2017-12-20 21:28:14oprypinsetmessages: + msg308824
2017-12-20 21:26:36xdegayesetnosy: + xdegaye
messages: + msg308823
2017-12-20 20:47:11oprypincreate