Detection

All detection functions

Detection function

Icon

Associated symbol

is_aarch64()

📱

AARCH64

is_aix()

AIX

is_alacritty()

🔳

ALACRITTY

is_alpine()

🏔️

ALPINE

is_altlinux()

Δ

ALTLINUX

is_amzn()

AMZN

is_android()

🤖

ANDROID

is_any_agent()

🧠

ALL_AGENTS

is_any_architecture()

🏛️

ALL_ARCHITECTURES

is_any_arm()

📱

ALL_ARM

is_any_ci()

ALL_CI

is_any_mips()

🔲

ALL_MIPS

is_any_platform()

⚙️

ALL_PLATFORMS

is_any_shell()

🐚

ALL_SHELLS

is_any_sparc()

☀️

ALL_SPARC

is_any_terminal()

💻

ALL_TERMINALS

is_any_trait()

ALL_TRAITS

is_any_windows()

🪟

ALL_WINDOWS

is_apple_terminal()

🍏

APPLE_TERMINAL

is_arch()

🎗️

ARCH

is_arch_32_bit()

³²

ARCH_32_BIT

is_arch_64_bit()

⁶⁴

ARCH_64_BIT

is_arm()

📱

ARM

is_armv5tel()

📱

ARMV5TEL

is_armv6l()

📱

ARMV6L

is_armv7l()

📱

ARMV7L

is_armv8l()

📱

ARMV8L

is_ash()

🪶

ASH

is_azure_pipelines()

AZURE_PIPELINES

is_bamboo()

BAMBOO

is_bash()

BASH

is_big_endian()

⬆️

BIG_ENDIAN

is_bourne_shells()

💲

BOURNE_SHELLS

is_bsd()

BSD

is_bsd_not_macos()

🅱️

BSD_WITHOUT_MACOS

is_buildkite()

🪁

BUILDKITE

is_buildroot()

⛑️

BUILDROOT

is_c_shells()

🅲

C_SHELLS

is_cachyos()

CACHYOS

is_centos()

💠

CENTOS

is_circle_ci()

CIRCLE_CI

is_cirrus_ci()

CIRRUS_CI

is_claude_code()

✴️

CLAUDE_CODE

is_cline()

👾

CLINE

is_cloudlinux()

CLOUDLINUX

is_cmd()

CMD

is_codebuild()

CODEBUILD

is_contour()

CONTOUR

is_csh()

𝐂

CSH

is_cursor()

CURSOR

is_cygwin()

Ͼ

CYGWIN

is_dash()

💨

DASH

is_debian()

🌀

DEBIAN

is_dragonfly_bsd()

🪰

DRAGONFLY_BSD

is_exherbo()

🐽

EXHERBO

is_fedora()

🎩

FEDORA

is_fish()

🐟

FISH

is_foot()

🦶

FOOT

is_freebsd()

😈

FREEBSD

is_generic_linux()

🥚

GENERIC_LINUX

is_gentoo()

🗜️

GENTOO

is_ghostty()

👻

GHOSTTY

is_github_ci()

🐙

GITHUB_CI

is_gitlab_ci()

🦊

GITLAB_CI

is_gnome_terminal()

𝐆

GNOME_TERMINAL

is_gnu_screen()

📺

GNU_SCREEN

is_gpu_terminals()

🎮

GPU_TERMINALS

is_guix()

🐃

GUIX

is_haiku()

🍂

HAIKU

is_heroku_ci()

HEROKU_CI

is_hurd()

🦬

HURD

is_hyper()

HYPER

is_i386()

𝗶

I386

is_i586()

𝗶

I586

is_i686()

𝗶

I686

is_ibm_mainframe()

🏢

IBM_MAINFRAME

is_ibm_powerkvm()

🤹

IBM_POWERKVM

is_illumos()

🔥

ILLUMOS

is_iterm2()

ITERM2

is_kali()

🔱

KALI

is_kitty()

🐱

KITTY

is_konsole()

💎

KONSOLE

is_ksh()

𝐊

KSH

is_kvmibm()

🤹

KVMIBM

is_linux()

🐧

LINUX

is_linux_layers()

LINUX_LAYERS

is_linux_like()

🐣

LINUX_LIKE

