PlatformsΒΆ

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

  • a unique platform ID

  • a human-readable name

  • an icon (emoji / unicode character)

  • a detection function

  • various metadata in its info() method

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

Name

ID

Detection function

➿

IBM AIX

aix

is_aix()

🐧

ALT Linux

altlinux

is_altlinux()

β€»

Amazon Linux

amzn

is_amzn()

πŸ€–

Android

android

is_android()

πŸŽ—οΈ

Arch Linux

arch

is_arch()

⛑️

Buildroot

buildroot

is_buildroot()

⌬

CachyOS

cachyos

is_cachyos()

πŸ’ 

CentOS

centos

is_centos()

꩜

CloudLinux OS

cloudlinux

is_cloudlinux()

ΟΎ

Cygwin

cygwin

is_cygwin()

πŸŒ€

Debian

debian

is_debian()

🐽

Exherbo Linux

exherbo

is_exherbo()

🎩

Fedora

fedora

is_fedora()

😈

FreeBSD

freebsd

is_freebsd()

πŸ—œοΈ

Gentoo Linux

gentoo

is_gentoo()

πŸƒ

Guix System

guix

is_guix()

πŸƒ

GNU/Hurd

hurd

is_hurd()

🀹

IBM PowerKVM

ibm_powerkvm

is_ibm_powerkvm()

🀹

KVM for IBM z Systems

kvmibm

is_kvmibm()

🌿

Linux Mint

linuxmint

is_linuxmint()

🍎

macOS

macos

is_macos()

β₯

Mageia

mageia

is_mageia()

πŸ’«

Mandriva Linux

mandriva

is_mandriva()

🌘

MidnightBSD

midnightbsd

is_midnightbsd()

🚩

NetBSD

netbsd

is_netbsd()

οŽ€

Nobara

nobara

is_nobara()

🐑

OpenBSD

openbsd

is_openbsd()

🦎

openSUSE

opensuse

is_opensuse()

🦴

Oracle Linux

oracle

is_oracle()

βˆ₯

Parallels

parallels

is_parallels()

πŸ“

Pidora

pidora

is_pidora()

πŸ“

Raspbian

raspbian

is_raspbian()

🎩

RedHat Enterprise Linux

rhel

is_rhel()

⛰️

Rocky Linux

rocky

is_rocky()

βš›οΈ

Scientific Linux

scientific

is_scientific()

🚬

Slackware

slackware

is_slackware()

🦎

SUSE Linux Enterprise Server

sles

is_sles()

🌞

Solaris

solaris

is_solaris()

β˜€οΈ

SunOS

sunos

is_sunos()

↻

openSUSE Tumbleweed

tumbleweed

is_tumbleweed()

🀡

Tuxedo OS

tuxedo

is_tuxedo()

🎯

Ubuntu

ubuntu

is_ubuntu()

🌊

Ultramarine

ultramarine

is_ultramarine()

🐧

Unknown Linux

unknown_linux

is_unknown_linux()

πŸͺŸ

Windows

windows

is_windows()

⊞

Windows Subsystem for Linux v1

wsl1

is_wsl1()

⊞

Windows Subsystem for Linux v2

wsl2

is_wsl2()

Ⓧ

XenServer

xenserver

is_xenserver()

Groups of platformsΒΆ

All recognized platforms are grouped in families.

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,35
ALL_PLATFORMS,BSD,6
ALL_PLATFORMS,SYSTEM_V,2
ALL_PLATFORMS,LINUX_LAYERS,2
ALL_PLATFORMS,UNIX_LAYERS,1
ALL_PLATFORMS,OTHER_UNIX,1
ALL_PLATFORMS,ANY_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,unknown_linux,1
LINUX,xenserver,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,solaris,1
LINUX_LAYERS,wsl1,1
LINUX_LAYERS,wsl2,1
UNIX_LAYERS,cygwin,1
OTHER_UNIX,hurd,1
ANY_WINDOWS,windows,1
    

And the same groups visualized as a mindmap:

        ---
config:
  mindmap:
    padding: 5

---
mindmap
    ((βš™οΈ all_platforms))
        )≛ UNIX_LAYERS(
            (ΟΎ cygwin)
        )β…€ SYSTEM_V(
            (➿ aix)
            (🌞 solaris)
        )⊎ OTHER_UNIX(
            (πŸƒ 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)
            (🐧 unknown_linux)
            (Ⓧ xenserver)
        )πŸ…±οΈ+ BSD(
            (😈 freebsd)
            (🍎 macos)
            (🌘 midnightbsd)
            (🚩 netbsd)
            (🐑 openbsd)
            (β˜€οΈ sunos)
        )πŸͺŸ ANY_WINDOWS(
            (πŸͺŸ windows)
    

All groupsΒΆ

Here is a table listing all defined platform groups:

Icon

Group ID

Description

Canonical

Member count

βš™οΈ

all_platforms

All platforms

48

πŸͺŸ

any_windows

Any Windows

βœ…

1

πŸ…±οΈ+

bsd

Any BSD

βœ…

6

πŸ…±οΈ

bsd_without_macos

Any BSD excluding macOS

5

🐧

linux

Any Linux distribution

βœ…

35

β‰š

linux_layers

Any Linux compatibility layers

βœ…

2

🐧+

linux_like

Any Linux and compatibility layers

37

⊎

other_unix

Any other Unix

βœ…

1

β…€

system_v

AT&T System Five

βœ…

2

β¨·

unix

Any Unix

47

≛

unix_layers

Any Unix compatibility layers

βœ…

1

⨂

unix_without_macos

Any Unix excluding macOS

46

Hint

Canonical groups are non-overlapping groups that together cover all recognized platforms. 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.

Contribution guidelinesΒΆ

To add a new Linux distribution, you can get inspiration from these pull requests:

  • https://github.com/kdeldycke/extra-platforms/pull/156

  • https://github.com/kdeldycke/extra-platforms/pull/94

extra_platforms.platform APIΒΆ

        classDiagram
  Trait <|-- Platform
    

Platforms, also known as Operating Systems.

class extra_platforms.platform.Platform(id, name, icon='❓', url='')[source]ΒΆ

Bases: Trait

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

It has a unique ID, a human-readable name, and boolean to flag current platform.

icon: str = '❓'ΒΆ

Icon of the platform.

info()[source]ΒΆ

Returns all platform attributes we can gather.

Return type:

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

id: strΒΆ

Unique ID of the trait.

name: strΒΆ

User-friendly name of the trait.

extra_platforms.platform_data APIΒΆ

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.