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_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_cloudlinux()

๊ฉœ

CLOUDLINUX

is_cmd()

โ–ถ

CMD

is_codebuild()

แš™

CODEBUILD

is_contour()

โ—ฐ

CONTOUR

is_csh()

๐‚

CSH

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_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_architecture()

โ“

UNKNOWN_ARCHITECTURE

is_unknown_ci()

โ“

UNKNOWN_CI

is_unknown_platform()

โ“

UNKNOWN_PLATFORM

is_unknown_shell()

โ“

UNKNOWN_SHELL

is_unknown_terminal()

โ“

UNKNOWN_TERMINAL

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_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_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_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_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_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_architecture(_group=Group(id='all_architectures', name='All architectures'))ยถ

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

Return type:

bool

extra_platforms.is_any_arm(_group=Group(id='all_arm', name='ARM architectures'))ยถ

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

Return type:

bool

extra_platforms.is_any_ci(_group=Group(id='all_ci', name='CI systems'))ยถ

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

Return type:

bool

extra_platforms.is_any_mips(_group=Group(id='all_mips', name='MIPS architectures'))ยถ

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

Return type:

bool

extra_platforms.is_any_platform(_group=Group(id='all_platforms', name='All platforms'))ยถ

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

Return type:

bool

extra_platforms.is_any_shell(_group=Group(id='all_shells', name='All shells'))ยถ

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

Return type:

bool

extra_platforms.is_any_sparc(_group=Group(id='all_sparc', name='SPARC architectures'))ยถ

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

Return type:

bool

extra_platforms.is_any_terminal(_group=Group(id='all_terminals', name='All terminals'))ยถ

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

Return type:

bool

extra_platforms.is_any_trait(_group=Group(id='all_traits', name='All architectures, platforms, shells, terminals, and CI systems'))ยถ

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

Return type:

bool

extra_platforms.is_any_windows(_group=Group(id='all_windows', name='All Windows'))ยถ

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

Return type:

bool

extra_platforms.is_arch_32_bit(_group=Group(id='arch_32_bit', name='32-bit architectures'))ยถ

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

Return type:

bool

extra_platforms.is_arch_64_bit(_group=Group(id='arch_64_bit', name='64-bit architectures'))ยถ

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

Return type:

bool

extra_platforms.is_big_endian(_group=Group(id='big_endian', name='Big-endian architectures'))ยถ

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

Return type:

bool

extra_platforms.is_bourne_shells(_group=Group(id='bourne_shells', name='Bourne-compatible shells'))ยถ

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

Return type:

bool

extra_platforms.is_bsd(_group=Group(id='bsd', name='All BSD'))ยถ

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

Return type:

bool

extra_platforms.is_bsd_not_macos(_group=Group(id='bsd_without_macos', name='All BSD excluding macOS'))ยถ

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

Return type:

bool

extra_platforms.is_c_shells(_group=Group(id='c_shells', name='C shells'))ยถ

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

Return type:

bool

extra_platforms.is_gpu_terminals(_group=Group(id='gpu_terminals', name='GPU-accelerated terminals'))ยถ

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

Return type:

bool

extra_platforms.is_ibm_mainframe(_group=Group(id='ibm_mainframe', name='IBM mainframe'))ยถ

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

Return type:

bool

extra_platforms.is_linux(_group=Group(id='linux', name='Linux distributions'))ยถ

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

Return type:

bool

extra_platforms.is_linux_layers(_group=Group(id='linux_layers', name='Linux compatibility layers'))ยถ

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

Return type:

bool

extra_platforms.is_linux_like(_group=Group(id='linux_like', name='All Linux & compatibility layers'))ยถ

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

Return type:

bool

extra_platforms.is_little_endian(_group=Group(id='little_endian', name='Little-endian architectures'))ยถ

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

Return type:

bool

extra_platforms.is_loongarch(_group=Group(id='loongarch', name='LoongArch'))ยถ

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

Return type:

bool

extra_platforms.is_multiplexers(_group=Group(id='multiplexers', name='Terminal multiplexers'))ยถ

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

Return type:

bool

extra_platforms.is_native_terminals(_group=Group(id='native_terminals', name='Native terminal emulators'))ยถ

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

Return type:

bool

extra_platforms.is_other_posix(_group=Group(id='other_posix', name='Other POSIX-compliant platforms'))ยถ

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

Return type:

bool

extra_platforms.is_other_shells(_group=Group(id='other_shells', name='Other shells'))ยถ

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

Return type:

bool

extra_platforms.is_powerpc(_group=Group(id='powerpc', name='PowerPC family'))ยถ

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

Return type:

bool

extra_platforms.is_riscv(_group=Group(id='riscv', name='RISC-V family'))ยถ

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

Return type:

bool

extra_platforms.is_system_v(_group=Group(id='system_v', name='AT&T System Five'))ยถ

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

Return type:

bool

extra_platforms.is_unix(_group=Group(id='unix', name='All Unix'))ยถ

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

Return type:

bool

extra_platforms.is_unix_layers(_group=Group(id='unix_layers', name='Unix compatibility layers'))ยถ

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

Return type:

bool

extra_platforms.is_unix_not_macos(_group=Group(id='unix_without_macos', name='All Unix excluding macOS'))ยถ

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

Return type:

bool

extra_platforms.is_unknown(_group=Group(id='unknown', name='Unknown'))ยถ

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

Return type:

bool

extra_platforms.is_web_terminals(_group=Group(id='web_terminals', name='Web-based terminals'))ยถ

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

Return type:

bool

extra_platforms.is_webassembly(_group=Group(id='webassembly', name='WebAssembly'))ยถ

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

Return type:

bool

extra_platforms.is_windows_shells(_group=Group(id='windows_shells', name='Windows shells'))ยถ

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

Return type:

bool

extra_platforms.is_x86(_group=Group(id='x86', name='x86 family'))ยถ

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

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, and CI systems.

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 (PROMPT โ†’ CMD, 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. An unrecognized result only 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. An unrecognized result only logs at INFO level.

Return type:

CI

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.