Detection

All detection functions

Detection function

Icon

Associated symbol

is_aarch64()

📱

AARCH64

is_aix()

AIX

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_sparc()

☀️

ALL_SPARC

is_any_trait()

ALL_TRAITS

is_any_windows()

🪟

ALL_WINDOWS

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_azure_pipelines()

AZURE_PIPELINES

is_bamboo()

BAMBOO

is_bsd()

🅱️+

BSD

is_bsd_not_macos()

🅱️

BSD_WITHOUT_MACOS

is_buildkite()

🪁

BUILDKITE

is_buildroot()

⛑️

BUILDROOT

is_cachyos()

CACHYOS

is_centos()

💠

CENTOS

is_circle_ci()

CIRCLE_CI

is_cirrus_ci()

CIRRUS_CI

is_cloudlinux()

CLOUDLINUX

is_codebuild()

CODEBUILD

is_cygwin()

Ͼ

CYGWIN

is_debian()

🌀

DEBIAN

is_dragonfly_bsd()

🪰

DRAGONFLY_BSD

is_exherbo()

🐽

EXHERBO

is_fedora()

🎩

FEDORA

is_freebsd()

😈

FREEBSD

is_gentoo()

🗜️

GENTOO

is_github_ci()

🐙

GITHUB_CI

is_gitlab_ci()

🦊

GITLAB_CI

is_guix()

🐃

GUIX

is_haiku()

🍂

HAIKU

is_heroku_ci()

HEROKU_CI

is_hurd()

🐃

HURD

is_i386()

𝗶

I386

is_i586()

𝗶

I586

is_i686()

𝗶

I686

is_ibm_mainframe()

🏢

IBM_MAINFRAME

is_ibm_powerkvm()

🤹

IBM_POWERKVM

is_illumos()

🔥

ILLUMOS

is_kvmibm()

🤹

KVMIBM

is_linux()

🐧

LINUX

is_linux_layers()

LINUX_LAYERS

is_linux_like()

🐧+

LINUX_LIKE

is_linuxmint()

🌿

LINUXMINT

is_loongarch()

🐉

LOONGARCH

is_loongarch64()

🐉

LOONGARCH64

is_macos()

🍎

MACOS

is_mageia()

MAGEIA

is_mandriva()

💫

MANDRIVA

is_midnightbsd()

🌘

MIDNIGHTBSD

is_mips()

🔲

MIPS

is_mips64()

🔲

MIPS64

is_mips64el()

🔲

MIPS64EL

is_mipsel()

🔲

MIPSEL

is_netbsd()

🚩

NETBSD

is_nobara()

NOBARA

is_openbsd()

🐡

OPENBSD

is_opensuse()

🦎

OPENSUSE

is_oracle()

🦴

ORACLE

is_other_posix()

🅟

OTHER_POSIX

is_parallels()

PARALLELS

is_pidora()

🍓

PIDORA

is_powerpc()

POWERPC

is_ppc()

PPC

is_ppc64()

PPC64

is_ppc64le()

PPC64LE

is_raspbian()

🍓

RASPBIAN

is_rhel()

🎩

RHEL

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_teamcity()

🏙️

TEAMCITY

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_wasm32()

🌐

WASM32

is_wasm64()

🌐

WASM64

is_webassembly()

🌐

WEBASSEMBLY

is_windows()

🪟

WINDOWS

is_wsl1()

WSL1

is_wsl2()

WSL2

is_x86()

𝘅

X86

is_x86_64()

🖥️

X86_64

is_xenserver()

XENSERVER

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_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_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_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_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_codebuild()[source]

Return True if current CI is CODEBUILD.

Return type:

bool

extra_platforms.is_cygwin()[source]

Return True if current platform is CYGWIN.

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_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_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_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_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_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_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_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_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_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_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_teamcity()[source]

Return True if current CI is TEAMCITY.

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_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_windows()[source]

Return True if current platform is WINDOWS.

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

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_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_trait(_group=Group(id='all_traits', name='All architectures, platforms 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_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_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_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_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_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_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_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 Platform, Architecture, 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.

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.

Return type:

Platform

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.

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.

Deprecated detection functions

extra_platforms.current_os(strict=False)

Alias current_os()current_platform().

Deprecated since version 6.0.0: Use current_platform() instead.

Return type:

Platform

extra_platforms.current_platforms()

Alias current_platforms()current_traits().

Deprecated since version 6.0.0: Use current_traits() instead.

Return type:

tuple[Platform, ...]