Skip to content

Shell in Python

Existing Python libraries

Shell -> Python converter / compilier

See also:

Type-safe shell scripting

Misc

Misc ideas for a new API

Goals:

  • Ease / naturalness of use
  • Type safety

Shell object: shell = Shell()

Run something: result = shell.ls()

With options: result = shell.ls(l=True) (== ls -l).

Errors recovery:

try:
    result = shell.ls()
except ShellException as e:
    print(e.status)

Strong typing: generate .pyi files for common commands ? By parsing man pages ?

Piping: shell.ls().pipe.grep('*.py') ? bof.

shell.pipe(shell.ls(), shell.grep('*.py') ? (Needs to parse AST inside the pip argument).

Back to top