Extra PlatformsΒΆ

Last release Python versions Downloads Unittests status Coverage status Documentation status DOI

What is Extra Platforms?ΒΆ

  • Inventory of all known architectures, platforms and CI systems

  • Detect the current architecture platform, at the distribution level

  • Platform metadata (version, codename, etc.)

  • Group platforms and architectures into families

  • Manage collection of platforms and groups

  • Associate each platform and group to an emoji symbol

  • Conditional markers decorators for pytest: @skip_<id>/@unless_<id> for each platform and group (@skip_android, @skip_any_windows, @skip_github_ci, …)

  • Fix distro#177 issue (support for Windows and Mac OS)

Quick startΒΆ

If you want to play with this library without contaminating your system, you can use uv:

$ uvx --with extra-platforms python
>>> import extra_platforms
>>> extra_platforms.__version__
'6.0.0'

ExamplesΒΆ

Get the current platform, from which you can access lots of metadata:

>>> from extra_platforms import current_platform
>>> my_os = current_platform()
>>> my_os
Platform(id='macos', name='macOS')
>>> my_os.id
'macos'
>>> my_os.name
'macOS'
>>> my_os.icon
'🍎'
>>> my_os.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',
}

Check if a platform is a specific system:

>>> from extra_platforms import is_gentoo
>>> is_gentoo()
False

Use groups to check if the current platform is part of a specific family:

>>> from extra_platforms import current_platform, BSD, UNIX, LINUX
>>> current_platform()
Platform(id='macos', name='macOS')
>>> current_platform() in BSD
True
>>> current_platform() in UNIX
True
>>> current_platform() in LINUX
False

Or directly use the detection functions returning a boolean that is associated with each group:

>>> from extra_platforms import is_bsd, is_unix, is_linux
>>> is_bsd()
True
>>> is_unix()
True
>>> is_linux()
False

List all platforms of a family:

>>> from extra_platforms import LINUX
>>> LINUX.members
mappingproxy({
    'altlinux': Platform(id='altlinux', name='ALT Linux'),
    'amzn': Platform(id='amzn', name='Amazon Linux'),
    'android': Platform(id='android', name='Android'),
    'arch': Platform(id='arch', name='Arch Linux'),
    'buildroot': Platform(id='buildroot', name='Buildroot'),
    'cachyos': Platform(id='cachyos', name='CachyOS'),
    'centos': Platform(id='centos', name='CentOS'),
    'cloudlinux': Platform(id='cloudlinux', name='CloudLinux OS'),
    'debian': Platform(id='debian', name='Debian'),
    'exherbo': Platform(id='exherbo', name='Exherbo Linux'),
    'fedora': Platform(id='fedora', name='Fedora'),
    'gentoo': Platform(id='gentoo', name='Gentoo Linux'),
    'guix': Platform(id='guix', name='Guix System'),
    'ibm_powerkvm': Platform(id='ibm_powerkvm', name='IBM PowerKVM'),
    'kvmibm': Platform(id='kvmibm', name='KVM for IBM z Systems'),
    'linuxmint': Platform(id='linuxmint', name='Linux Mint'),
    'mageia': Platform(id='mageia', name='Mageia'),
    'mandriva': Platform(id='mandriva', name='Mandriva Linux'),
    'nobara': Platform(id='nobara', name='Nobara'),
    'opensuse': Platform(id='opensuse', name='openSUSE'),
    'oracle': Platform(id='oracle', name='Oracle Linux'),
    'parallels': Platform(id='parallels', name='Parallels'),
    'pidora': Platform(id='pidora', name='Pidora'),
    'raspbian': Platform(id='raspbian', name='Raspbian'),
    'rhel': Platform(id='rhel', name='RedHat Enterprise Linux'),
    'rocky': Platform(id='rocky', name='Rocky Linux'),
    'scientific': Platform(id='scientific', name='Scientific Linux'),
    'slackware': Platform(id='slackware', name='Slackware'),
    'sles': Platform(id='sles', name='SUSE Linux Enterprise Server'),
    'tumbleweed': Platform(id='tumbleweed', name='openSUSE Tumbleweed'),
    'tuxedo': Platform(id='tuxedo', name='Tuxedo OS'),
    'ubuntu': Platform(id='ubuntu', name='Ubuntu'),
    'ultramarine': Platform(id='ultramarine', name='Ultramarine'),
    'unknown_linux': Platform(id='unknown_linux', name='Unknown Linux'),
    'xenserver': Platform(id='xenserver', name='XenServer'),
})
>>> LINUX.member_ids
frozenset({'centos', 'mageia', 'unknown_linux', 'ultramarine', 'tuxedo', 'arch', 'buildroot', 'android', 'exherbo', 'mandriva', 'fedora', 'slackware', 'parallels', 'xenserver', 'kvmibm', 'nobara', 'amzn', 'guix', 'debian', 'oracle', 'cachyos', 'altlinux', 'rhel', 'ibm_powerkvm', 'rocky', 'scientific', 'sles', 'linuxmint', 'tumbleweed', 'ubuntu', 'pidora', 'cloudlinux', 'gentoo', 'raspbian', 'opensuse'})
>>> print("\n".join([p.name for p in LINUX]))
ALT Linux
Amazon Linux
Android
Arch Linux
Buildroot
CachyOS
CentOS
CloudLinux OS
Debian
Exherbo Linux
Fedora
Gentoo Linux
Guix System
IBM PowerKVM
KVM for IBM z Systems
Linux Mint
Mageia
Mandriva Linux
Nobara
openSUSE
Oracle Linux
Parallels
Pidora
Raspbian
RedHat Enterprise Linux
Rocky Linux
Scientific Linux
Slackware
SUSE Linux Enterprise Server
openSUSE Tumbleweed
Tuxedo OS
Ubuntu
Ultramarine
Unknown Linux
XenServer

