Skip to main content

Safe subprocess wrapper (list-only, no shell injection) with stream/timeout support — standalone module from the SciTeX ecosystem

Project description

scitex-sh

Safe subprocess wrapper extracted from the SciTeX ecosystem as a standalone, zero-dep package.

List-only (no shell-string parsing) → no shell-injection. Stream output, timeouts, structured ShellResult return.

Install

pip install scitex-sh

API

import scitex_sh as sh

# Dict result with stdout/stderr/returncode/success
res = sh.sh(["git", "status"])
# {"success": True, "stdout": "...", "stderr": "", "returncode": 0, ...}

# String result
out = sh.sh(["ls", "-la"], return_as="str")

# Streamed
sh.sh(["./long-running.sh"], stream_output=True)

# Timeout
sh.sh(["sleep", "10"], timeout=2)

# Lower-level
res = sh.sh_run(["echo", "hi"])
sh.quote("hello world")  # 'hello world' (POSIX-quoted)

Status

Standalone fork of scitex.sh. Zero deps (pure stdlib). The umbrella package's scitex.sh import path is preserved via a sys.modules-alias bridge. The scitex.str.color_text dep used for terminal output is replaced with a tiny inline ANSI helper that respects NO_COLOR and TTY detection.

License

AGPL-3.0-only (see LICENSE).

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

scitex_sh-0.1.0.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

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

scitex_sh-0.1.0-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file scitex_sh-0.1.0.tar.gz.

File metadata

  • Download URL: scitex_sh-0.1.0.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for scitex_sh-0.1.0.tar.gz
Algorithm Hash digest
SHA256 253befe0d736ddffca8e919652397ece901667fb38f45cc8c8c84d894209b5cc
MD5 df80a96233a4fb979dd43977a4410501
BLAKE2b-256 eb3bb13104212ec1ea2e6a09b1cbfd457b018d15d7c3e95b467e717480e7c4f8

See more details on using hashes here.

File details

Details for the file scitex_sh-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: scitex_sh-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for scitex_sh-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b6ebd3bc30e85773591a153ad308cce18b46353d1e48ceddc2aea48d0b0ce92
MD5 fa62bd19d677c1e9c6f59ac87357be9b
BLAKE2b-256 a2788267bcc4fdf66e512ab4e1f11c57ec5542b2cf3f9324806cdb5b2863c6bc

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