is_linuxmint()

🌿

LINUXMINT

is_little_endian()

⬇️

LITTLE_ENDIAN

is_loongarch()

🐉

LOONGARCH

is_loongarch64()

🐉

LOONGARCH64

is_macos()

🍎

MACOS

is_mageia()

MAGEIA

is_mandriva()

💫

MANDRIVA

is_manjaro()

MANJARO

is_midnightbsd()

🌘

MIDNIGHTBSD

is_mips()

🔲

MIPS

is_mips64()

🔲

MIPS64

is_mips64el()

🔲

MIPS64EL

is_mipsel()

🔲

MIPSEL

is_multiplexers()

MULTIPLEXERS

is_native_terminals()

NATIVE_TERMINALS

is_netbsd()

🚩

NETBSD

is_nobara()

NOBARA

is_nushell()

𝜈

NUSHELL

is_openbsd()

🐡

OPENBSD

is_opensuse()

🦎

OPENSUSE

is_openwrt()

📶

OPENWRT

is_oracle()

🦴

ORACLE

is_other_posix()

🅟

OTHER_POSIX

is_other_shells()

OTHER_SHELLS

is_parallels()

PARALLELS

is_pidora()

🍓

PIDORA

is_powerpc()

POWERPC

is_powershell()

🔷

POWERSHELL

is_ppc()

PPC

is_ppc64()

PPC64

is_ppc64le()

PPC64LE

is_raspbian()

🍓

RASPBIAN

is_rhel()

🎩

RHEL

is_rio()

🏞️

RIO

is_riscv()

RISCV

is_riscv32()

RISCV32

is_riscv64()

RISCV64

is_rocky()

⛰️

ROCKY

is_s390x()

🏢

S390X

is_scientific()

⚛️

SCIENTIFIC

is_slackware()

🚬

SLACKWARE

is_sles()

🦎

SLES

is_solaris()

🌞

SOLARIS

is_sparc()

☀️

SPARC

is_sparc64()

☀️

SPARC64

is_sunos()

🌅

SUNOS

is_system_v()

𝐕

SYSTEM_V

is_tabby()

🐈

TABBY

is_tcsh()

𝐓

TCSH

is_teamcity()

🏙️

TEAMCITY

is_tilix()

🔀

TILIX

is_tmux()

📟

TMUX

is_travis_ci()

👷

TRAVIS_CI

is_tumbleweed()

TUMBLEWEED

is_tuxedo()

🤵

TUXEDO

is_ubuntu()

🎯

UBUNTU

is_ultramarine()

🌊

ULTRAMARINE

is_unix()

UNIX

is_unix_layers()

UNIX_LAYERS

is_unix_not_macos()

UNIX_WITHOUT_MACOS

is_unknown()

UNKNOWN

is_unknown_agent()

UNKNOWN_AGENT

is_unknown_architecture()

UNKNOWN_ARCHITECTURE

is_unknown_ci()

UNKNOWN_CI

is_unknown_platform()

UNKNOWN_PLATFORM

is_unknown_shell()

UNKNOWN_SHELL

is_unknown_terminal()

UNKNOWN_TERMINAL

is_void()

VOID

is_vscode_terminal()

🔵

VSCODE_TERMINAL

is_wasm32()

🌐

WASM32

is_wasm64()

🌐

WASM64

is_web_terminals()

WEB_TERMINALS

is_webassembly()

🌐

WEBASSEMBLY

is_wezterm()

🔡

WEZTERM

is_windows()

🪟

WINDOWS

is_windows_shells()

⌨️

WINDOWS_SHELLS

is_windows_terminal()

WINDOWS_TERMINAL

is_wsl1()

WSL1

is_wsl2()

WSL2

is_x86()

𝘅

X86

is_x86_64()

🖥️

X86_64

is_xenserver()

XENSERVER

is_xonsh()

🐍

XONSH

is_xterm()

𝐗

XTERM

is_zellij()

🪵

ZELLIJ

is_zsh()

ZSH

Trait detection functions

extra_platforms.is_aarch64()[source]

Return True if current architecture is AARCH64.

Caution

platform.machine() returns different values depending on the OS:

  • Linux: aarch64

  • macOS: arm64

  • Windows: ARM64

