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

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')

Compatibility layers can match at once

Most Linux distributions are identified by the ID field of their os-release file, while other systems are recognized through dedicated markers like sys.platform values, environment variables or vendor files.

A compatibility layer is detected alongside the system it hosts, so two platform detection functions can legitimately return True at the same time: inside WSL, both is_wsl2() (or is_wsl1()) and the hosted distribution’s function like is_ubuntu() match; inside ChromeOS’s Crostini container, both is_chromeos() and is_debian() do.

current_platform() narrows the matches down to the most informative one by dropping the layers (WSL1, WSL2, CHROMEOS) in favor of the hosted distribution. current_traits() keeps every match.

GENERIC_LINUX plays the opposite role: it is not an extra match but a fallback, only firing when the kernel is Linux and the distribution cannot be identified (like minimal containers or build chroots shipping no os-release file). current_platform() still returns it in that situation, while logging a warning inviting you to report the unrecognized distribution.

Recognized platforms

Independent derivative distributions each get a dedicated platform, even when they build on a parent distribution: Ubuntu, Kali Linux, Linux Mint, Raspbian and PikaOS are all Debian derivatives, but each is managed by its own organization. Release channels, variants and flavors of a single distribution, managed by the same organization as the parent, are folded into the parent’s platform: every openSUSE channel (Tumbleweed, Leap, Slowroll, MicroOS, …) is detected as OPENSUSE, while the raw channel ID remains available through info().

Icon

Symbol

Name

Detection function

AIX

IBM AIX

is_aix()

ALMALINUX

AlmaLinux

is_almalinux()

🏔️

ALPINE

Alpine Linux

is_alpine()

Δ

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()

🧿

CHROMEOS

ChromeOS

is_chromeos()

✳️

CLEARLINUX

Clear Linux OS

is_clearlinux()

CLOUDLINUX

CloudLinux OS

is_cloudlinux()

Ͼ

CYGWIN

Cygwin

is_cygwin()

🌀

DEBIAN

Debian

is_debian()

🪰

DRAGONFLY_BSD

DragonFly BSD

is_dragonfly_bsd()

🚀

ENDEAVOUROS

EndeavourOS

is_endeavouros()

🐽

EXHERBO

Exherbo Linux

is_exherbo()

🎩

FEDORA

Fedora

is_fedora()

😈

FREEBSD

FreeBSD

is_freebsd()

🥚

GENERIC_LINUX

Generic Linux

is_generic_linux()

🗜️

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()

🔱

KALI

Kali Linux

is_kali()

🤹

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()

MANJARO

Manjaro Linux

is_manjaro()

🌘

MIDNIGHTBSD

MidnightBSD

is_midnightbsd()

🚩

NETBSD

NetBSD

is_netbsd()

❄️

NIXOS

NixOS

is_nixos()

NOBARA

Nobara

is_nobara()

🐡

OPENBSD

OpenBSD

is_openbsd()

🦎

OPENSUSE

openSUSE

is_opensuse()

📶

OPENWRT

OpenWrt

is_openwrt()

🦴

ORACLE

Oracle Linux

is_oracle()

🟦

OS400

IBM i

is_os400()

PARALLELS

Parallels

is_parallels()

🍓

PIDORA

Pidora

is_pidora()

🐹

PIKAOS

PikaOS

is_pikaos()

🍓

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()

🕷️

SLITAZ

SliTaz GNU/Linux

is_slitaz()

🌞

SOLARIS

Solaris

is_solaris()

🧙

SOURCEMAGE

Source Mage GNU/Linux

is_sourcemage()

🌅

SUNOS

SunOS

is_sunos()

🤵

TUXEDO

Tuxedo OS

is_tuxedo()

🎯

UBUNTU

Ubuntu

is_ubuntu()

🌊

ULTRAMARINE

Ultramarine

is_ultramarine()

VOID

Void Linux

is_void()

