Skip to main content

Support for writing shell scripts in Python

Project description

Pyshell

A python module for writing shell-scripts in Python. It introduces new functionality, bundles functions distributed over several modules of Python's standard library in one place and provides several auxiliary functions.

The function's provided by the shell module are named after the corresponding Unix commands.

Here's a quick demo:

from shell import *

rm('a/b/foo.txt')
mv('X.pdf', f'{HOME}/contents.pdf')

files = ls('Documents', '*.txt', '*.c')
magicFiles = run(['grep', 'magic'] + files, captureStdout=splitLines, onError='ignore').stdout

Changelog

  • 0.4.0 (2024-03-20)

    • re-implement run in terms of subprocess.run. This fixes a bug that caused stdout to disappear.
  • 0.3.0 (2024-02-01)

    • uniform treatment when capturing stdout and stderr. This lead to changes to RunResult and RunError which are slightly backwards incompatible.
  • 0.2.0 (2024-01-29)

    • Better static type information
  • 0.1.7 (2023-03-30)

    • force parameter for cp
  • 0.1.5 and 0.1.6 (2023-03-03)

    • Some bugfixes
  • 0.1.4 (2022-03-17)

    • Flush stdout and stderr before running a command

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libPyshell-0.4.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

libPyshell-0.4.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file libPyshell-0.4.0.tar.gz.

File metadata

  • Download URL: libPyshell-0.4.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for libPyshell-0.4.0.tar.gz
Algorithm Hash digest
SHA256 e1c571972657f85040d0066cc184a3a950bc2381c2bb2470c3664164e06edef6
MD5 ab37791bfe1c0ac8282c043ee31f7ad2
BLAKE2b-256 45c118dee65e3b26b4ec3936ff4fc56b4a53eb35e5098154da4dd426bb89fd27

See more details on using hashes here.

File details

Details for the file libPyshell-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: libPyshell-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for libPyshell-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aea3664ccf6c5cae9029cf66deea2a8510ad7326fd0a7419fed961487f29453c
MD5 b58e5c78d1d7688a0696a373f34e80b4
BLAKE2b-256 d7327af0504236b83f5428c0e442fc47974a96e6e74af8da33d76ee6f3aa8b7b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page