Traits

All aspects of a system are represented as traits.

There are four main types of traits:

  • Architectures: CPU architectures (e.g., x86_64, ARM64)

  • Platforms: Operating systems (e.g., Windows, macOS, Ubuntu)

  • Shells: Command-line interpreters (e.g., Bash, Zsh, Fish)

  • CI systems: Continuous Integration environments (e.g., GitHub Actions, Travis CI)

Trait usage

Current traits

You can get all currently detected traits via the current_traits() function.

>>> from extra_platforms import current_traits
>>> current_traits()
{
   Architecture(id='aarch64', name='ARM64 (AArch64)'),
   Platform(id='macos', name='macOS'),
   CI(id='github_ci', name='GitHub Actions runner'),
}

This function returns a set of all predefined traits that match the current system.

Other current traits can be specifically checked via their dedicated current_*() functions:

>>> from extra_platforms import current_architectures, current_platforms, current_ci
>>> current_architectures()
{Architecture(id='aarch64', name='ARM64 (AArch64)')}
>>> current_platforms()
{Platform(id='macos', name='macOS')}
>>> current_ci()
{CI(id='github_ci', name='GitHub Actions runner')}

Predefined traits

All traits are available at the root of the extra_platforms package, as an uppercase symbol:

>>> from extra_platforms import X86_64  # import an architecture
>>> X86_64
Architecture(id='x86_64', name='x86-64 (AMD64)')
>>> from extra_platforms import DEBIAN  # import a platform
>>> DEBIAN
Platform(id='debian', name='Debian')
>>> from extra_platforms import GITHUB_CI  # import a CI system
>>> GITHUB_CI
CI(id='github_ci', name='GitHub Actions runner')

They all inherit from the Trait base class, and share a common interface.

Current property

Each trait has a current property that calls the corresponding detection function:

>>> X86_64.current
True
>>> DEBIAN.current
False
>>> GITHUB_CI.current
False

Detection functions

Each trait is associated with a detection function, which returns True if the current system matches that trait.

These functions are also exposed at the root of the extra_platforms package:

>>> from extra_platforms import is_x86_64, is_debian, is_github_ci
>>> is_x86_64()
True
>>> is_debian()
False
>>> is_github_ci()
False

Groups

Traits are combined into groups for easier detection of related traits.

You can get all groups a trait belongs to via the groups property:

>>> X86_64.groups
frozenset({
   Group(id='x86', name='x86 family'),
   Group(id='all_architectures', name='All architectures'),
   Group(id='arch_64_bit', name='64-bit architectures'),
   Group(id='all_traits', name='Any architectures, platforms and CI systems')})

Additional information

Each trait provides an info() method that returns a dictionary containing all available metadata about that trait:

>>> from extra_platforms import AARCH64, MACOS
>>> AARCH64.info()
{'id': 'aarch64', 'name': 'ARM64 (AArch64)', 'icon': '📱', 'url': 'https://en.wikipedia.org/wiki/AArch64', 'current': True, 'machine': 'arm64', 'processor': None}
>>> MACOS.info()
{'id': 'macos', 'name': 'macOS', 'icon': '🍎', 'url': 'https://apple.com/macos/', 'current': True, 'distro_id': 'darwin', 'version': '26.2', 'version_parts': {'major': '26', 'minor': '2', 'build_number': None}, 'like': None, 'codename': 'Tahoe'}

The exact structure depends on the trait type.

All traits

All recognized traits and their properties:

Icon

Symbol

Name

Detection function

Type

📱

AARCH64

ARM64 (AArch64)

is_aarch64()

Architecture

AIX

IBM AIX

is_aix()

Platform

🔳

ALACRITTY

Alacritty

is_alacritty()

Terminal

🏔️

ALPINE

Alpine Linux

is_alpine()

Platform

Δ

ALTLINUX

ALT Linux

is_altlinux()

Platform

AMZN

Amazon Linux

is_amzn()

Platform

🤖

ANDROID

Android

is_android()

Platform

🍏

APPLE_TERMINAL

Apple Terminal

is_apple_terminal()

Terminal

🎗️

ARCH

Arch Linux

is_arch()

Platform

📱

ARM

ARM (32-bit)

is_arm()

Architecture