Reduce a disparate collection of groups and platforms into a minimal descriptive set, by grouping all platforms into families:

>>> from extra_platforms import AIX, MACOS, SOLARIS, reduce
>>> reduce([AIX, MACOS])
frozenset({
    Platform(id='macos', name='macOS'),
    Platform(id='aix', name='IBM AIX'),
})
>>> reduce([AIX, MACOS, SOLARIS])
frozenset({
    Group(id='system_v', name='AT&T System Five'),
    Platform(id='macos', name='macOS'),
})

ArchitecturesΒΆ

All recognized architectures and how they’re grouped:

        ---
config:
  mindmap:
    padding: 5

---
mindmap
    ((πŸ›οΈ all_architectures))
        )πŸ”² X86(
            (πŸ”² i386)
            (πŸ”² i586)
            (πŸ”² i686)
            (πŸ’» x86_64)
        )🌐 WEBASSEMBLY(
            (🌐 wasm32)
            (🌐 wasm64)
        )🌱 RISCV(
            (🌱 riscv32)
            (🌱 riscv64)
        )⚑ POWERPC(
            (⚑ ppc)
            (⚑ ppc64)
            (⚑ ppc64le)
        )πŸ‰ LOONGARCH(
            (πŸ‰ loongarch64)
        )🏒 IBM_MAINFRAME(
            (🏒 s390x)
        )β˜€οΈ ANY_SPARC(
            (β˜€οΈ sparc)
            (β˜€οΈ sparc64)
        )πŸ”§ ANY_MIPS(
            (πŸ”§ mips)
            (πŸ”§ mips64)
            (πŸ”§ mips64el)
            (πŸ”§ mipsel)
        )πŸ“± ANY_ARM(
            (πŸ”‹ aarch64)
            (πŸ“± arm)
            (πŸ“± armv6l)
            (πŸ“± armv7l)
            (πŸ“± armv8l)
        (❓ unknown_architecture)
    

PlatformsΒΆ

All recognized platforms and how they’re grouped:

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

Tip

More groups exist beyond those shown in the diagram, and more utilities are available for each platform. See the platform documentation for details.

CI systemsΒΆ

All recognized CI systems:

        ---
config:
  mindmap:
    padding: 5

---
mindmap
    ((β™Ί all_ci))
        (═ azure_pipelines)
        (⟲ bamboo)
        (πŸͺ buildkite)
        (βͺΎ circle_ci)
        (≋ cirrus_ci)
        (αš™ codebuild)
        (πŸ™ github_ci)
        (🦊 gitlab_ci)
        (β₯ heroku_ci)
        (πŸ™οΈ teamcity)
        (πŸ‘· travis_ci)
        (β™² unknown_ci)
    

Used inΒΆ

Check these projects to get real-life examples of extra-platforms usage:

Feel free to send a PR to add your project in this list if you are relying on Extra Platforms in any way.

DevelopmentΒΆ

Development guidelines are the same as parent project Click Extra, from which extra-platforms originated.