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.5.0 (2025-03-11)

    • support of timeouts for run
  • 0.4.1 (2024-09-12)

    • fix capture handling
    • add failOnError option to rm commands
  • 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.5.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

libpyshell-0.5.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file libpyshell-0.5.0.tar.gz.

File metadata

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

File hashes

Hashes for libpyshell-0.5.0.tar.gz
Algorithm Hash digest
SHA256 fe9f2374aef9b456e937d39ab431a33034abfff62c00cce2410295a4393723d4
MD5 ef747be0a49a52fdcd12e3b6c932f94d
BLAKE2b-256 e239cbafc1ff61275dad05c8e93e66915a35d73afdae3e57b6292b185022986f

See more details on using hashes here.

File details

Details for the file libpyshell-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: libpyshell-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5253416e21c035ead8419ee224bf357c9fdaba048f5c1b1f788cacbb34029ac0
MD5 2119b2968bc55220e5005e9d7882f44c
BLAKE2b-256 182e2f87c0b3d59d87e14d03092b8bedc87f7a810baaea963fa60e647d966eae

See more details on using hashes here.

Supported by

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