📱

ARMV5TEL

ARMv5TE (little-endian)

is_armv5tel()

Architecture

📱

ARMV6L

ARMv6 (little-endian)

is_armv6l()

Architecture

📱

ARMV7L

ARMv7 (little-endian)

is_armv7l()

Architecture

📱

ARMV8L

ARMv8 (32-bit, little-endian)

is_armv8l()

Architecture

🪶

ASH

Almquist Shell

is_ash()

Shell

AZURE_PIPELINES

Azure Pipelines

is_azure_pipelines()

CI

BAMBOO

Bamboo

is_bamboo()

CI

BASH

Bash

is_bash()

Shell

🪁

BUILDKITE

Buildkite

is_buildkite()

CI

⛑️

BUILDROOT

Buildroot

is_buildroot()

Platform

CACHYOS

CachyOS

is_cachyos()

Platform

💠

CENTOS

CentOS

is_centos()

Platform

CIRCLE_CI

Circle CI

is_circle_ci()

CI

CIRRUS_CI

Cirrus CI

is_cirrus_ci()

CI

CLOUDLINUX

CloudLinux OS

is_cloudlinux()

Platform

CMD

Command Prompt

is_cmd()

Shell

CODEBUILD

CodeBuild

is_codebuild()

CI

CONTOUR

Contour

is_contour()

Terminal

𝐂

CSH

C shell

is_csh()

Shell

Ͼ

CYGWIN

Cygwin

is_cygwin()

Platform

💨

DASH

Dash

is_dash()

Shell

🌀

DEBIAN

Debian

is_debian()

Platform

🪰

DRAGONFLY_BSD

DragonFly BSD

is_dragonfly_bsd()

Platform

🐽

EXHERBO

Exherbo Linux

is_exherbo()

Platform

🎩

FEDORA

Fedora

is_fedora()

Platform

🐟

FISH

Fish

is_fish()

Shell

🦶

FOOT

foot

is_foot()

Terminal

😈

FREEBSD

FreeBSD

is_freebsd()

Platform

🗜️

GENTOO

Gentoo Linux

is_gentoo()

Platform

👻

GHOSTTY

Ghostty

is_ghostty()

Terminal

🐙

GITHUB_CI

GitHub Actions runner

is_github_ci()

CI

🦊

GITLAB_CI

GitLab CI

is_gitlab_ci()

CI

𝐆

GNOME_TERMINAL

GNOME Terminal

is_gnome_terminal()

Terminal

📺

GNU_SCREEN

GNU Screen

is_gnu_screen()

Terminal

🐃

GUIX

Guix System

is_guix()

Platform

🍂

HAIKU

Haiku

is_haiku()

Platform

HEROKU_CI

Heroku CI

is_heroku_ci()

CI

🦬

HURD

GNU/Hurd

is_hurd()

Platform

HYPER

Hyper

is_hyper()

Terminal

𝗶

I386

Intel 80386 (i386)

is_i386()

Architecture

𝗶

I586

Intel Pentium (i586)

is_i586()

Architecture

𝗶

I686

Intel Pentium Pro (i686)

is_i686()

Architecture

🤹

IBM_POWERKVM

IBM PowerKVM

is_ibm_powerkvm()

Platform

🔥

ILLUMOS

illumos

is_illumos()

Platform

ITERM2

iTerm2

is_iterm2()

Terminal

🔱

KALI

Kali Linux

is_kali()

Platform

🐱

KITTY

Kitty

is_kitty()

Terminal

💎

KONSOLE

Konsole

is_konsole()

Terminal

𝐊

KSH

Korn shell

is_ksh()

Shell

🤹

KVMIBM

KVM for IBM z Systems

is_kvmibm()

Platform

🌿

LINUXMINT

Linux Mint

is_linuxmint()

Platform

🐉

LOONGARCH64

LoongArch (64-bit)

is_loongarch64()

Architecture

🍎

MACOS

macOS

is_macos()

Platform

MAGEIA

Mageia

is_mageia()

Platform

💫

MANDRIVA

Mandriva Linux

is_mandriva()

Platform

MANJARO

Manjaro Linux

is_manjaro()

Platform

🌘

MIDNIGHTBSD

MidnightBSD