Return type:

bool

extra_platforms.is_aix()[source]

Return True if current platform is AIX.

Return type:

bool

extra_platforms.is_alacritty()[source]

Return True if current terminal is ALACRITTY.

Return type:

bool

extra_platforms.is_alpine()[source]

Return True if current platform is ALPINE.

Return type:

bool

extra_platforms.is_altlinux()[source]

Return True if current platform is ALTLINUX.

Return type:

bool

extra_platforms.is_amzn()[source]

Return True if current platform is AMZN.

Return type:

bool

extra_platforms.is_android()[source]

Return True if current platform is ANDROID.

Return type:

bool

extra_platforms.is_apple_terminal()[source]

Return True if current terminal is APPLE_TERMINAL.

Return type:

bool

extra_platforms.is_arch()[source]

Return True if current platform is ARCH.

Return type:

bool

extra_platforms.is_arm()[source]

Return True if current architecture is ARM.

Hint

This is a fallback detection for generic ARM architecture. It will return True for any ARM architecture not specifically covered by the more precise variants: is_aarch64(), is_armv5tel(), is_armv6l(), is_armv7l() or is_armv8l().

Return type:

bool

extra_platforms.is_armv5tel()[source]

Return True if current architecture is ARMV5TEL.

Return type:

bool

extra_platforms.is_armv6l()[source]

Return True if current architecture is ARMV6L.

Return type:

bool

extra_platforms.is_armv7l()[source]

Return True if current architecture is ARMV7L.

Return type:

bool

extra_platforms.is_armv8l()[source]

Return True if current architecture is ARMV8L.

Return type:

bool

extra_platforms.is_ash()[source]

Return True if current shell is ASH.

Hint

Detected via the SHELL environment variable path, as Almquist Shell does not set its own version variable.

Note

BusyBox’s built-in shell is an ASH derivative. On BusyBox-based systems (ALPINE, OPENWRT), $SHELL typically resolves to /bin/ash, so BusyBox environments are detected as ASH.

Return type:

bool

extra_platforms.is_azure_pipelines()[source]

Return True if current CI is AZURE_PIPELINES.

Return type:

bool

extra_platforms.is_bamboo()[source]

Return True if current CI is BAMBOO.

Return type:

bool

extra_platforms.is_bash()[source]

Return True if current shell is BASH.

Hint

Detected via the BASH_VERSION environment variable (set by Bash on startup), or via the SHELL path as a fallback.

Attention

GitHub’s ubuntu-slim runner is a stripped-down environments, running as a WSL2 container on top of Windows. It uses Bash as the default shell, but does not set neither BASH_VERSION nor SHELL. In that case we fall back to walking the parent process tree via /proc to find it.

Return type:

bool

extra_platforms.is_buildkite()[source]

Return True if current CI is BUILDKITE.

See also

Environment variables reference: <https://buildkite.com/docs/pipelines/environment-variables>.

Return type:

bool

extra_platforms.is_buildroot()[source]

Return True if current platform is BUILDROOT.

Return type:

bool

extra_platforms.is_cachyos()[source]

Return True if current platform is CACHYOS.

Return type:

bool

extra_platforms.is_centos()[source]

Return True if current platform is CENTOS.

Return type:

bool

extra_platforms.is_circle_ci()[source]

Return True if current CI is CIRCLE_CI.

Return type:

bool

extra_platforms.is_cirrus_ci()[source]

Return True if current CI is CIRRUS_CI.

See also

Environment variables reference: <https://cirrus-ci.org/guide/writing-tasks/#environment-variables>.

Return type:

bool

extra_platforms.is_claude_code()[source]

Return True if current agent is CLAUDE_CODE.

See also

Claude Code sets the CLAUDECODE environment variable when running.

Return type:

bool

extra_platforms.is_cline()[source]

Return True if current agent is CLINE.

See also

Cline sets the CLINE_ACTIVE environment variable when running.

Return type:

bool

extra_platforms.is_cloudlinux()[source]

Return True if current platform is CLOUDLINUX.

Return type:

bool

extra_platforms.is_cmd()[source]

Return True if current shell is CMD.

Hint

Detected on Windows when the PROMPT environment variable is set and PSModulePath is not (to exclude PowerShell).

