[Python-ideas] Suprocess functionality partitioning

Ronald Oussoren ronaldoussoren at mac.com
Thu Jun 13 08:13:50 CEST 2013


On 12 Jun, 2013, at 21:32, anatoly techtonik <techtonik at gmail.com> wrote:

> Something needs to be done about subprocess API, which got overly complicated.
> 
> The idea is to have:
>   shutil.run()  - run command through shell, unsafe
>   sys.run()    - run command directly in operating system, ?safe
> 
> Both should be API compatible (unblocking stdin/stdout read etc.).
> Currently, subprocess calls are unreadable in any Python code - many
> conditions makes its behaviour hard to predict and memorize. By
> partitioning shell and out-of-shell execution, the documentation will be
> easier to grasp and reference to. Maybe it will be even possible to add
> some 2D table of various subprocess states that affect behavior.

I'm far from convinced that splitting the functionality in this way 
is an improvement over the subprocess API, there is a signifant risk that
you'll end up with two APIs that are awfully similar and you'd still have
to know about those. 

Most of the complexity of the subprocess API is not due to the "shell" keyword
argument, but is mostly caused by just having an awfull lot of feature that
are all needed for a generic solution.

The best way forward with your proposal is IMHO to start a project on PyPI
to make it possible to iterate fast with community feedback. Possible stdlib
inclusing can then be discussed when that project is stable and has a 
signifant userbase. 

With the current packaging ecosystem, and upcoming improvements, it might
not even be necessary to add it to the stdlib at that point.

Ronald



More information about the Python-ideas mailing list