Shellingham is a Python library designed to detect the current shell environment, aiding in tasks like shell completion. The latest version is 1.5.4, released on March 28, 2026. It is actively maintained with a release cadence of approximately one release every few months.
pip install shellinghamVerified import paths — ran on the pinned version, not inferred.
Quickstart example to detect and print the current shell environment.
Update your code to handle the tuple return type from detect_shell.
Replace calls to 'get_shell' with 'detect_shell'.
Implement error handling for `shellingham._core.ShellDetectionFailure` around calls to `detect_shell` (e.g., using a `try-except` block) to gracefully handle scenarios where the shell cannot be detected.
pip install shellingham
Ensure the `SHELL` environment variable is correctly set, or that the execution environment allows `shellingham` to inspect process information. If the environment genuinely lacks a detectable shell, handle this exception in your code (e.g., by providing a fallback shell).
Use the correct function or class name, such as `detect_shell`. For example: `from shellingham import detect_shell`.
Use the correct attribute name, such as `shellingham.detect_shell()`.