Return type:

bool

extra_platforms.is_codebuild()[source]

Return True if current CI is CODEBUILD.

Return type:

bool

extra_platforms.is_contour()[source]

Return True if current terminal is CONTOUR.

Return type:

bool

extra_platforms.is_csh()[source]

Return True if current shell is CSH.

Hint

Detected via the SHELL environment variable path.

Return type:

bool

extra_platforms.is_cursor()[source]

Return True if current agent is CURSOR.

See also

Cursor sets the CURSOR_AGENT environment variable when running.

Return type:

bool

extra_platforms.is_cygwin()[source]

Return True if current platform is CYGWIN.

Return type:

bool

extra_platforms.is_dash()[source]

Return True if current shell is DASH.

Hint

Detected via the SHELL environment variable path, as Dash does not set its own version variable.

Return type:

bool

extra_platforms.is_debian()[source]

Return True if current platform is DEBIAN.

Return type:

bool

extra_platforms.is_dragonfly_bsd()[source]

Return True if current platform is DRAGONFLY_BSD.

Return type:

bool

extra_platforms.is_exherbo()[source]

Return True if current platform is EXHERBO.

Return type:

bool

extra_platforms.is_fedora()[source]

Return True if current platform is FEDORA.

Return type:

bool

extra_platforms.is_fish()[source]

Return True if current shell is FISH.

Hint

Detected via the FISH_VERSION environment variable (set by Fish on startup), or via the SHELL path as a fallback.

Return type:

bool

extra_platforms.is_foot()[source]

Return True if current terminal is FOOT.

Return type:

bool

extra_platforms.is_freebsd()[source]

Return True if current platform is FREEBSD.

Return type:

bool

extra_platforms.is_generic_linux()[source]

Return True if current platform is GENERIC_LINUX.

Matches when running on a Linux kernel but distro cannot identify the specific distribution (e.g., minimal containers or build chroots without /etc/os-release).

Return type:

bool

extra_platforms.is_gentoo()[source]

Return True if current platform is GENTOO.

Return type:

bool

extra_platforms.is_ghostty()[source]

Return True if current terminal is GHOSTTY.

Return type:

bool

extra_platforms.is_github_ci()[source]

Return True if current CI is GITHUB_CI.

Return type:

bool

extra_platforms.is_gitlab_ci()[source]

Return True if current CI is GITLAB_CI.

Return type:

bool

extra_platforms.is_gnome_terminal()[source]

Return True if current terminal is GNOME_TERMINAL.

Return type:

bool

extra_platforms.is_gnu_screen()[source]

Return True if current terminal is GNU_SCREEN.

Return type:

bool

extra_platforms.is_guix()[source]

Return True if current platform is GUIX.

Return type:

bool

extra_platforms.is_haiku()[source]

Return True if current platform is HAIKU.

Return type:

bool

extra_platforms.is_heroku_ci()[source]

Return True if current CI is HEROKU_CI.

Return type:

bool

extra_platforms.is_hurd()[source]

Return True if current platform is HURD.

Caution

sys.platform can returns GNU or gnu0, see: <https://github.com/kdeldycke/extra-platforms/issues/308>

Return type:

bool

extra_platforms.is_hyper()[source]

Return True if current terminal is HYPER.

Return type:

bool

extra_platforms.is_i386()[source]

Return True if current architecture is I386.

Return type:

bool

extra_platforms.is_i586()[source]

Return True if current architecture is I586.

Return type:

bool

extra_platforms.is_i686()[source]

Return True if current architecture is I686.

Return type:

bool

extra_platforms.is_ibm_powerkvm()[source]

Return True if current platform is IBM_POWERKVM.

Return type:

bool

extra_platforms.is_illumos()[source]

Return True if current platform is ILLUMOS.

Hint

Illumos is a Unix OS derived from OpenSolaris. It shares sys.platform == 'sunos5' with Solaris, but can be distinguished by checking platform.uname().version which contains “illumos” on Illumos-based systems (like OpenIndiana, SmartOS, OmniOS).

Return type:

bool

extra_platforms.is_iterm2()[source]

Return True if current terminal is ITERM2.

Return type:

bool

extra_platforms.is_kali()[source]

Return True if current platform is KALI.

