Platforms

Each platform represents an operating system or OS-like environment, and is associated with:

Platform usage

Each platform is materialized by a Platform object, from which you can access various metadata:

>>> from extra_platforms import DEBIAN
>>> DEBIAN
Platform(id='debian', name='Debian')
>>> DEBIAN.id
'debian'
>>> DEBIAN.current
False
>>> DEBIAN.info()
{'id': 'debian', 'name': 'Debian', 'icon': '🌀', 'url': 'https://debian.org', 'current': False, 'distro_id': None, 'version': None, 'version_parts': {'major': None, 'minor': None, 'build_number': None}, 'like': None, 'codename': None}

To check if the current platform matches a specific platform, use the corresponding detection function:

>>> from extra_platforms import is_macos
>>> is_macos()
True

The current platform can be obtained via the current_platform() function:

>>> from extra_platforms import current_platform
>>> current_platform()
Platform(id='macos', name='macOS')

Recognized platforms

Icon

Symbol

Name

Detection function

AIX

IBM AIX

is_aix()

🐧

ALTLINUX

ALT Linux

is_altlinux()

AMZN

Amazon Linux

is_amzn()

🤖

ANDROID

Android

is_android()

🎗️

ARCH

Arch Linux

is_arch()

⛑️

BUILDROOT

Buildroot

is_buildroot()

CACHYOS

CachyOS

is_cachyos()

💠

CENTOS

CentOS

is_centos()

CLOUDLINUX

CloudLinux OS

is_cloudlinux()

Ͼ

CYGWIN

Cygwin

is_cygwin()

🌀

DEBIAN

Debian

is_debian()

🪰

DRAGONFLY_BSD

DragonFly BSD

is_dragonfly_bsd()

🐽

EXHERBO

Exherbo Linux

is_exherbo()

🎩

FEDORA

Fedora

is_fedora()

😈

FREEBSD

FreeBSD

is_freebsd()

🗜️

GENTOO

Gentoo Linux

is_gentoo()

🐃

GUIX

Guix System

is_guix()

🍂

HAIKU

Haiku

is_haiku()

🐃

HURD

GNU/Hurd

is_hurd()

🤹

IBM_POWERKVM

IBM PowerKVM

is_ibm_powerkvm()

🔥

ILLUMOS

illumos

is_illumos()

🤹

KVMIBM

KVM for IBM z Systems

is_kvmibm()

🌿

LINUXMINT

Linux Mint

is_linuxmint()

🍎

MACOS

macOS

is_macos()

MAGEIA

Mageia

is_mageia()

💫

MANDRIVA

Mandriva Linux

is_mandriva()

🌘

MIDNIGHTBSD

MidnightBSD

is_midnightbsd()

🚩

NETBSD

NetBSD

is_netbsd()

NOBARA

Nobara

is_nobara()

🐡

OPENBSD

OpenBSD

is_openbsd()

🦎

OPENSUSE

openSUSE

is_opensuse()

🦴

ORACLE

Oracle Linux

is_oracle()

PARALLELS

Parallels

is_parallels()

🍓

PIDORA

Pidora

is_pidora()

🍓

RASPBIAN

Raspbian

is_raspbian()

🎩

RHEL

RedHat Enterprise Linux

is_rhel()

⛰️

ROCKY

Rocky Linux

is_rocky()

⚛️

SCIENTIFIC

Scientific Linux

is_scientific()

🚬

SLACKWARE

Slackware

is_slackware()

🦎

SLES

SUSE Linux Enterprise Server

is_sles()

🌞

SOLARIS

Solaris

is_solaris()

☀️

SUNOS

SunOS

is_sunos()

TUMBLEWEED

openSUSE Tumbleweed

is_tumbleweed()

🤵

TUXEDO

Tuxedo OS

is_tuxedo()

🎯

UBUNTU

Ubuntu

is_ubuntu()

🌊

ULTRAMARINE

Ultramarine

is_ultramarine()

🪟

WINDOWS

Windows

is_windows()

WSL1

Windows Subsystem for Linux v1

is_wsl1()

WSL2

Windows Subsystem for Linux v2

