Traits

All aspects of a system are represented as traits.

There are three main types of traits:

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

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

  • 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

🐧

ALTLINUX

ALT Linux

is_altlinux()

Platform

AMZN

Amazon Linux

is_amzn()

Platform

🤖

ANDROID

Android

is_android()

Platform

🎗️

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

AZURE_PIPELINES

Azure Pipelines

is_azure_pipelines()

CI

BAMBOO

Bamboo

is_bamboo()

CI

🪁

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

CODEBUILD

CodeBuild

is_codebuild()

CI

Ͼ

CYGWIN

Cygwin

is_cygwin()

Platform

🌀

DEBIAN

Debian

is_debian()

Platform

🪰

DRAGONFLY_BSD

DragonFly BSD

is_dragonfly_bsd()

Platform

🐽

EXHERBO

Exherbo Linux

is_exherbo()

Platform

🎩

FEDORA

Fedora

is_fedora()

Platform

😈

FREEBSD

FreeBSD

is_freebsd()

Platform

🗜️

GENTOO

Gentoo Linux

is_gentoo()

Platform

🐙

GITHUB_CI

GitHub Actions runner

is_github_ci()

CI

🦊

GITLAB_CI

GitLab CI

is_gitlab_ci()

CI

🐃

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

𝗶

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

🤹

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

🌘

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

🐡

OPENBSD

OpenBSD

is_openbsd()

Platform

🦎

OPENSUSE

openSUSE

is_opensuse()

Platform

🦴

ORACLE

Oracle Linux

is_oracle()

Platform

PARALLELS

Parallels

is_parallels()

Platform

🍓

PIDORA

Pidora

is_pidora()

Platform

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

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

🏙️

TEAMCITY

TeamCity

is_teamcity()

CI

👷

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

🌐

WASM32

WebAssembly (32-bit)

is_wasm32()

Architecture

🌐

WASM64

WebAssembly (64-bit)

is_wasm64()

Architecture

🪟

WINDOWS

Windows

is_windows()

Platform

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

Trait implementation

        classDiagram
  ABC <|-- Trait
  Trait <|-- Architecture
  Trait <|-- CI
  Trait <|-- Platform
  _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

_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.

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.

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.

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]

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.

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.

info()[source]

Returns all architecture 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]