Return type:

bool

extra_platforms.is_kitty()[source]

Return True if current terminal is KITTY.

Return type:

bool

extra_platforms.is_konsole()[source]

Return True if current terminal is KONSOLE.

Return type:

bool

extra_platforms.is_ksh()[source]

Return True if current shell is KSH.

Hint

Detected via the KSH_VERSION environment variable (set by Korn shell on startup), or via the SHELL path as a fallback.

Return type:

bool

extra_platforms.is_kvmibm()[source]

Return True if current platform is KVMIBM.

Return type:

bool

extra_platforms.is_linuxmint()[source]

Return True if current platform is LINUXMINT.

Return type:

bool

extra_platforms.is_loongarch64()[source]

Return True if current architecture is LOONGARCH64.

Return type:

bool

extra_platforms.is_macos()[source]

Return True if current platform is MACOS.

Return type:

bool

extra_platforms.is_mageia()[source]

Return True if current platform is MAGEIA.

Return type:

bool

extra_platforms.is_mandriva()[source]

Return True if current platform is MANDRIVA.

Return type:

bool

extra_platforms.is_manjaro()[source]

Return True if current platform is MANJARO.

Return type:

bool

extra_platforms.is_midnightbsd()[source]

Return True if current platform is MIDNIGHTBSD.

Return type:

bool

extra_platforms.is_mips()[source]

Return True if current architecture is MIPS.

Return type:

bool

extra_platforms.is_mips64()[source]

Return True if current architecture is MIPS64.

Return type:

bool

extra_platforms.is_mips64el()[source]

Return True if current architecture is MIPS64EL.

Return type:

bool

extra_platforms.is_mipsel()[source]

Return True if current architecture is MIPSEL.

Return type:

bool

extra_platforms.is_netbsd()[source]

Return True if current platform is NETBSD.

Return type:

bool

extra_platforms.is_nobara()[source]

Return True if current platform is NOBARA.

Return type:

bool

extra_platforms.is_nushell()[source]

Return True if current shell is NUSHELL.

Hint

Detected via the NU_VERSION environment variable (set by Nushell on startup), or via the SHELL path as a fallback.

Return type:

bool

extra_platforms.is_openbsd()[source]

Return True if current platform is OPENBSD.

Return type:

bool

extra_platforms.is_opensuse()[source]

Return True if current platform is OPENSUSE.

Return type:

bool

extra_platforms.is_openwrt()[source]

Return True if current platform is OPENWRT.

Return type:

bool

extra_platforms.is_oracle()[source]

Return True if current platform is ORACLE.

Return type:

bool

extra_platforms.is_parallels()[source]

Return True if current platform is PARALLELS.

Return type:

bool

extra_platforms.is_pidora()[source]

Return True if current platform is PIDORA.

Return type:

bool

extra_platforms.is_powershell()[source]

Return True if current shell is POWERSHELL.

Note

PowerShell is cross-platform and available on Linux and macOS. Detection covers all platforms via PSModulePath, SHELL path, and parent process tree.

Attention

PSModulePath can leak into non-PowerShell child processes via two vectors:

  1. Process-level inheritance (all platforms): PowerShell modifies PSModulePath at startup, and all non-PowerShell children inherit it.

  2. System-wide registry variable (Windows only): PSModulePath is a persistent machine-level environment variable visible to all processes.

This is the case for all GitHub Ubuntu runners, where PSModulePath leaks from Azure infrastructure. This leads to multiple shell detections, which is arbitraged by current_shell(), which deprioritizes PowerShell when other shells are detected.

Return type:

bool

extra_platforms.is_ppc()[source]

Return True if current architecture is PPC.

Return type:

bool

extra_platforms.is_ppc64()[source]

Return True if current architecture is PPC64.

Return type:

bool

extra_platforms.is_ppc64le()[source]

Return True if current architecture is PPC64LE.

Return type:

bool

extra_platforms.is_raspbian()[source]

Return True if current platform is RASPBIAN.

Return type:

bool

extra_platforms.is_rhel()[source]

Return True if current platform is RHEL.

Return type:

bool

extra_platforms.is_rio()[source]

Return True if current terminal is RIO.

Return type:

bool

extra_platforms.is_riscv32()[source]

