- Add IBM i platform detection:
OS400/is_os400(), recognized viasys.platform == "os400"(reported by Python 3.9+ in IBM i's AIX-compatible PASE runtime). Grouped underUNIX_LAYERSalongside Cygwin. - Detect the active shell on Windows by walking the parent process tree via the Win32 Tool Help API (
CreateToolhelp32Snapshot), where neither/procnorpsexists.is_powershell(),is_cmd(), Git Bash detection throughis_bash(),current_shell()arbitration, andcurrent_shell_path()now rely on the actual ancestor processes rather than only thePROMPT/PSModulePathenvironment variables. Executable paths are resolved withQueryFullProcessImageNameW. Thectypesbindings live in a newextra_platforms._windowsmodule, imported lazily and only on Windows. - Add
current_shell_path()returning the executable path of the current shell (from the process tree when available, falling back toSHELL).Shell.info()now exposes the running shell's binary in its"path"field instead of always returning the configured login shell fromSHELL. - Detect interpreter-hosted shells like Xonsh, which runs as a Python script so the process tree shows
pythonrather thanxonsh. The tree walk scans interpreter arguments for the shell's launcher file, matching only an existing file named exactly after the shell to avoid false positives. A newinterpreterfield onShelldeclares the host interpreter (XONSHsets it topython). - Recognize shells running under a user-mode CPU emulator: under foreign-architecture emulation (like
docker run --platform linux/arm64on an x86 host), the process tree showsqemu-aarch64 /bin/bash …rather thanbash; the walk strips a leadingqemu-<arch>(orrosetta) wrapper and reads the emulated command, composing with interpreter-hosted detection. - Detect the active shell on illumos, Solaris, and AIX/IBM i. Their System V
/procexposes process status as binarypstatus_twith no/proc/<pid>/cmdlineorexe: the/procwalk previously raisedUnicodeDecodeError, crashingcurrent_shell(). It now reads/procrecords as bytes and falls back topswhen/procyields nothing. Thepsinvocation uses the portable POSIX form (-o pid=,ppid=,args=) with positional parsing of empty headers, working across the System Vpsof all three. - Extend shell detection via the process tree to macOS and the BSDs: the
/proc-based walk was Linux-only, and theps-based fallback now covers macOS, FreeBSD, DragonFly, and other systems without/proc. The walk also recognizes login shells (argv[0]like-bash), survives an unreadable/proc/<pid>/exevia/proc/<pid>/cmdline, and reads parent PIDs from BSD procfs layout (/proc/<pid>/status). - Render GitHub-style alerts (
> [!NOTE],> [!WARNING], …) as admonitions in the documentation by enabling MyST'salertextension (requiresmyst-parser>=5.1). - Drop the
types-requeststyping stub and the now-emptytypingdependency group, and requirerequests>=2.34, which ships inline type hints (PEP 561).
Full changelog: v12.0.3...v13.0.0