Detection¶
All detection functions¶
Detection function |
Icon |
Associated symbol |
|---|---|---|
📱 |
||
➿ |
||
🐧 |
||
⤻ |
||
🤖 |
||
🏛️ |
||
📱 |
||
♺ |
||
🔲 |
||
⚙️ |
||
☀️ |
||
⁕ |
||
🪟 |
||
🎗️ |
||
³² |
||
⁶⁴ |
||
📱 |
||
📱 |
||
📱 |
||
📱 |
||
📱 |
||
═ |
||
⟲ |
||
🅱️+ |
||
🅱️ |
||
🪁 |
||
⛑️ |
||
⌬ |
||
💠 |
||
⪾ |
||
≋ |
||
꩜ |
||
ᚙ |
||
Ͼ |
||
🌀 |
||
🪰 |
||
🐽 |
||
🎩 |
||
😈 |
||
🗜️ |
||
🐙 |
||
🦊 |
||
🐃 |
||
🍂 |
||
⥁ |
||
🐃 |
||
𝗶 |
||
𝗶 |
||
𝗶 |
||
🏢 |
||
🤹 |
||
🔥 |
||
🤹 |
||
🐧 |
||
≚ |
||
🐧+ |
||
🌿 |
||
🐉 |
||
🐉 |
||
🍎 |
||
⍥ |
||
💫 |
||
🌘 |
||
🔲 |
||
🔲 |
||
🔲 |
||
🔲 |
||
🚩 |
||
|
||
🐡 |
||
🦎 |
||
🦴 |
||
🅟 |
||
∥ |
||
🍓 |
||
⚡ |
||
⚡ |
||
⚡ |
||
⚡ |
||
🍓 |
||
🎩 |
||
Ⅴ |
||
Ⅴ |
||
Ⅴ |
||
⛰️ |
||
🏢 |
||
⚛️ |
||
🚬 |
||
🦎 |
||
🌞 |
||
☀️ |
||
☀️ |
||
☀️ |
||
𝐕 |
||
🏙️ |
||
👷 |
||
↻ |
||
🤵 |
||
🎯 |
||
🌊 |
||
⨷ |
||
≛ |
||
⨂ |
||
❓ |
||
❓ |
||
❓ |
||
❓ |
||
🌐 |
||
🌐 |
||
🌐 |
||
🪟 |
||
⊞ |
||
⊞ |
||
𝘅 |
||
🖥️ |
||
Ⓧ |
Trait detection functions¶
- extra_platforms.is_aarch64()[source]¶
Return
Trueif current architecture isAARCH64.Caution
platform.machine()returns different values depending on the OS:Linux:
aarch64macOS:
arm64Windows:
ARM64
- Return type:
- extra_platforms.is_android()[source]¶
Return
Trueif current platform isANDROID.See also
Source: <https://github.com/kivy/kivy/blob/3c4b1dc84cdd930d352aab9be32c38e1c98bd5c6/kivy/utils.py#L435-L436>
- Return type:
- extra_platforms.is_arm()[source]¶
Return
Trueif current architecture isARM.Hint
This is a fallback detection for generic ARM architecture. It will return
Truefor any ARM architecture not specifically covered by the more precise variants:is_aarch64(),is_armv5tel(),is_armv6l(),is_armv7l()oris_armv8l().- Return type:
- extra_platforms.is_armv5tel()[source]¶
Return
Trueif current architecture isARMV5TEL.- Return type:
- extra_platforms.is_azure_pipelines()[source]¶
Return
Trueif current CI isAZURE_PIPELINES.See also
Environment variables reference: <https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&viewFallbackFrom=vsts&tabs=yaml#system-variables>.
- Return type:
- extra_platforms.is_bamboo()[source]¶
Return
Trueif current CI isBAMBOO.See also
Environment variables reference: <https://confluence.atlassian.com/bamboo/bamboo-variables-289277087.html#Bamboovariables-Build-specificvariables>.
- Return type:
- extra_platforms.is_buildkite()[source]¶
Return
Trueif current CI isBUILDKITE.See also
Environment variables reference: <https://buildkite.com/docs/pipelines/environment-variables>.
- Return type:
- extra_platforms.is_circle_ci()[source]¶
Return
Trueif current CI isCIRCLE_CI.See also
Environment variables reference: <https://circleci.com/docs/reference/variables/#built-in-environment-variables>.
- Return type:
- extra_platforms.is_cirrus_ci()[source]¶
Return
Trueif current CI isCIRRUS_CI.See also
Environment variables reference: <https://cirrus-ci.org/guide/writing-tasks/#environment-variables>.
- Return type:
- extra_platforms.is_cloudlinux()[source]¶
Return
Trueif current platform isCLOUDLINUX.- Return type:
- extra_platforms.is_codebuild()[source]¶
Return
Trueif current CI isCODEBUILD.See also
Environment variables reference: <https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html>.
- Return type:
- extra_platforms.is_dragonfly_bsd()[source]¶
Return
Trueif current platform isDRAGONFLY_BSD.- Return type:
- extra_platforms.is_github_ci()[source]¶
Return
Trueif current CI isGITHUB_CI.See also
Environment variables reference: <https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables>.
- Return type:
- extra_platforms.is_gitlab_ci()[source]¶
Return
Trueif current CI isGITLAB_CI.See also
Environment variables reference: <https://docs.gitlab.com/ci/variables/predefined_variables/#predefined-variables>.
- Return type:
- extra_platforms.is_heroku_ci()[source]¶
Return
Trueif current CI isHEROKU_CI.See also
Environment variables reference: <https://devcenter.heroku.com/articles/heroku-ci#immutable-environment-variables>.
- Return type:
- extra_platforms.is_hurd()[source]¶
Return
Trueif current platform isHURD.Caution
sys.platformcan returnsGNUorgnu0, see: <https://github.com/kdeldycke/extra-platforms/issues/308>- Return type:
- extra_platforms.is_ibm_powerkvm()[source]¶
Return
Trueif current platform isIBM_POWERKVM.- Return type:
- extra_platforms.is_illumos()[source]¶
Return
Trueif current platform isILLUMOS.Hint
Illumos is a Unix OS derived from OpenSolaris. It shares
sys.platform == 'sunos5'with Solaris, but can be distinguished by checkingplatform.uname().versionwhich contains “illumos” on Illumos-based systems (like OpenIndiana, SmartOS, OmniOS).- Return type:
- extra_platforms.is_loongarch64()[source]¶
Return
Trueif current architecture isLOONGARCH64.- Return type:
- extra_platforms.is_midnightbsd()[source]¶
Return
Trueif current platform isMIDNIGHTBSD.- Return type:
- extra_platforms.is_mips64el()[source]¶
Return
Trueif current architecture isMIPS64EL.- Return type:
- extra_platforms.is_scientific()[source]¶
Return
Trueif current platform isSCIENTIFIC.- Return type:
- extra_platforms.is_teamcity()[source]¶
Return
Trueif current CI isTEAMCITY.See also
Environment variables reference: <https://www.jetbrains.com/help/teamcity/predefined-build-parameters.html#PredefinedBuildParameters-ServerBuildProperties>.
- Return type:
- extra_platforms.is_travis_ci()[source]¶
Return
Trueif current CI isTRAVIS_CI.See also
Environment variables reference: <https://docs.travis-ci.com/user/environment-variables/#default-environment-variables>.
- Return type:
- extra_platforms.is_tumbleweed()[source]¶
Return
Trueif current platform isTUMBLEWEED.- Return type:
- extra_platforms.is_ultramarine()[source]¶
Return
Trueif current platform isULTRAMARINE.- Return type:
- extra_platforms.is_unknown_architecture()[source]¶
Return
Trueif current architecture isUNKNOWN_ARCHITECTURE.- Return type:
- extra_platforms.is_unknown_ci()[source]¶
Return
Trueif current CI isUNKNOWN_CI.- Return type:
- extra_platforms.is_unknown_platform()[source]¶
Return
Trueif current platform isUNKNOWN_PLATFORM.- Return type:
- extra_platforms.is_wasm32()[source]¶
Return
Trueif current architecture isWASM32.Hint
WebAssembly detection is based on Emscripten’s platform identifier.
- Return type:
- extra_platforms.is_wasm64()[source]¶
Return
Trueif current architecture isWASM64.Hint
WebAssembly detection is based on Emscripten’s platform identifier.
- Return type:
- extra_platforms.is_wsl1()[source]¶
Return
Trueif current platform isWSL1.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:
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
Trueif at least onecurrent_traits()is found in theALL_ARCHITECTURESgroup.- Return type:
- extra_platforms.is_any_arm(_group=Group(id='all_arm', name='ARM architectures'))¶
Return
Trueif at least onecurrent_traits()is found in theALL_ARMgroup.- Return type:
- extra_platforms.is_any_ci(_group=Group(id='all_ci', name='CI systems'))¶
Return
Trueif at least onecurrent_traits()is found in theALL_CIgroup.- Return type:
- extra_platforms.is_any_mips(_group=Group(id='all_mips', name='MIPS architectures'))¶
Return
Trueif at least onecurrent_traits()is found in theALL_MIPSgroup.- Return type:
- extra_platforms.is_any_platform(_group=Group(id='all_platforms', name='All platforms'))¶
Return
Trueif at least onecurrent_traits()is found in theALL_PLATFORMSgroup.- Return type:
- extra_platforms.is_any_sparc(_group=Group(id='all_sparc', name='SPARC architectures'))¶
Return
Trueif at least onecurrent_traits()is found in theALL_SPARCgroup.- Return type:
- extra_platforms.is_any_trait(_group=Group(id='all_traits', name='All architectures, platforms and CI systems'))¶
Return
Trueif at least onecurrent_traits()is found in theALL_TRAITSgroup.- Return type:
- extra_platforms.is_any_windows(_group=Group(id='all_windows', name='All Windows'))¶
Return
Trueif at least onecurrent_traits()is found in theALL_WINDOWSgroup.- Return type:
- extra_platforms.is_arch_32_bit(_group=Group(id='arch_32_bit', name='32-bit architectures'))¶
Return
Trueif at least onecurrent_traits()is found in theARCH_32_BITgroup.- Return type:
- extra_platforms.is_arch_64_bit(_group=Group(id='arch_64_bit', name='64-bit architectures'))¶
Return
Trueif at least onecurrent_traits()is found in theARCH_64_BITgroup.- Return type:
- extra_platforms.is_bsd(_group=Group(id='bsd', name='All BSD'))¶
Return
Trueif at least onecurrent_traits()is found in theBSDgroup.- Return type:
- extra_platforms.is_bsd_not_macos(_group=Group(id='bsd_without_macos', name='All BSD excluding macOS'))¶
Return
Trueif at least onecurrent_traits()is found in theBSD_WITHOUT_MACOSgroup.- Return type:
- extra_platforms.is_ibm_mainframe(_group=Group(id='ibm_mainframe', name='IBM mainframe'))¶
Return
Trueif at least onecurrent_traits()is found in theIBM_MAINFRAMEgroup.- Return type:
- extra_platforms.is_linux(_group=Group(id='linux', name='Linux distributions'))¶
Return
Trueif at least onecurrent_traits()is found in theLINUXgroup.- Return type:
- extra_platforms.is_linux_layers(_group=Group(id='linux_layers', name='Linux compatibility layers'))¶
Return
Trueif at least onecurrent_traits()is found in theLINUX_LAYERSgroup.- Return type:
- extra_platforms.is_linux_like(_group=Group(id='linux_like', name='All Linux & compatibility layers'))¶
Return
Trueif at least onecurrent_traits()is found in theLINUX_LIKEgroup.- Return type:
- extra_platforms.is_loongarch(_group=Group(id='loongarch', name='LoongArch'))¶
Return
Trueif at least onecurrent_traits()is found in theLOONGARCHgroup.- Return type:
- extra_platforms.is_other_posix(_group=Group(id='other_posix', name='Other POSIX-compliant platforms'))¶
Return
Trueif at least onecurrent_traits()is found in theOTHER_POSIXgroup.- Return type:
- extra_platforms.is_powerpc(_group=Group(id='powerpc', name='PowerPC family'))¶
Return
Trueif at least onecurrent_traits()is found in thePOWERPCgroup.- Return type:
- extra_platforms.is_riscv(_group=Group(id='riscv', name='RISC-V family'))¶
Return
Trueif at least onecurrent_traits()is found in theRISCVgroup.- Return type:
- extra_platforms.is_system_v(_group=Group(id='system_v', name='AT&T System Five'))¶
Return
Trueif at least onecurrent_traits()is found in theSYSTEM_Vgroup.- Return type:
- extra_platforms.is_unix(_group=Group(id='unix', name='All Unix'))¶
Return
Trueif at least onecurrent_traits()is found in theUNIXgroup.- Return type:
- extra_platforms.is_unix_layers(_group=Group(id='unix_layers', name='Unix compatibility layers'))¶
Return
Trueif at least onecurrent_traits()is found in theUNIX_LAYERSgroup.- Return type:
- extra_platforms.is_unix_not_macos(_group=Group(id='unix_without_macos', name='All Unix excluding macOS'))¶
Return
Trueif at least onecurrent_traits()is found in theUNIX_WITHOUT_MACOSgroup.- Return type:
- extra_platforms.is_unknown(_group=Group(id='unknown', name='Unknown'))¶
Return
Trueif at least onecurrent_traits()is found in theUNKNOWNgroup.- Return type:
- extra_platforms.is_webassembly(_group=Group(id='webassembly', name='WebAssembly'))¶
Return
Trueif at least onecurrent_traits()is found in theWEBASSEMBLYgroup.- Return type:
- extra_platforms.is_x86(_group=Group(id='x86', name='x86 family'))¶
Return
Trueif at least onecurrent_traits()is found in theX86group.- Return type:
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, andCIsystems.Caution
Never returns
UNKNOWNtraits.Raises
SystemErrorif 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.
- extra_platforms.current_architecture(strict=False)[source]¶
Returns the
Architecturematching the current environment.Returns
UNKNOWN_ARCHITECTUREif not running inside a recognized architecture. To raise an error instead, setstricttoTrue.Important
Always raises an error if multiple architectures match.
- Return type:
- extra_platforms.current_platform(strict=False)[source]¶
Always returns the best matching
Platformfor the current environment.Returns
UNKNOWN_PLATFORMif not running inside a recognized platform. To raise an error instead, setstricttoTrue.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:
- extra_platforms.current_ci(strict=False)[source]¶
Returns the
CIsystem matching the current environment.Returns
UNKNOWN_CIif not running inside a recognized CI system. To raise an error instead, setstricttoTrue.Important
Always raises an error if multiple CI systems match.
- Return type:
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:
- extra_platforms.current_platforms()¶
Alias
current_platforms()→current_traits().Deprecated since version 6.0.0: Use
current_traits()instead.