Return True if current architecture is RISCV32.

Return type:

bool

extra_platforms.is_riscv64()[source]

Return True if current architecture is RISCV64.

Return type:

bool

extra_platforms.is_rocky()[source]

Return True if current platform is ROCKY.

Return type:

bool

extra_platforms.is_s390x()[source]

Return True if current architecture is S390X.

Return type:

bool

extra_platforms.is_scientific()[source]

Return True if current platform is SCIENTIFIC.

Return type:

bool

extra_platforms.is_slackware()[source]

Return True if current platform is SLACKWARE.

Return type:

bool

extra_platforms.is_sles()[source]

Return True if current platform is SLES.

Return type:

bool

extra_platforms.is_solaris()[source]

Return True if current platform is SOLARIS.

Return type:

bool

extra_platforms.is_sparc()[source]

Return True if current architecture is SPARC.

Return type:

bool

extra_platforms.is_sparc64()[source]

Return True if current architecture is SPARC64.

Return type:

bool

extra_platforms.is_sunos()[source]

Return True if current platform is SUNOS.

Return type:

bool

extra_platforms.is_tabby()[source]

Return True if current terminal is TABBY.

Return type:

bool

extra_platforms.is_tcsh()[source]

Return True if current shell is TCSH.

Hint

Detected via the SHELL environment variable path.

Return type:

bool

extra_platforms.is_teamcity()[source]

Return True if current CI is TEAMCITY.

Return type:

bool

extra_platforms.is_tilix()[source]

Return True if current terminal is TILIX.

Return type:

bool

extra_platforms.is_tmux()[source]

Return True if current terminal is TMUX.

Return type:

bool

extra_platforms.is_travis_ci()[source]

Return True if current CI is TRAVIS_CI.

Return type:

bool

extra_platforms.is_tumbleweed()[source]

Return True if current platform is TUMBLEWEED.

Return type:

bool

extra_platforms.is_tuxedo()[source]

Return True if current platform is TUXEDO.

Return type:

bool

extra_platforms.is_ubuntu()[source]

Return True if current platform is UBUNTU.

Return type:

bool

extra_platforms.is_ultramarine()[source]

Return True if current platform is ULTRAMARINE.

Return type:

bool

extra_platforms.is_unknown_agent()[source]

Return True if current agent is UNKNOWN_AGENT.

Return type:

bool

extra_platforms.is_unknown_architecture()[source]

Return True if current architecture is UNKNOWN_ARCHITECTURE.

Return type:

bool

extra_platforms.is_unknown_ci()[source]

Return True if current CI is UNKNOWN_CI.

Return type:

bool

extra_platforms.is_unknown_platform()[source]

Return True if current platform is UNKNOWN_PLATFORM.

Return type:

bool

extra_platforms.is_unknown_shell()[source]

Return True if current shell is UNKNOWN_SHELL.

Return type:

bool

extra_platforms.is_unknown_terminal()[source]

Return True if current terminal is UNKNOWN_TERMINAL.

Return type:

bool

extra_platforms.is_void()[source]

Return True if current platform is VOID.

Return type:

bool

extra_platforms.is_vscode_terminal()[source]

Return True if current terminal is VSCODE_TERMINAL.

Return type:

bool

extra_platforms.is_wasm32()[source]

Return True if current architecture is WASM32.

Hint

WebAssembly detection is based on Emscripten’s platform identifier.

Return type:

bool

extra_platforms.is_wasm64()[source]

Return True if current architecture is WASM64.

Hint

WebAssembly detection is based on Emscripten’s platform identifier.

Return type:

bool

extra_platforms.is_wezterm()[source]

Return True if current terminal is WEZTERM.

Return type:

bool

extra_platforms.is_windows()[source]

Return True if current platform is WINDOWS.

Return type:

bool

extra_platforms.is_windows_terminal()[source]

Return True if current terminal is WINDOWS_TERMINAL.

Return type:

bool

extra_platforms.is_wsl1()[source]

Return True if current platform is WSL1.

Caution

The only difference between WSL1 and WSL2 is the case of the kernel release version:

  • WSL 1:

    $ uname -r
    4.4.0-22572-Microsoft
    
  • WSL 2:

    $ uname -r
    5.10.102.1-microsoft-standard-WSL2
    