is_wsl2()

XENSERVER

XenServer

is_xenserver()

Hint

The UNKNOWN_PLATFORM trait represents an unrecognized platform. It is not included in the ALL_PLATFORMS group, and will be returned by current_platform() if the current platform is not recognized.

Groups of platforms

All platform groups

Icon

Symbol

Description

Detection

Canonical

⚙️

ALL_PLATFORMS

All platforms

is_any_platform()

🪟

ALL_WINDOWS

All Windows

is_any_windows()

🅱️+

BSD

All BSD

is_bsd()

🅱️

BSD_WITHOUT_MACOS

All BSD excluding macOS

is_bsd_not_macos()

🐧

LINUX

Linux distributions

is_linux()

LINUX_LAYERS

Linux compatibility layers

is_linux_layers()

🐧+

LINUX_LIKE

All Linux & compatibility layers

is_linux_like()

🅟

OTHER_POSIX

Other POSIX-compliant platforms

is_other_posix()

𝐕

SYSTEM_V

AT&T System Five

is_system_v()

UNIX

All Unix

is_unix()

UNIX_LAYERS

Unix compatibility layers

is_unix_layers()

UNIX_WITHOUT_MACOS

All Unix excluding macOS

is_unix_not_macos()

Hint

Canonical groups are non-overlapping groups that together cover all recognized traits. They are marked with a ⬥ icon in the table above.

Other groups are provided for convenience, but overlap with each other or with canonical groups.

Canonical groups

All platforms are distributed in groups that are guaranteed to be non-overlapping.

Here is the canonical groups and all platforms, visualized as a Sankey diagram:

        ---
config:
  sankey:
    height: 800
    showValues: false
    width: 800

---
sankey-beta

ALL_PLATFORMS,LINUX,34
ALL_PLATFORMS,BSD,7
ALL_PLATFORMS,SYSTEM_V,3
ALL_PLATFORMS,OTHER_POSIX,2
ALL_PLATFORMS,LINUX_LAYERS,2
ALL_PLATFORMS,UNIX_LAYERS,1
ALL_PLATFORMS,ALL_WINDOWS,1
LINUX,ALTLINUX,1
LINUX,AMZN,1
LINUX,ANDROID,1
LINUX,ARCH,1
LINUX,BUILDROOT,1
LINUX,CACHYOS,1
LINUX,CENTOS,1
LINUX,CLOUDLINUX,1
LINUX,DEBIAN,1
LINUX,EXHERBO,1
LINUX,FEDORA,1
LINUX,GENTOO,1
LINUX,GUIX,1
LINUX,IBM_POWERKVM,1
LINUX,KVMIBM,1
LINUX,LINUXMINT,1
LINUX,MAGEIA,1
LINUX,MANDRIVA,1
LINUX,NOBARA,1
LINUX,OPENSUSE,1
LINUX,ORACLE,1
LINUX,PARALLELS,1
LINUX,PIDORA,1
LINUX,RASPBIAN,1
LINUX,RHEL,1
LINUX,ROCKY,1
LINUX,SCIENTIFIC,1
LINUX,SLACKWARE,1
LINUX,SLES,1
LINUX,TUMBLEWEED,1
LINUX,TUXEDO,1
LINUX,UBUNTU,1
LINUX,ULTRAMARINE,1
LINUX,XENSERVER,1
BSD,DRAGONFLY_BSD,1
BSD,FREEBSD,1
BSD,MACOS,1
BSD,MIDNIGHTBSD,1
BSD,NETBSD,1
BSD,OPENBSD,1
BSD,SUNOS,1
SYSTEM_V,AIX,1
SYSTEM_V,ILLUMOS,1
SYSTEM_V,SOLARIS,1
OTHER_POSIX,HAIKU,1
OTHER_POSIX,HURD,1
LINUX_LAYERS,WSL1,1
LINUX_LAYERS,WSL2,1
UNIX_LAYERS,CYGWIN,1
ALL_WINDOWS,WINDOWS,1
    

And the same groups visualized as a mindmap:

        ---
config:
  mindmap:
    padding: 5

