Skip to main content

cmding

Cmder is a simple module which aims to bring enjoyable experience for running shell commands in Python.

By wrapping Python subprocess.Popen, cmder provides a convenient way for you to run any shell command through Python and offers some additional features.

Installation

pip install cmder

Features

  • Running any command using either a string or a list.
  • Running any command like you run them from the shell. The pipe and redirection operations are native permitted due to the pre-filled argument shell=True.
  • Automatically reformat the command. Break long command string into multiple lines and format them nicely.
  • Profile command running time and memory usage. Using /usr/bin/time to profile the time and memory usage of the running command.

Usage

Import the module and call run the same way you call subprocess.run with two additional keyword argument: msg and pmt. msg cam be a simple string for display a message before and after running the command. Set pmt to True or False will enable or disable time and memory profiling feature. Since cmder.run wrappers subprocess.Popen, all other keyword arguments allowed for subprocess.Popen are also allowed here.

import cmder
cmder.run('ls -lh', msg='List files with details ...', pmt=True)

Note:

  • Without a message string passed by msg, profiling time and memory will be ignored even the pmt argument was set to True.

Limitations

  1. Since the time and memory profiling depends on GNU version /usr/bin/time, it does not work on BSD system.
  2. Since the argument shell=True was pre-filled when call subprocess.Popen, user should be aware of the potential security issue and use this module with caution.

Metadata

Release files for cmder 5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cmder 5.0
File Size Uploaded
cmder-5.0.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cmder 5.0
File Interpreter ABI Platform
cmder-5.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.4 kB

Release files / cmder-5.0.tar.gz

Download URL cmder-5.0.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e7787993e5340ff3bef5d60d68ba60981ebe001c458d1654c23b27851fc53a60
BLAKE2b-256 checksum
How to use checksums
150fa9eae1b1175e45668630d3e2938858a6f99fba7ddede30f73fd82111a107
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / cmder-5.0-py3-none-any.whl

Download URL cmder-5.0-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0ec07bc2d4ea29bbbdbcd6e30fd655de08d8f717d60971b86b0d657dd74303d
BLAKE2b-256 checksum
How to use checksums
17c8eb65662fc83a0590f9071f49c93001a35e1f1cbbaef2a919716bd32ace51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

5.0 This release

2 release files

4.0

2 release files

3.8

2 release files

3.7

2 release files

3.6

2 release files

3.5

2 release files

3.4

2 release files

3.3

2 release files

3.2

2 release files

3.1

2 release files

2.0

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page