skillfed

shellingham

Tool to Detect Surrounding Shell

shellingham Permissive license ISC License Active 319 v1.5.4 released

Install

shellingham on PyPI

pip

pip install shellingham

uv

uv add shellingham

poetry

poetry add shellingham

Package facts

License ISC License (permissive)
Python support supports the current Python release (>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 1,024 days since the last release
Last repo commit
First released
Popularity one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13)
Known vulnerabilities none known (OSV.dev, checked 2026-08-13)

Evidence: shellingham-1.5.4-py2.py3-none-any.whl

Keywords: shell

Development Status :: 3 - AlphaEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: ISC License (ISCL)Operating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules

About shellingham

from the package's own PyPI description — quoted content, verbatim

============================================= Shellingham: Tool to Detect Surrounding Shell =============================================

.. image:: https://img.shields.io/pypi/v/shellingham.svg :target: https://pypi.org/project/shellingham/

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...

Read as markdown · JSON record · Source repository · Homepage

AI interpretation — verify before relying

AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page

Shellingham detects which shell the current Python process is running in and returns both the shell name and its command path. It raises ShellDetectionFailure if no shell is detected.

Installs with no runtime dependencies and low friction. The package is actively maintained with recent commits and has been stable since 2018, supporting Python 3.7–3.12.

Licensed under ISC (permissive), allowing free use, modification, and distribution with minimal restrictions—suitable for both open and closed-source projects.

Usage

import shellingham

try:
    shell_name, shell_path = shellingham.detect_shell()
    print(f"Shell: {shell_name} at {shell_path}")
except shellingham.ShellDetectionFailure:
    print("No shell detected")

Requires Python 3.7 or later; shell detection may fail if the process is not running in an interactive shell environment.

Verdict: A lightweight, zero-dependency utility for shell detection with a clean API and permissive license. Active maintenance, broad Python version support, and no known vulnerabilities make it a reliable choice for tools that need to identify the user's shell environment.

Needs verification

  • Whether shell detection works reliably across all POSIX and Windows environments in practice
  • Performance impact of the detection logic on startup time for CLI tools
detect shell environmentidentify current shellshell detection pythonget running shell nameshell path detectiondetermine shell typeshell environment inspection

Similar packages