🪟

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,47
ALL_PLATFORMS,BSD,7
ALL_PLATFORMS,SYSTEM_V,3
ALL_PLATFORMS,UNIX_LAYERS,2
ALL_PLATFORMS,OTHER_POSIX,2
ALL_PLATFORMS,LINUX_LAYERS,2
ALL_PLATFORMS,ALL_WINDOWS,1
LINUX,ALMALINUX,1
LINUX,ALPINE,1
LINUX,ALTLINUX,1
LINUX,AMZN,1
LINUX,ANDROID,1
LINUX,ARCH,1
LINUX,BUILDROOT,1
LINUX,CACHYOS,1
LINUX,CENTOS,1
LINUX,CHROMEOS,1
LINUX,CLEARLINUX,1
LINUX,CLOUDLINUX,1
LINUX,DEBIAN,1
LINUX,ENDEAVOUROS,1
LINUX,EXHERBO,1
LINUX,FEDORA,1
LINUX,GENERIC_LINUX,1
LINUX,GENTOO,1
LINUX,GUIX,1
LINUX,IBM_POWERKVM,1
LINUX,KALI,1
LINUX,KVMIBM,1
LINUX,LINUXMINT,1
LINUX,MAGEIA,1
LINUX,MANDRIVA,1
LINUX,MANJARO,1
LINUX,NIXOS,1
LINUX,NOBARA,1
LINUX,OPENSUSE,1
LINUX,OPENWRT,1
LINUX,ORACLE,1
LINUX,PARALLELS,1
LINUX,PIDORA,1
LINUX,PIKAOS,1
LINUX,RASPBIAN,1
LINUX,RHEL,1
LINUX,ROCKY,1
LINUX,SCIENTIFIC,1
LINUX,SLACKWARE,1
LINUX,SLES,1
LINUX,SLITAZ,1
LINUX,SOURCEMAGE,1
LINUX,TUXEDO,1
LINUX,UBUNTU,1
LINUX,ULTRAMARINE,1
LINUX,VOID,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
UNIX_LAYERS,CYGWIN,1
UNIX_LAYERS,OS400,1
OTHER_POSIX,HAIKU,1
OTHER_POSIX,HURD,1
LINUX_LAYERS,WSL1,1
LINUX_LAYERS,WSL2,1
ALL_WINDOWS,WINDOWS,1
    

And the same groups visualized as a mindmap:

        ---
config:
  mindmap:
    padding: 5