Return type:

bool

extra_platforms.is_wsl2()[source]

Return True if current platform is WSL2.

Return type:

bool

extra_platforms.is_x86_64()[source]

Return True if current architecture is X86_64.

Caution

Windows returns AMD64 in uppercase, so we normalize to lowercase.

Return type:

bool

extra_platforms.is_xenserver()[source]

Return True if current platform is XENSERVER.

Return type:

bool

extra_platforms.is_xonsh()[source]

Return True if current shell is XONSH.

Hint

Detected via the XONSH_VERSION environment variable (set by Xonsh on startup), or via the SHELL path as a fallback.

Return type:

bool

extra_platforms.is_xterm()[source]

Return True if current terminal is XTERM.

Note

We check for XTERM_VERSION rather than TERM=xterm because many headless environments (e.g., GitHub Actions ubuntu-slim runners) set TERM=xterm for termcap/terminfo compatibility without actually running xterm.

Return type:

bool

extra_platforms.is_zellij()[source]

Return True if current terminal is ZELLIJ.

Return type:

bool

extra_platforms.is_zsh()[source]

Return True if current shell is ZSH.

Hint

Detected via the ZSH_VERSION environment variable (set by Zsh on startup), or via the SHELL path as a fallback.

Return type:

bool

Group detection functions

Contrary to individual trait detection functions like is_linux() or is_x86_64(), group detection functions check for membership in a collection of traits.

These functions are dynamically generated for each group and test whether at least one trait from the group matches the current system:

extra_platforms.is_any_agent(_group=Group(id='all_agents', name='AI coding agents'))[source]

Return True if at least one current_traits() is found in the ALL_AGENTS group.

Return type:

bool

extra_platforms.is_any_architecture()[source]
Return type:

bool

extra_platforms.is_any_arm()[source]
Return type:

bool

extra_platforms.is_any_ci()[source]
Return type:

bool

extra_platforms.is_any_mips()[source]
Return type:

bool

extra_platforms.is_any_platform()[source]
Return type:

bool

extra_platforms.is_any_shell()[source]
Return type:

bool

extra_platforms.is_any_sparc()[source]
Return type:

bool

extra_platforms.is_any_terminal()[source]
Return type:

bool

extra_platforms.is_any_trait()[source]
Return type:

bool

extra_platforms.is_any_windows()[source]
Return type:

bool

extra_platforms.is_arch_32_bit()[source]
Return type:

bool

extra_platforms.is_arch_64_bit()[source]
Return type:

bool

extra_platforms.is_big_endian()[source]
Return type:

bool

extra_platforms.is_bourne_shells()[source]
Return type:

bool

extra_platforms.is_bsd()[source]
Return type:

bool

extra_platforms.is_bsd_not_macos()[source]
Return type:

bool

extra_platforms.is_c_shells()[source]
Return type:

bool

extra_platforms.is_gpu_terminals()[source]
Return type:

bool

extra_platforms.is_ibm_mainframe()[source]
Return type:

bool

extra_platforms.is_linux()[source]
Return type:

bool

extra_platforms.is_linux_layers()[source]
Return type:

bool

extra_platforms.is_linux_like()[source]
Return type:

bool

extra_platforms.is_little_endian()[source]
Return type:

bool

extra_platforms.is_loongarch()[source]
Return type:

bool

extra_platforms.is_multiplexers()[source]
Return type:

bool

extra_platforms.is_native_terminals()[source]
Return type:

bool

extra_platforms.is_other_posix()[source]
Return type:

bool

extra_platforms.is_other_shells()[source]
Return type:

bool

extra_platforms.is_powerpc()[source]
Return type:

bool

extra_platforms.is_riscv()[source]
Return type:

bool

extra_platforms.is_system_v()[source]
Return type:

bool

extra_platforms.is_unix()[source]
Return type:

bool

extra_platforms.is_unix_layers()[source]
Return type:

bool

extra_platforms.is_unix_not_macos()[source]
Return type:

bool

extra_platforms.is_unknown()[source]
Return type:

bool

extra_platforms.is_web_terminals()[source]
Return type:

bool

extra_platforms.is_webassembly()[source]
Return type:

