Skip to main content

Cross-platform terminal controllable via Python (and web)

Project description

decterm

Cross-platform terminal you can drive from Python. Run shell commands and get output, with or without a GUI.

  • No GUI (default): headless, ideal for scripts and servers.
  • GUI mode: live terminal window (tkinter) where you can type commands and see output.

Quick start

pip install decterm
from decterm import DecTerm

# Headless
dt = DecTerm()
print(dt.send("dir"))       # or "ls" on Unix
print(dt.sends("cd /tmp", "pwd"))
dt.close()

# With GUI
dt = DecTerm(gui=True)
dt.send("echo Hello")
# Type commands in the window, then:
dt.close()

API (concise)

Method Description
DecTerm(gui=False, cwd=None, env=None) Start a shell. gui=True opens a terminal window.
send(cmd, timeout=30) Run one command, return output. Times out for interactive programs (e.g. python).
sends(*cmds, timeout=30) Run several commands in order; returns last command’s output.
close() Stop the shell.

Use timeout=None in send() to wait indefinitely.

Requirements

  • Python 3.7+
  • Windows, macOS, or Linux
  • No extra packages (uses only the standard library, including tkinter for GUI).

License

MIT

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

decterm-0.1.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

decterm-0.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for decterm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3886f8984c9def560bdf41c4dc1bbe0d7a31e65cde315868872e2398f44c78a6
MD5 809eec3dfb448a84b3d2ee7ebfea2ce0
BLAKE2b-256 b151134d00b80a431112a62342f264e32af426f18f3d736d0328bf29b219e951

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for decterm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57bb1aa06746ace1aad9b2c65389055d8a731f70ad9b04716db2600d5c5d6900
MD5 4df40e259fcaf9b97f0c53dcb6aba99e
BLAKE2b-256 d57fefd572ce0f9cbf06639f78aa535b621c0f62a9a57c65f46d3673b3c63be3

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