---
mindmap
    ((⚙️ ALL_PLATFORMS))
        )≛ UNIX_LAYERS(
            (Ͼ CYGWIN)
            (🟦 OS400)
        )𝐕 SYSTEM_V(
            (➿ AIX)
            (🔥 ILLUMOS)
            (🌞 SOLARIS)
        )🅟 OTHER_POSIX(
            (🍂 HAIKU)
            (🦬 HURD)
        )≚ LINUX_LAYERS(
            (⊞ WSL1)
            (⊞ WSL2)
        )🐧 LINUX(
            ( ALMALINUX)
            (🏔️ ALPINE)
            (Δ ALTLINUX)
            (⤻ AMZN)
            (🤖 ANDROID)
            (🎗️ ARCH)
            (⛑️ BUILDROOT)
            (⌬ CACHYOS)
            (💠 CENTOS)
            (🧿 CHROMEOS)
            (✳️ CLEARLINUX)
            (꩜ CLOUDLINUX)
            (🌀 DEBIAN)
            (🚀 ENDEAVOUROS)
            (🐽 EXHERBO)
            (🎩 FEDORA)
            (🥚 GENERIC_LINUX)
            (🗜️ GENTOO)
            (🐃 GUIX)
            (🤹 IBM_POWERKVM)
            (🔱 KALI)
            (🤹 KVMIBM)
            (🌿 LINUXMINT)
            (⍥ MAGEIA)
            (💫 MANDRIVA)
            (▲ MANJARO)
            (❄️ NIXOS)
            ( NOBARA)
            (🦎 OPENSUSE)
            (📶 OPENWRT)
            (🦴 ORACLE)
            (∥ PARALLELS)
            (🍓 PIDORA)
            (🐹 PIKAOS)
            (🍓 RASPBIAN)
            (🎩 RHEL)
            (⛰️ ROCKY)
            (⚛️ SCIENTIFIC)
            (🚬 SLACKWARE)
            (🦎 SLES)
            (🕷️ SLITAZ)
            (🧙 SOURCEMAGE)
            (🤵 TUXEDO)
            (🎯 UBUNTU)
            (🌊 ULTRAMARINE)
            (∅ VOID)
            (Ⓧ XENSERVER)
        )Ⓑ BSD(
            (🪰 DRAGONFLY_BSD)
            (😈 FREEBSD)
            (🍎 MACOS)
            (🌘 MIDNIGHTBSD)
            (🚩 NETBSD)
            (🐡 OPENBSD)
            (🌅 SUNOS)
        )🪟 ALL_WINDOWS(
            (🪟 WINDOWS)
    

Predefined platforms

Platform definitions and metadata.

Important

Not every distribution gets a dedicated entry. The granularity policy is:

  • Independent derivative distributions each get their own platform, even when they build on a parent distribution. Ubuntu, Kali Linux, Linux Mint, Raspbian and PikaOS are all Debian derivatives, but each is managed by its own organization, with its own identity, release cadence and package repositories.

  • Release channels, variants and flavors of a single distribution, managed by the same organization as the parent, are folded into the parent’s platform. Every openSUSE channel (Tumbleweed, Leap, Slowroll, MicroOS, …) is detected as OPENSUSE by its is_opensuse() detection function, while the raw channel ID remains available through Platform.info().

Note

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

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

extra_platforms.platform_data.ALMALINUX = Platform(id='almalinux', name='AlmaLinux')

Note

AlmaLinux has no representative Unicode emoji, so like NOBARA it uses a NerdFont icon instead:  (i.e. nf-linux-almalinux / f31d).

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.

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.ALMALINUX = Platform(id='almalinux', name='AlmaLinux')

Note

AlmaLinux has no representative Unicode emoji, so like NOBARA it uses a NerdFont icon instead:  (i.e. nf-linux-almalinux / f31d).

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.

extra_platforms.ALPINE = Platform(id='alpine', name='Alpine Linux')
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.CHROMEOS = Platform(id='chromeos', name='ChromeOS')
extra_platforms.CLEARLINUX = Platform(id='clearlinux', name='Clear Linux OS')
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.ENDEAVOUROS = Platform(id='endeavouros', name='EndeavourOS')
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.GENERIC_LINUX = Platform(id='generic_linux', name='Generic Linux')
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.KALI = Platform(id='kali', name='Kali Linux')
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.MANJARO = Platform(id='manjaro', name='Manjaro Linux')
extra_platforms.MIDNIGHTBSD = Platform(id='midnightbsd', name='MidnightBSD')
extra_platforms.NETBSD = Platform(id='netbsd', name='NetBSD')
extra_platforms.NIXOS = Platform(id='nixos', name='NixOS')
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.OPENWRT = Platform(id='openwrt', name='OpenWrt')
extra_platforms.ORACLE = Platform(id='oracle', name='Oracle Linux')
extra_platforms.OS400 = Platform(id='os400', name='IBM i')
extra_platforms.PARALLELS = Platform(id='parallels', name='Parallels')
extra_platforms.PIDORA = Platform(id='pidora', name='Pidora')
extra_platforms.PIKAOS = Platform(id='pikaos', name='PikaOS')
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.SLITAZ = Platform(id='slitaz', name='SliTaz GNU/Linux')
extra_platforms.SOLARIS = Platform(id='solaris', name='Solaris')
extra_platforms.SOURCEMAGE = Platform(id='sourcemage', name='Source Mage GNU/Linux')
extra_platforms.SUNOS = Platform(id='sunos', name='SunOS')
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.VOID = Platform(id='void', name='Void Linux')
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')

Platform information

Version and codename details behind info() are gathered by the platform_info module: Linux distributions through /etc/os-release, with systemd-hostnamed as a fallback for systems hiding that file, macOS and Windows through their own platform primitives.

Platform-specific information gathering.

This module provides utilities to fetch detailed version and codename information for all platforms: Linux distributions (via /etc/os-release), macOS and Windows.

Linux reads /etc/os-release, then /usr/lib/os-release. When neither file is readable, _hostnamectl_os_release() asks systemd-hostnamed for the same identity over D-Bus and rebuilds the os-release fields from its answer.

See also

The os-release specification defines the format and fields of /etc/os-release.

extra_platforms.platform_info.CODENAME_RE = re.compile('\\((\\D+)\\)|,\\s*(\\D+)')

Matches a codename trailing a version string.

The os-release specification puts no codename in VERSION, but distributions append one anyway, either parenthesized (22.04.3 LTS (Jammy Jellyfish)) or after a comma (10, Buster). Both forms exclude digits, which keeps the version itself out of the match.

extra_platforms.platform_info.CPE_ID_OVERRIDES: dict[str, str] = {'alt:server': 'altlinux', 'amazon:amazon_linux': 'amzn', 'amazon:linux': 'amzn', 'opensuse:leap': 'opensuse-leap', 'oracle:linux': 'ol', 'redhat:enterprise_linux': 'rhel', 'scientificlinux:scientificlinux': 'rhel', 'slackware:slackware_linux': 'slackware'}

Maps a CPE vendor:product pair to the os-release ID of the same system.

A CPE product name and an os-release ID are set by different bodies, so they agree for most distributions and diverge for some. Only the divergent pairs are listed here: _parse_cpe_name() uses the product itself for all the others, which covers almalinux, centos, cloudlinux, fedora, kvmibm, opensuse, rocky and sles.

Each entry is read from a real os-release file declaring both fields, as collected in python-distro’s test resources. Add an entry only from such a file: the rule is to reproduce the ID the system itself declares, never to pick the ID that looks right.

extra_platforms.platform_info.os_release_id() str[source]

Return the sanitized distribution ID from os-release.

Lowercases the ID field and replaces spaces with underscores. No other transformation is applied: sub-variant IDs (like ol for Oracle Linux, or opensuse-slowroll for the openSUSE Slowroll channel) are preserved verbatim, so linux_info() and Platform.info() expose the exact distribution flavor. Mapping these IDs to their canonical platform is the job of the detection functions (see is_oracle() and is_opensuse() in detection.py).

Return type:

str

Returns:

Sanitized distribution ID, or empty string if absent.

extra_platforms.platform_info.linux_info() dict[str, Any][source]

Fetch detailed Linux distribution information from os-release.

Returns a dictionary with the same structure as distro.info() for consistency, including:

  • id: Distribution ID (e.g., “ubuntu”, “fedora”)

  • version: Full version string (e.g., “22.04”)

  • version_parts: Dictionary with major, minor, build_number

  • like: Space-separated list of related distributions

  • codename: Distribution codename (e.g., “jammy”)

Missing fields are set to None, like in macos_info() and windows_info().

Return type:

dict[str, Any]

Returns:

Dictionary containing Linux distribution details.

extra_platforms.platform_info.invalidate_os_release_cache()[source]

Clear caches for all os-release functions.

Return type:

None

extra_platforms.platform_info.MACOS_CODENAMES: dict[tuple[str, str | None], str] = {('10', '0'): 'Cheetah', ('10', '1'): 'Puma', ('10', '10'): 'Yosemite', ('10', '11'): 'El Capitan', ('10', '12'): 'Sierra', ('10', '13'): 'High Sierra', ('10', '14'): 'Mojave', ('10', '15'): 'Catalina', ('10', '2'): 'Jaguar', ('10', '3'): 'Panther', ('10', '4'): 'Tiger', ('10', '5'): 'Leopard', ('10', '6'): 'Snow Leopard', ('10', '7'): 'Lion', ('10', '8'): 'Mountain Lion', ('10', '9'): 'Mavericks', ('11', None): 'Big Sur', ('12', None): 'Monterey', ('13', None): 'Ventura', ('14', None): 'Sonoma', ('15', None): 'Sequoia', ('26', None): 'Tahoe', ('27', None): 'Golden Gate'}

Maps macOS (major, minor) version parts to release code name.

Todo

Handle the oddity where some beta releases of macOS Tahoe report their major version as 16 instead of 15 or 26. Left unhandled for now, as we consider this a glitch in macOS history, and do not have a proper way to detect beta versions at this time.

extra_platforms.platform_info.get_macos_codename(major=None, minor=None)[source]

Get the macOS codename for a given version.

Parameters:
  • major (str | None) – The major version number (like "10", "11", "14").

  • minor (str | None) – The minor version number (like "0", "15"). For macOS 11+, this can be None as codenames are tied to major versions only.

Return type:

str

Returns:

The codename for the macOS version (like "Sonoma", "Ventura").

Raises:

ValueError – If no codename matches the given version, or if multiple codenames match (which shouldn’t happen with valid data).

extra_platforms.platform_info.macos_info()[source]

Fetch detailed macOS version information.

Returns a dictionary with the same structure as distro.info() for consistency, including:

  • version: Full version string (e.g., “14.2.1”)

  • version_parts: Dictionary with major, minor, build_number

  • codename: The macOS codename (e.g., “Sonoma”)

Return type:

dict[str, Any]

Returns:

A dictionary containing macOS version details.

Raises:

ValueError – If the current macOS version cannot be mapped to a codename.

extra_platforms.platform_info.windows_info()[source]

Fetch detailed Windows version information.

Returns a dictionary with the same structure as distro.info() for consistency, including:

  • version: Full version string (e.g., “10.0.19041”)

  • version_parts: Dictionary with major, minor, build_number

  • codename: A combination of version and edition (e.g., “10 Enterprise”)

Return type:

dict[str, Any]

Returns:

A dictionary containing Windows version details.

Todo

Get even more details for Windows version. See inspirations from: https://github.com/saltstack/salt/blob/246d066/salt/grains/core.py#L1432-L1488