Skip to main content

Simplify the use of Bash/Shell commands in Python

Project description

GitHub license Unit Tests Project Status PyPI - Python Version PyPI

Py-Bash-Wrapper

(image of a cartoon snake on a $_)

Description

Py Bash Wrapper helps Python developers run bash/shell/subprocess commands with two convenience functions:

  • The run_command function provides no advances shell features likes pipes. This function takes in either a string or an argv list.
  • The run_bash function provides real Bash (e.g., pipes, redirects, globs, etc.). This function takes in a string.
  • Both functions support optional real-time streaming callbacks and file-object stdout/stderr passthrough for long-running operations.

Results come back as CommandResult with stdout, stderr, exit code, and an ok flag; The argument check=True will cause failures to raise a CommandError.

Installation

From PyPI:

pip install py_bash_wrapper

Documentation

Security note

run_bash executes shell code. Do not pass untrusted input as the Bash command string. Prefer run_command with a fixed argv when shell features are not required. See docs/usage_examples.md.

Initial setup

Prerequisites:

  • uv (package and tool runner):
    • macOS: brew install uv (see Homebrew if needed).
    • Other: Installing uv (official installer and package managers).
  • make:
    • macOS: Xcode Command Line Tools or a build toolchain that provides make.
    • Linux: install build-essential.
    • Windows: use Git Bash, WSL, or another environment that provides make, or run the same uv run ... commands from the Makefile by hand.
  • Python 3.11+: install via OS package manager, via uv with uv python install 3.11, or via python.org.

Versioning

Releases follow SemVer.

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

py_bash_wrapper-0.3.9.tar.gz (27.7 kB view details)

Uploaded Source

Built Distribution

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

py_bash_wrapper-0.3.9-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file py_bash_wrapper-0.3.9.tar.gz.

File metadata

  • Download URL: py_bash_wrapper-0.3.9.tar.gz
  • Upload date:
  • Size: 27.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for py_bash_wrapper-0.3.9.tar.gz
Algorithm Hash digest
SHA256 f66d5b7dab54f4e961c55155b7c45e6660415a21a0adf14f05972dcb4fb95333
MD5 322e0c95193041ecbf8fedfe2e3b75c5
BLAKE2b-256 ee23e1dc2a3911e40bdc7f5e93c5b1a2b81d2b9497c27091a307b11f304e9567

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_bash_wrapper-0.3.9.tar.gz:

Publisher: release-from-version.yml on themarkrogers/py_bash_wrapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_bash_wrapper-0.3.9-py3-none-any.whl.

File metadata

  • Download URL: py_bash_wrapper-0.3.9-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for py_bash_wrapper-0.3.9-py3-none-any.whl
Algorithm Hash digest
SHA256 144f0cec686dfae3179827e39f80be999003c3ba61ff8af840acf42b12e4b589
MD5 29fca0ef4d1c302e7eb78fc5cbb70234
BLAKE2b-256 55b07a3f7d47ad56c4bcef7e7979edef9eb280e97654bcb66e16d1b4ec861a98

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_bash_wrapper-0.3.9-py3-none-any.whl:

Publisher: release-from-version.yml on themarkrogers/py_bash_wrapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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