python-shellingham
Port variant v14
Summary Tool to Detect Surrounding Shell (3.14)
Package version 1.5.4
Homepage https://github.com/sarugaku/shellingham
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v13
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 25 FEB 2026, 19:33:15 UTC
Port created 25 FEB 2026, 19:33:15 UTC
Subpackage Descriptions
single ============================================= Shellingham: Tool to Detect Surrounding Shell ============================================= Shellingham detects what shell the current Python executable is running in. Usage ===== .. code-block:: python >>> import shellingham >>> shellingham.detect_shell() ('bash', '/bin/bash') detect_shell pokes around the process's running environment to determine what shell it is run in. It returns a 2-tuple: * The shell name, always lowercased. * The command used to run the shell. ShellDetectionFailure is raised if detect_shell fails to detect the surrounding shell. Notes ===== * The shell name is always lowercased. * On Windows, the shell name is the name of the executable, minus the file extension. Notes for Application Developers ================================ Remember, your application's user is not necessarily using a shell. Shellingham raises ShellDetectionFailure if there is no shell to detect, but *your application should almost never do this to your user*. A practical approach to this is to wrap detect_shell in a try block, and provide a sane default on failure .. code-block:: python try: shell = shellingham.detect_shell() except shellingham.ShellDetectionFailure: shell = provide_default() There are a few choices for you to choose from. * The POSIX standard mandates the environment variable SHELL to refer to "the user's preferred command language interpreter". This is always available (even if the user is not in an interactive session), and likely the correct choice to launch an interactive sub-shell with. * A command sh is almost guaranteed to exist, likely at ``/bin/sh``, since several POSIX tools rely on it. This should be suitable if you want to run a (possibly non-interactive) script. * All versions of DOS and Windows have an environment variable COMSPEC. This can always be used to launch a usable command prompt (e.g. `cmd.exe` on Windows). Here's a simple implementation to provide a default shell .. code-block:: python import os def provide_default(): if os.name == 'posix': return os.environ['SHELL'] elif os.name == 'nt': return os.environ['COMSPEC'] raise NotImplementedError(f'OS {os.name!r} support not available')
Configuration Switches (platform-specific settings discarded)
PY313 OFF Build using Python 3.13 PY314 ON Build using Python 3.14
Package Dependencies by Type
Build (only) python314:dev:std
python-pip:single:v14
autoselect-python:single:std
Build and Runtime python314:primary:std
Download groups
main mirror://PYPIWHL/e0/f9/0595336914c5619e5f28a1fb793285925a8cd4b432c9da0a987836c7f822
Distribution File Information
7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686 9755 python-src/shellingham-1.5.4-py2.py3-none-any.whl
Ports that require python-shellingham:v14
python-typer:v14 Command line interface builder (3.14)