Shell Driver
jumpstarter-driver-shell provides functionality for shell command execution.
Installation
:substitutions:
$ pip3 install --extra-index-url {{index_url}} jumpstarter-driver-shell
Configuration
The shell driver supports two configuration formats for methods:
Format 1: Simple String e.g. for self-descriptive short commands
export:
shell:
type: jumpstarter_driver_shell.driver.Shell
config:
methods:
ls: "ls"
echo_hello: "echo 'Hello World'"
Format 2: Unified Format with Descriptions
export:
shell:
type: jumpstarter_driver_shell.driver.Shell
config:
methods:
ls:
command: "ls -la"
description: "List directory contents with details"
deploy:
command: "ansible-playbook deploy.yml"
description: "Deploy application using Ansible"
# Multi-line commands work too
setup:
command: |
echo 'Setting up environment'
export PATH=$PATH:/usr/local/bin
./setup.sh
description: "Set up the development environment"
# Description-only (uses default "echo Hello" command)
placeholder:
description: "Placeholder method for testing"
# Custom timeout for long-running operations
long_backup:
command: "tar -czf backup.tar.gz /data && rsync backup.tar.gz remote:/backups/"
description: "Create and sync backup (may take a while)"
timeout: 1800 # 30 minutes instead of default 5 minutes
# You can mix both formats
simple_echo: "echo 'simple'"
# optional parameters
cwd: "/tmp"
log_level: "INFO"
shell:
- "/bin/bash"
- "-c"
Configuration Parameters
| Parameter | Description | Type | Required | Default |
|---|---|---|---|---|
methods |
Dictionary of methods. Values can be: - String: just the command - Dict: {command: "...", description: "...", timeout: ...} |
dict[str, str | dict] |
Yes | - |
cwd |
Working directory for shell commands | str |
No | None |
log_level |
Logging level | str |
No | "INFO" |
shell |
Shell command to execute scripts | list[str] |
No | ["bash", "-c"] |
timeout |
Command timeout in seconds | int |
No | 300 |
Method Configuration Options:
For the dict format, each method supports:
command: The shell command to execute (optional, defaults to"echo Hello")description: CLI help text (optional, defaults to"Execute the {method_name} shell method")timeout: Command-specific timeout in seconds (optional, defaults to globaltimeoutvalue)
Note: You can mix both formats in the same configuration - use string format for simple commands and dict format when you want custom descriptions or timeouts.
Usage
The shell driver also provides a CLI when using jmp shell. All configured methods become available as CLI commands, except for methods starting with _ which are considered private and hidden from the end user.
CLI Help Output
With unified format (custom descriptions):
$ jmp shell --exporter shell-exporter
$ j shell
Usage: j shell [OPTIONS] COMMAND [ARGS]...
Shell command executor
Commands:
deploy Deploy application using Ansible
ls List directory contents with details
setup Set up the development environment
With simple string format (default descriptions):
$ j shell
Usage: j shell [OPTIONS] COMMAND [ARGS]...
Shell command executor
Commands:
deploy Execute the deploy shell method
ls Execute the ls shell method
setup Execute the setup shell method
Mixed format example:
methods:
deploy:
command: "ansible-playbook deploy.yml"
description: "Deploy using Ansible"
restart: "systemctl restart myapp" # Simple format
Results in:
Commands:
deploy Deploy using Ansible
restart Execute the restart shell method
CLI Command Usage
Each configured method becomes a CLI command with the following options:
$ j shell ls --help
Usage: j shell ls [OPTIONS] [ARGS]...
Execute the ls shell method
Options:
-e, --env TEXT Environment variables in KEY=VALUE format
--help Show this message and exit.
Examples
# Execute simple commands
$ j shell ls
file1.txt file2.txt directory/
# Pass arguments to shell methods
$ j shell method3 "first arg" "second arg"
Hello World first arg
Hello World second arg
# Set environment variables
$ j shell env_var arg1 arg2 --env ENV_VAR=myvalue
arg1,arg2,myvalue
API Reference
Assuming the exporter driver is configured as in the example above, the client methods will be generated dynamically, and they will be available as follows:
.. autoclass:: jumpstarter_driver_shell.client.ShellClient
:members:
.. function:: ls()
:noindex:
:returns: A tuple(stdout, stderr, return_code)
.. function:: method2()
:noindex:
:returns: A tuple(stdout, stderr, return_code)
.. function:: method3(arg1, arg2)
:noindex:
:returns: A tuple(stdout, stderr, return_code)
.. function:: env_var(arg1, arg2, ENV_VAR="value")
:noindex:
:returns: A tuple(stdout, stderr, return_code)
Metadata
Release files for jumpstarter-driver-shell 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jumpstarter_driver_shell-0.9.0.tar.gz | 10.3 kB | Without provenance | Details for jumpstarter_driver_shell-0.9.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jumpstarter_driver_shell-0.9.0-py3-none-any.whl | Python 3 | none | any | Details for jumpstarter_driver_shell-0.9.0-py3-none-any.whl |
Total release size: 20.8 kB
Release files / jumpstarter_driver_shell-0.9.0.tar.gz
| Download URL | jumpstarter_driver_shell-0.9.0.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd57ce5a058c57c2c21423a3c4bf11e12368de6195506f899961fba06e8eb929
|
|
BLAKE2b-256 checksum How to use checksums |
388cc173e4613dcf48a5c45a3260262be0b319294aa78f5eefd6ee30e9b09886
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.22
|
Release files / jumpstarter_driver_shell-0.9.0-py3-none-any.whl
| Download URL | jumpstarter_driver_shell-0.9.0-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9780a452d060ab70be16ffa74e46070808d0025a77f6b7b2c02dd76c2b736362
|
|
BLAKE2b-256 checksum How to use checksums |
16debfe039e44cd4ee5d229677562f1371eab12e441980614cf8909125d7061a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.22
|
Security for jumpstarter-driver-shell 0.9.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.