bool

extra_platforms.is_windows_shells()[source]
Return type:

bool

extra_platforms.is_x86()[source]
Return type:

bool

Current trait functions

These functions retrieve the currently detected traits:

extra_platforms.current_traits()[source]

Returns all traits matching the current environment.

This includes Architecture, Platform, Shell, Terminal, CI systems, and Agent environments.

Caution

Never returns UNKNOWN traits.

Raises SystemError if the current environment is not recognized at all.

Attention

At this point it is too late to worry about caching. This function has no choice but to evaluate all detection heuristics.

Return type:

set[Trait]

extra_platforms.current_architecture(strict=False)[source]

Returns the Architecture matching the current environment.

Returns UNKNOWN_ARCHITECTURE if not running inside a recognized architecture. To raise an error instead, set strict to True.

Important

Always raises an error if multiple architectures match.

Warning

An architecture is always expected to be detected. An unrecognized result logs a WARNING and likely indicates a missing detection heuristic that should be reported.

Return type:

Architecture

extra_platforms.current_platform(strict=False)[source]

Always returns the best matching Platform for the current environment.

Returns UNKNOWN_PLATFORM if not running inside a recognized platform. To raise an error instead, set strict to True.

Important

If multiple platforms match the current environment, this function will try to select the best, informative one. Raises an error if we can’t decide on a single, appropriate platform.

Warning

A platform is always expected to be detected. An unrecognized result logs a WARNING and likely indicates a missing detection heuristic that should be reported.

Return type:

Platform

extra_platforms.current_shell(strict=False)[source]

Returns the Shell matching the current environment.

Uses a tiered detection strategy:

  1. Shell-specific environment variables (detects active shell).

  2. SHELL environment variable (detects login shell on Unix).

  3. Windows defaults (PROMPTCMD, else → POWERSHELL).

Returns UNKNOWN_SHELL if not running inside a recognized shell. To raise an error instead, set strict to True.

Important

If both POWERSHELL and another shell are detected (because PSModulePath leaks into child processes), the other shell is preferred.

Warning

A shell is always expected to be detected. An unrecognized result logs a WARNING and likely indicates a missing detection heuristic that should be reported.

Return type:

Shell

extra_platforms.current_terminal(strict=False)[source]

Returns the Terminal matching the current environment.

Returns UNKNOWN_TERMINAL if not running inside a recognized terminal. To raise an error instead, set strict to True.

Important

If multiple terminals match (e.g., TMUX inside KITTY), multiplexers are filtered out first to identify the innermost terminal. If multiple non-multiplexer terminals still match, a RuntimeError is raised.

Note

Unlike architectures, platforms, and shells, a terminal is not always present. Headless environments (CI runners, cron jobs, Docker containers, SSH non-interactive commands) have no terminal emulator attached.

If the TERM environment variable is set, an unrecognized terminal logs at WARNING level, as it suggests a terminal emulator is present but not recognized. Otherwise, it logs at INFO level.

Return type:

Terminal

extra_platforms.current_ci(strict=False)[source]

Returns the CI system matching the current environment.

Returns UNKNOWN_CI if not running inside a recognized CI system. To raise an error instead, set strict to True.

Important

Always raises an error if multiple CI systems match.

Note

Unlike architectures, platforms, and shells, a CI system is not always present. Local development environments have no CI system running.

If the CI environment variable is set, an unrecognized CI system logs at WARNING level, as it suggests a CI system is present but not recognized. Otherwise, it logs at INFO level.

Return type:

CI

extra_platforms.current_agent(strict=False)[source]

Returns the Agent matching the current environment.

Returns UNKNOWN_AGENT if not running inside a recognized agent. To raise an error instead, set strict to True.

Important

Always raises an error if multiple agents match.

Note

Unlike architectures, platforms, and shells, an agent is not always present. Local development without AI agents has no agent running.

If the LLM environment variable is set, an unrecognized agent logs at WARNING level, as it suggests an AI agent is present but not recognized. Otherwise, it logs at INFO level.

Return type:

Agent

Cache management

extra_platforms.invalidate_caches()[source]

Invalidate all cached properties.

Inspired by the new platform.invalidate_caches() from Python 3.14, which is also called here when available.