is_midnightbsd()

Platform

🔲

MIPS

MIPS (32-bit, big-endian)

is_mips()

Architecture

🔲

MIPS64

MIPS64 (big-endian)

is_mips64()

Architecture

🔲

MIPS64EL

MIPS64 (little-endian)

is_mips64el()

Architecture

🔲

MIPSEL

MIPS (32-bit, little-endian)

is_mipsel()

Architecture

🚩

NETBSD

NetBSD

is_netbsd()

Platform

NOBARA

Nobara

is_nobara()

Platform

𝜈

NUSHELL

Nushell

is_nushell()

Shell

🐡

OPENBSD

OpenBSD

is_openbsd()

Platform

🦎

OPENSUSE

openSUSE

is_opensuse()

Platform

📶

OPENWRT

OpenWrt

is_openwrt()

Platform

🦴

ORACLE

Oracle Linux

is_oracle()

Platform

PARALLELS

Parallels

is_parallels()

Platform

🍓

PIDORA

Pidora

is_pidora()

Platform

🔷

POWERSHELL

PowerShell

is_powershell()

Shell

PPC

PowerPC (32-bit)

is_ppc()

Architecture

PPC64

PowerPC 64-bit (big-endian)

is_ppc64()

Architecture

PPC64LE

PowerPC 64-bit (little-endian)

is_ppc64le()

Architecture

🍓

RASPBIAN

Raspbian

is_raspbian()

Platform

🎩

RHEL

RedHat Enterprise Linux

is_rhel()

Platform

🏞️

RIO

Rio

is_rio()

Terminal

RISCV32

RISC-V (32-bit)

is_riscv32()

Architecture

RISCV64

RISC-V (64-bit)

is_riscv64()

Architecture

⛰️

ROCKY

Rocky Linux

is_rocky()

Platform

🏢

S390X

IBM z/Architecture (s390x)

is_s390x()

Architecture

⚛️

SCIENTIFIC

Scientific Linux

is_scientific()

Platform

🚬

SLACKWARE

Slackware

is_slackware()

Platform

🦎

SLES

SUSE Linux Enterprise Server

is_sles()

Platform

🌞

SOLARIS

Solaris

is_solaris()

Platform

☀️

SPARC

SPARC (32-bit)

is_sparc()

Architecture

☀️

SPARC64

SPARC (64-bit)

is_sparc64()

Architecture

🌅

SUNOS

SunOS

is_sunos()

Platform

🐈

TABBY

Tabby

is_tabby()

Terminal

𝐓

TCSH

tcsh

is_tcsh()

Shell

🏙️

TEAMCITY

TeamCity

is_teamcity()

CI

🔀

TILIX

Tilix

is_tilix()

Terminal

📟

TMUX

tmux

is_tmux()

Terminal

👷

TRAVIS_CI

Travis CI

is_travis_ci()

CI

TUMBLEWEED

openSUSE Tumbleweed

is_tumbleweed()

Platform

🤵

TUXEDO

Tuxedo OS

is_tuxedo()

Platform

🎯

UBUNTU

Ubuntu

is_ubuntu()

Platform

🌊

ULTRAMARINE

Ultramarine

is_ultramarine()

Platform

UNKNOWN_ARCHITECTURE

Unknown architecture

is_unknown_architecture()

Architecture

UNKNOWN_CI

Unknown CI

is_unknown_ci()

CI

UNKNOWN_PLATFORM

Unknown platform

is_unknown_platform()

Platform

UNKNOWN_SHELL

Unknown shell

is_unknown_shell()

Shell

UNKNOWN_TERMINAL

Unknown terminal

is_unknown_terminal()

Terminal

🔵

VSCODE_TERMINAL

VS Code Terminal

is_vscode_terminal()

Terminal

🌐

WASM32

WebAssembly (32-bit)

is_wasm32()

Architecture

🌐

WASM64

WebAssembly (64-bit)

is_wasm64()

Architecture

🔡

WEZTERM

WezTerm

is_wezterm()

Terminal

🪟

WINDOWS

Windows

is_windows()

Platform

WINDOWS_TERMINAL

Windows Terminal

is_windows_terminal()

Terminal

WSL1

Windows Subsystem for Linux v1

