{"id":339,"library":"shellingham","title":"Shellingham: Tool to Detect Surrounding Shell","description":"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.","status":"active","version":"1.5.4","language":"python","source_language":"en","source_url":"https://github.com/sarugaku/shellingham","tags":["shell detection","environment","Python","CLI","tool"],"install":[{"cmd":"pip install shellingham","lang":"bash","label":"Install Shellingham"}],"dependencies":[{"reason":"Ensures up-to-date SSL certificates for secure connections","package":"certifi","optional":false}],"imports":[{"note":"Correct import path for the detect_shell function","symbol":"detect_shell","correct":"from shellingham import detect_shell"}],"quickstart":{"code":"from shellingham import detect_shell\n\nshell, path = detect_shell()\nprint(f\"Detected shell: {shell}\")","lang":"python","description":"Quickstart example to detect and print the current shell environment."},"warnings":[{"fix":"Update your code to handle the tuple return type from detect_shell.","message":"Version 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.","severity":"breaking","affected_versions":"1.5.0"},{"fix":"Replace calls to 'get_shell' with 'detect_shell'.","message":"The 'get_shell' function is deprecated as of version 1.5.0 and will be removed in a future release.","severity":"deprecated","affected_versions":"1.5.0"},{"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.","message":"The `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).","severity":"breaking","affected_versions":"1.4.0"}],"env_vars":null,"last_verified":"2026-05-12T13:10:11.365Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"pip install shellingham","cause":"The `shellingham` library has not been installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'shellingham'"},{"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).","cause":"`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.","error":"shellingham.ShellDetectionFailure: Could not detect shell"},{"fix":"Use the correct function or class name, such as `detect_shell`. For example: `from shellingham import detect_shell`.","cause":"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').","error":"ImportError: cannot import name 'detects_shell' from 'shellingham'"},{"fix":"Use the correct attribute name, such as `shellingham.detect_shell()`.","cause":"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`.","error":"AttributeError: module 'shellingham' has no attribute 'get_shell_info'"}],"ecosystem":"pypi","meta_description":null,"install_score":80,"install_tag":"verified","quickstart_score":80,"quickstart_tag":"verified","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0,"mem_mb":0.1,"disk_size":"17.9M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0,"mem_mb":0.1,"disk_size":"18M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0,"mem_mb":0.1,"disk_size":"19.7M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0,"mem_mb":0.1,"disk_size":"20M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0,"mem_mb":0.1,"disk_size":"11.6M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0,"mem_mb":0.1,"disk_size":"12M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0,"mem_mb":0,"disk_size":"11.2M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0,"mem_mb":0,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0,"mem_mb":0.1,"disk_size":"17.3M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0,"mem_mb":0.1,"disk_size":"18M"}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"verified","tag_description":"quickstart runs on critical runtimes, recently tested","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}}