Registry / devops / shellingham

shellingham

JSON →
library1.5.4pypypi✓ verified 25d ago

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 shellingham
INSTALL
IMPORT
SIG · SHELLINGHAM
S
shellingham
devopspythonv1.5.4
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.5.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

detect_shell
from shellingham import detect_shell
Correct import path for the detect_shell function

Quickstart example to detect and print the current shell environment.

from shellingham import detect_shell shell, path = detect_shell() print(f"Detected shell: {shell}")
Debug
Known issues
breakingVersion 1.5.0 introduced a breaking change in the detect_shell function's return type, which now returns a tuple instead of a single string.
fix
Update your code to handle the tuple return type from detect_shell.
affects: 1.5.0
deprecatedThe 'get_shell' function is deprecated as of version 1.5.0 and will be removed in a future release.
fix
Replace calls to 'get_shell' with 'detect_shell'.
affects: 1.5.0
breakingThe `detect_shell` function can raise `shellingham._core.ShellDetectionFailure` if it fails to determine the current shell, which commonly occurs in environments without a clear shell context (e.g., certain container setups, non-interactive script execution, or environments where process introspection fails).
fix
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.
affects: 1.4.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'shellingham'
The `shellingham` library has not been installed in the current Python environment.
fix
pip install shellingham
shellingham.ShellDetectionFailure: Could not detect shell
`shellingham` was unable to determine the current shell environment, often due to a non-standard setup, missing `SHELL` environment variable, or running in an environment without an active shell process.
fix
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).
ImportError: cannot import name 'detects_shell' from 'shellingham'
You are attempting to import a function or class that either does not exist, or has a different name, within the `shellingham` library (e.g., a common typo like 'detects_shell' instead of 'detect_shell').
fix
Use the correct function or class name, such as `detect_shell`. For example: `from shellingham import detect_shell`.
AttributeError: module 'shellingham' has no attribute 'get_shell_info'
You are trying to access an attribute (like a function or class) on the `shellingham` module that does not exist or is misspelled. The primary function for detecting the shell is `detect_shell`.
fix
Use the correct attribute name, such as `shellingham.detect_shell()`.
Upgrade
Version history
1.5.4latest on PyPI · released Oct 24, 2023
Audit
Dependencies
certifirequiredEnsures up-to-date SSL certificates for secure connections
Agent activity
5 hits · last 30 days
node
4
Resources
shellingham — pip install shellingham · libregistry