is_wsl1()

Platform

WSL2

Windows Subsystem for Linux v2

is_wsl2()

Platform

🖥️

X86_64

x86-64 (AMD64)

is_x86_64()

Architecture

XENSERVER

XenServer

is_xenserver()

Platform

🐍

XONSH

Xonsh

is_xonsh()

Shell

𝐗

XTERM

xterm

is_xterm()

Terminal

🪵

ZELLIJ

Zellij

is_zellij()

Terminal

ZSH

Zsh

is_zsh()

Shell

Trait implementation

        classDiagram
  ABC <|-- Trait
  Trait <|-- Architecture
  Trait <|-- CI
  Trait <|-- Platform
  Trait <|-- Shell
  Trait <|-- Terminal
  _Identifiable <|-- Trait
    
class extra_platforms.Trait(id, name, icon='❓', url='', aliases=<factory>)[source]

Bases: _Identifiable, ABC

Base class for system traits like platforms and architectures.

A trait is a distinguishing characteristic of the runtime environment that can be detected and identified.

Additionally of the common fields inherited from _Identifiable, each trait provides:

  • url: A link to official documentation or website for the trait.

  • current: A boolean indicating if the current environment matches this trait.

  • info(): A method returning a dictionary of gathered attributes about the trait.

  • groups: A set of Group objects that include this trait as a member.

url: str = ''

URL to the trait’s official website or documentation.

aliases: frozenset[str]

Alternative IDs for this trait.

Aliases are alternative identifiers that resolve to the same trait. When an alias is used, a warning is emitted to encourage using the canonical ID.

Note

Aliases do not generate their own symbols, detection functions, or pytest decorators. Only the canonical id produces these artifacts.

generate_docstring()[source]

Generate comprehensive docstring for this trait instance.

Combines the attribute docstring from the source module with various metadata.

Return type:

str

property groups: frozenset

Returns the set of groups this trait belongs to.

Uses dynamic import to avoid circular dependency with group_data module.

Returns:

A frozenset of Group objects that contain this trait as a member.

property current: bool

Returns whether the current environment matches this trait.

The detection function is dynamically looked up based on the trait ID, and is expected to be found at the root of the extra_platforms module.

Raises NotImplementedError if a detection function cannot be found.

Hint

This is a property to avoid calling all detection heuristics on Trait object creation, which happens at module import time.

abstractmethod info()[source]

Returns all trait attributes that can be gathered.

Returns a dict of metadata. Subclasses should override this to include trait-specific information.

Return type:

dict

_base_info()[source]

Returns the base info dictionary common to all traits.

Return type:

dict[str, str | bool | None]

_abc_impl = <_abc._abc_data object>
all_group: ClassVar[str] = 'ALL_TRAITS'

The symbol name for the group containing all instances of this type.

data_module_id: ClassVar[str] = 'trait_data'

The module name where instances of this type are defined.

doc_page: ClassVar[str] = 'traits.md'

The documentation page filename.

type_id: ClassVar[str] = 'trait'

Machine-readable type identifier used to derive module and symbol names.

type_name: ClassVar[str] = 'trait'

Human-readable type name for documentation.

unknown_symbol: ClassVar[str] = 'UNKNOWN_TRAIT'

The symbol name for the unknown instance of this type.

class extra_platforms.Platform(id, name, icon='❓', url='', aliases=<factory>)[source]

Bases: Trait

A platform can identify multiple distributions or OSes with the same characteristics.

_abc_impl = <_abc._abc_data object>
all_group: ClassVar[str] = 'ALL_PLATFORMS'

The symbol name for the group containing all instances of this type.

data_module_id: ClassVar[str] = 'platform_data'

The module name where instances of this type are defined.

doc_page: ClassVar[str] = 'platforms.md'

The documentation page filename.

type_id: ClassVar[str] = 'platform'

Machine-readable type identifier used to derive module and symbol names.

type_name: ClassVar[str] = 'platform'

Human-readable type name for documentation.

unknown_symbol: ClassVar[str] = 'UNKNOWN_PLATFORM'

The symbol name for the unknown instance of this type.

info()[source]

Returns all platform attributes we can gather.

Return type:

dict[str, str | bool | None | dict[str, str | None]]