---
mindmap
    ((⚙️ ALL_PLATFORMS))
        )≛ UNIX_LAYERS(
            (Ͼ CYGWIN)
        )𝐕 SYSTEM_V(
            (➿ AIX)
            (🔥 ILLUMOS)
            (🌞 SOLARIS)
        )🅟 OTHER_POSIX(
            (🍂 HAIKU)
            (🐃 HURD)
        )≚ LINUX_LAYERS(
            (⊞ WSL1)
            (⊞ WSL2)
        )🐧 LINUX(
            (🐧 ALTLINUX)
            (⤻ AMZN)
            (🤖 ANDROID)
            (🎗️ ARCH)
            (⛑️ BUILDROOT)
            (⌬ CACHYOS)
            (💠 CENTOS)
            (꩜ CLOUDLINUX)
            (🌀 DEBIAN)
            (🐽 EXHERBO)
            (🎩 FEDORA)
            (🗜️ GENTOO)
            (🐃 GUIX)
            (🤹 IBM_POWERKVM)
            (🤹 KVMIBM)
            (🌿 LINUXMINT)
            (⍥ MAGEIA)
            (💫 MANDRIVA)
            ( NOBARA)
            (🦎 OPENSUSE)
            (🦴 ORACLE)
            (∥ PARALLELS)
            (🍓 PIDORA)
            (🍓 RASPBIAN)
            (🎩 RHEL)
            (⛰️ ROCKY)
            (⚛️ SCIENTIFIC)
            (🚬 SLACKWARE)
            (🦎 SLES)
            (↻ TUMBLEWEED)
            (🤵 TUXEDO)
            (🎯 UBUNTU)
            (🌊 ULTRAMARINE)
            (Ⓧ XENSERVER)
        )🅱️+ BSD(
            (🪰 DRAGONFLY_BSD)
            (😈 FREEBSD)
            (🍎 MACOS)
            (🌘 MIDNIGHTBSD)
            (🚩 NETBSD)
            (🐡 OPENBSD)
            (☀️ SUNOS)
        )🪟 ALL_WINDOWS(
            (🪟 WINDOWS)
    

Predefined platforms

Platform definitions and metadata.

Note

Default icons are inspired from Starship project: - https://starship.rs/config/#os - https://github.com/davidkna/starship/blob/e9faf17/.github/config-schema.json#L1221-L1269

Some icons, especially Linux distributions, have their own dedicated codepoints in NerdFonts.

extra_platforms.platform_data.NOBARA = Platform(id='nobara', name='Nobara')

Note

Instead of using a loose Unicode icon for the Nobara OS, or just not adding any, we are using a NerdFont icon instead:  (i.e. nf-linux-nobara / f380).

The side-effect of using a NerdFont character is it will only display correctly when using a supported font. Otherwise, it will appear as an unknown or invisible character depending on the fonts.

Todo

In the future, we may want to have two icons for each platform, one that is Unicode-based, the other that is NerdFont-based.

extra_platforms.AIX = Platform(id='aix', name='IBM AIX')
extra_platforms.ALTLINUX = Platform(id='altlinux', name='ALT Linux')
extra_platforms.AMZN = Platform(id='amzn', name='Amazon Linux')
extra_platforms.ANDROID = Platform(id='android', name='Android')
extra_platforms.ARCH = Platform(id='arch', name='Arch Linux')
extra_platforms.BUILDROOT = Platform(id='buildroot', name='Buildroot')
extra_platforms.CACHYOS = Platform(id='cachyos', name='CachyOS')
extra_platforms.CENTOS = Platform(id='centos', name='CentOS')
extra_platforms.CLOUDLINUX = Platform(id='cloudlinux', name='CloudLinux OS')
extra_platforms.CYGWIN = Platform(id='cygwin', name='Cygwin')
extra_platforms.DEBIAN = Platform(id='debian', name='Debian')
extra_platforms.DRAGONFLY_BSD = Platform(id='dragonfly_bsd', name='DragonFly BSD')
extra_platforms.EXHERBO = Platform(id='exherbo', name='Exherbo Linux')
extra_platforms.FEDORA = Platform(id='fedora', name='Fedora')
extra_platforms.FREEBSD = Platform(id='freebsd', name='FreeBSD')
extra_platforms.GENTOO = Platform(id='gentoo', name='Gentoo Linux')
extra_platforms.GUIX = Platform(id='guix', name='Guix System')
extra_platforms.HAIKU = Platform(id='haiku', name='Haiku')
extra_platforms.HURD = Platform(id='hurd', name='GNU/Hurd')
extra_platforms.IBM_POWERKVM = Platform(id='ibm_powerkvm', name='IBM PowerKVM')
extra_platforms.ILLUMOS = Platform(id='illumos', name='illumos')
extra_platforms.KVMIBM = Platform(id='kvmibm', name='KVM for IBM z Systems')
extra_platforms.LINUXMINT = Platform(id='linuxmint', name='Linux Mint')
extra_platforms.MACOS = Platform(id='macos', name='macOS')
extra_platforms.MAGEIA = Platform(id='mageia', name='Mageia')
extra_platforms.MANDRIVA = Platform(id='mandriva', name='Mandriva Linux')
extra_platforms.MIDNIGHTBSD = Platform(id='midnightbsd', name='MidnightBSD')
extra_platforms.NETBSD = Platform(id='netbsd', name='NetBSD')
extra_platforms.NOBARA = Platform(id='nobara', name='Nobara')

Note

Instead of using a loose Unicode icon for the Nobara OS, or just not adding any, we are using a NerdFont icon instead:  (i.e. nf-linux-nobara / f380).

The side-effect of using a NerdFont character is it will only display correctly when using a supported font. Otherwise, it will appear as an unknown or invisible character depending on the fonts.

Todo

In the future, we may want to have two icons for each platform, one that is Unicode-based, the other that is NerdFont-based.

extra_platforms.OPENBSD = Platform(id='openbsd', name='OpenBSD')
extra_platforms.OPENSUSE = Platform(id='opensuse', name='openSUSE')
extra_platforms.ORACLE = Platform(id='oracle', name='Oracle Linux')
extra_platforms.PARALLELS = Platform(id='parallels', name='Parallels')
extra_platforms.PIDORA = Platform(id='pidora', name='Pidora')
extra_platforms.RASPBIAN = Platform(id='raspbian', name='Raspbian')
extra_platforms.RHEL = Platform(id='rhel', name='RedHat Enterprise Linux')
extra_platforms.ROCKY = Platform(id='rocky', name='Rocky Linux')
extra_platforms.SCIENTIFIC = Platform(id='scientific', name='Scientific Linux')
extra_platforms.SLACKWARE = Platform(id='slackware', name='Slackware')
extra_platforms.SLES = Platform(id='sles', name='SUSE Linux Enterprise Server')
extra_platforms.SOLARIS = Platform(id='solaris', name='Solaris')
extra_platforms.SUNOS = Platform(id='sunos', name='SunOS')
extra_platforms.TUMBLEWEED = Platform(id='tumbleweed', name='openSUSE Tumbleweed')
extra_platforms.TUXEDO = Platform(id='tuxedo', name='Tuxedo OS')
extra_platforms.UBUNTU = Platform(id='ubuntu', name='Ubuntu')
extra_platforms.ULTRAMARINE = Platform(id='ultramarine', name='Ultramarine')
extra_platforms.UNKNOWN_PLATFORM = Platform(id='unknown_platform', name='Unknown platform')
extra_platforms.WINDOWS = Platform(id='windows', name='Windows')
extra_platforms.WSL1 = Platform(id='wsl1', name='Windows Subsystem for Linux v1')
extra_platforms.WSL2 = Platform(id='wsl2', name='Windows Subsystem for Linux v2')
extra_platforms.XENSERVER = Platform(id='xenserver', name='XenServer')

Deprecated platforms

extra_platforms.UNKNOWN_LINUX(*args, **kwargs) = Platform(id='unknown_platform', name='Unknown platform')

Alias UNKNOWN_LINUXUNKNOWN_PLATFORM.

Deprecated since version 7.0.0: Use UNKNOWN_PLATFORM instead.