class extra_platforms.Architecture(id, name, icon='❓', url='', aliases=<factory>)[source]

Bases: Trait

A CPU architecture identifies a processor instruction set.

_abc_impl = <_abc._abc_data object>
all_group: ClassVar[str] = 'ALL_ARCHITECTURES'

The symbol name for the group containing all instances of this type.

data_module_id: ClassVar[str] = 'architecture_data'

The module name where instances of this type are defined.

doc_page: ClassVar[str] = 'architectures.md'

The documentation page filename.

info()[source]

Returns all architecture attributes we can gather.

Return type:

dict[str, str | bool | None]

type_id: ClassVar[str] = 'architecture'

Machine-readable type identifier used to derive module and symbol names.

type_name: ClassVar[str] = 'architecture'

Human-readable type name for documentation.

unknown_symbol: ClassVar[str] = 'UNKNOWN_ARCHITECTURE'

The symbol name for the unknown instance of this type.

class extra_platforms.Shell(id, name, icon='❓', url='', aliases=<factory>)[source]

Bases: Trait

A shell identifies a command-line interpreter.

_abc_impl = <_abc._abc_data object>
all_group: ClassVar[str] = 'ALL_SHELLS'

The symbol name for the group containing all instances of this type.

data_module_id: ClassVar[str] = 'shell_data'

The module name where instances of this type are defined.

doc_page: ClassVar[str] = 'shells.md'

The documentation page filename.

type_id: ClassVar[str] = 'shell'

Machine-readable type identifier used to derive module and symbol names.

type_name: ClassVar[str] = 'shell'

Human-readable type name for documentation.

unknown_symbol: ClassVar[str] = 'UNKNOWN_SHELL'

The symbol name for the unknown instance of this type.

info()[source]

Returns all shell attributes we can gather.

Return type:

dict[str, str | bool | None]

_detect_version()[source]

Return the shell version from environment if available.

Return type:

str | None

class extra_platforms.Terminal(id, name, icon='❓', url='', aliases=<factory>)[source]

Bases: Trait

A terminal identifies the application rendering the shell’s output.

Note

Shell and Terminal are orthogonal: any shell can run inside any terminal. Unlike shells, multiple terminals can be active simultaneously (e.g., tmux inside Kitty).

See also

Other tools that detect terminals for adaptation:

  • Starship adapts prompt rendering based on terminal

  • crossterm (Rust) negotiates terminal features

  • python-prompt-toolkit adapts to terminal capabilities

  • rich probes terminal features for rendering

  • termenv (Go) maintains terminal capability database

_abc_impl = <_abc._abc_data object>
all_group: ClassVar[str] = 'ALL_TERMINALS'

The symbol name for the group containing all instances of this type.

data_module_id: ClassVar[str] = 'terminal_data'

The module name where instances of this type are defined.

doc_page: ClassVar[str] = 'terminals.md'

The documentation page filename.

type_id: ClassVar[str] = 'terminal'

Machine-readable type identifier used to derive module and symbol names.

type_name: ClassVar[str] = 'terminal'

Human-readable type name for documentation.

unknown_symbol: ClassVar[str] = 'UNKNOWN_TERMINAL'

The symbol name for the unknown instance of this type.

info()[source]

Returns all terminal attributes we can gather.

Return type:

dict[str, str | bool | None]

class extra_platforms.CI(id, name, icon='❓', url='', aliases=<factory>)[source]

Bases: Trait

A CI/CD environment identifies a continuous integration platform.

_abc_impl = <_abc._abc_data object>
data_module_id: ClassVar[str] = 'ci_data'

The module name where instances of this type are defined.

type_id: ClassVar[str] = 'ci'

Machine-readable type identifier used to derive module and symbol names.

unknown_symbol: ClassVar[str] = 'UNKNOWN_CI'

The symbol name for the unknown instance of this type.

type_name: ClassVar[str] = 'CI system'

Override the default ci type name.

all_group: ClassVar[str] = 'ALL_CI'

Override the default ALL_CIS name with a more natural ALL_CI.

doc_page: ClassVar[str] = 'ci.md'

Override the default cis.md filename.

info()[source]

Returns all CI attributes we can gather.

Return type:

dict[str, str | bool | None]