extra_platforms packageΒΆ

Expose package-wide elements.

extra_platforms.ALL_OS_LABELS: FrozenSet[str] = frozenset({'ALT Linux', 'Amazon Linux', 'Android', 'Arch Linux', 'Buildroot', 'CentOS', 'CloudLinux OS', 'Cygwin', 'Debian', 'Exherbo Linux', 'Fedora', 'FreeBSD', 'GNU/Hurd', 'Gentoo Linux', 'Guix System', 'IBM AIX', 'IBM PowerKVM', 'KVM for IBM z Systems', 'Linux Mint', 'Mageia', 'Mandriva Linux', 'MidnightBSD', 'NetBSD', 'OpenBSD', 'Oracle Linux', 'Parallels', 'Pidora', 'Raspbian', 'RedHat Enterprise Linux', 'Rocky Linux', 'SUSE Linux Enterprise Server', 'Scientific Linux', 'Slackware', 'Solaris', 'SunOS', 'Tuxedo OS', 'Ubuntu', 'Unknown Linux', 'Windows', 'Windows Subsystem for Linux v1', 'Windows Subsystem for Linux v2', 'XenServer', 'macOS', 'openSUSE'})ΒΆ

Sets of all recognized labels.

extra_platforms.current_os()[source]ΒΆ

Return the current platform.

Return type:

Platform

class extra_platforms.Group(id, name, icon='❓', platforms=<factory>)[source]ΒΆ

Bases: object

A Group identify a collection of Platform.

Used to group platforms of the same family.

set-like methods are available and performed on the platform objects the group contains (in the self.platforms data field).

id: strΒΆ

Unique ID of the group.

name: strΒΆ

User-friendly description of a group.

icon: str = '❓'ΒΆ

Icon of the group.

platforms: tuple[Platform, ...]ΒΆ

Sorted list of platforms that belong to this group.

platform_ids: frozenset[str]ΒΆ

Set of platform IDs that belong to this group.

isdisjoint(other)[source]ΒΆ

Return True if the group has no platforms in common with other.

Groups are disjoint if and only if their intersection is an empty set.

other can be an arbitrarily nested Iterable of Group and Platform.

Return type:

bool

fullyintersects(other)[source]ΒΆ

Return True if the group has all platforms in common with other.

Return type:

bool

issubset(other)[source]ΒΆ

Test whether every platforms in the group is in other.

Return type:

bool

issuperset(other)[source]ΒΆ

Test whether every platform in other is in the group.

Return type:

bool

union(*others)[source]ΒΆ

Return a new Group with platforms from the group and all others.

Return type:

Group

..caution::

The new Group will inherits the metadata of the first one. All other groups’ metadata will be ignored.

intersection(*others)[source]ΒΆ

Return a new Group with platforms common to the group and all others.

Return type:

Group

..caution::

The new Group will inherits the metadata of the first one. All other groups’ metadata will be ignored.

difference(*others)[source]ΒΆ

Return a new Group with platforms in the group that are not in the others.

Return type:

Group

..caution::

The new Group will inherits the metadata of the first one. All other groups’ metadata will be ignored.

symmetric_difference(other)[source]ΒΆ

Return a new Group with platforms in either the group or other but not both.

Return type:

Group

..caution::

The new Group will inherits the metadata of the first one. All other groups’ metadata will be ignored.

copy(id=None, name=None, icon=None, platforms=None)[source]ΒΆ

Return a shallow copy of the group.

Fields can be overridden by passing new values as arguments.

Return type:

Group

extra_platforms.is_aix()[source]ΒΆ

Return True only if current platform is AIX.

Return type:

bool

extra_platforms.is_altlinux()[source]ΒΆ

Return True only if current platform is ALT Linux.

Return type:

bool

extra_platforms.is_amzn()[source]ΒΆ

Return True only if current platform is Amazon Linux.

Return type:

bool

extra_platforms.is_android()[source]ΒΆ

Return True only if current platform is Android.

Source: https://github.com/kivy/kivy/blob/master/kivy/utils.py#L429

Return type:

bool

extra_platforms.is_arch()[source]ΒΆ

Return True only if current platform is Arch Linux.

Return type:

bool

extra_platforms.is_buildroot()[source]ΒΆ

Return True only if current platform is Buildroot.

Return type:

bool

extra_platforms.is_centos()[source]ΒΆ

Return True only if current platform is CentOS.

Return type:

bool

extra_platforms.is_cloudlinux()[source]ΒΆ

Return True only if current platform is CloudLinux OS.

Return type:

bool

extra_platforms.is_cygwin()[source]ΒΆ

Return True only if current platform is Cygwin.

Return type:

bool

extra_platforms.is_debian()[source]ΒΆ

Return True only if current platform is Debian.

Return type:

bool

extra_platforms.is_exherbo()[source]ΒΆ

Return True only if current platform is Exherbo Linux.

Return type:

bool

extra_platforms.is_fedora()[source]ΒΆ

Return True only if current platform is Fedora.

Return type:

bool

extra_platforms.is_freebsd()[source]ΒΆ

Return True only if current platform is FreeBSD.

Return type:

bool

extra_platforms.is_gentoo()[source]ΒΆ

Return True only if current platform is GenToo Linux.

Return type:

bool

extra_platforms.is_guix()[source]ΒΆ

Return True only if current platform is Guix System.

Return type:

bool

extra_platforms.is_hurd()[source]ΒΆ

Return True only if current platform is GNU/Hurd.

Return type:

bool

extra_platforms.is_ibm_powerkvm()[source]ΒΆ

Return True only if current platform is IBM PowerKVM.

Return type:

bool

extra_platforms.is_kvmibm()[source]ΒΆ

Return True only if current platform is KVM for IBM z Systems.

Return type:

bool

extra_platforms.is_linuxmint()[source]ΒΆ

Return True only if current platform is Linux Mint.

Return type:

bool

extra_platforms.is_macos()[source]ΒΆ

Return True only if current platform is macOS.

Return type:

bool

extra_platforms.is_mageia()[source]ΒΆ

Return True only if current platform is Mageia.

Return type:

bool

extra_platforms.is_mandriva()[source]ΒΆ

Return True only if current platform is Mandriva Linux.

Return type:

bool

extra_platforms.is_midnightbsd()[source]ΒΆ

Return True only if current platform is MidnightBSD.

Return type:

bool

extra_platforms.is_netbsd()[source]ΒΆ

Return True only if current platform is NetBSD.

Return type:

bool

extra_platforms.is_openbsd()[source]ΒΆ

Return True only if current platform is OpenBSD.

Return type:

bool

extra_platforms.is_opensuse()[source]ΒΆ

Return True only if current platform is openSUSE.

Return type:

bool

extra_platforms.is_oracle()[source]ΒΆ

Return True only if current platform is Oracle Linux (and Oracle Enterprise Linux).

Return type:

bool

extra_platforms.is_parallels()[source]ΒΆ

Return True only if current platform is Parallels.

Return type:

bool

extra_platforms.is_pidora()[source]ΒΆ

Return True only if current platform is Pidora.

Return type:

bool

extra_platforms.is_raspbian()[source]ΒΆ

Return True only if current platform is Raspbian.

Return type:

bool

extra_platforms.is_rhel()[source]ΒΆ

Return True only if current platform is RedHat Enterprise Linux.

Return type:

bool

extra_platforms.is_rocky()[source]ΒΆ

Return True only if current platform is Rocky Linux.

Return type:

bool

extra_platforms.is_scientific()[source]ΒΆ

Return True only if current platform is Scientific Linux.

Return type:

bool

extra_platforms.is_slackware()[source]ΒΆ

Return True only if current platform is Slackware.

Return type:

bool

extra_platforms.is_sles()[source]ΒΆ

Return True only if current platform is SUSE Linux Enterprise Server.

Return type:

bool

extra_platforms.is_solaris()[source]ΒΆ

Return True only if current platform is Solaris.

Return type:

bool

extra_platforms.is_sunos()[source]ΒΆ

Return True only if current platform is SunOS.

Return type:

bool

extra_platforms.is_tuxedo()[source]ΒΆ

Return True only if current platform is Tuxedo OS.

Return type:

bool

extra_platforms.is_ubuntu()[source]ΒΆ

Return True only if current platform is Ubuntu.

Return type:

bool

extra_platforms.is_unknown_linux()[source]ΒΆ

Return True only if current platform is an unknown Linux.

Excludes WSL1 and WSL2 from this check to avoid false positives.

Return type:

bool

extra_platforms.is_windows()[source]ΒΆ

Return True only if current platform is Windows.

Return type:

bool

extra_platforms.is_wsl1()[source]ΒΆ

Return True only if current platform is Windows Subsystem for Linux v1. :rtype: bool

Caution

The only difference between WSL1 and WSL2 is the case of the kernel release version:

  • WSL 1:

    $ uname -r
    4.4.0-22572-Microsoft
    
  • WSL 2:

    $ uname -r
    5.10.102.1-microsoft-standard-WSL2
    
extra_platforms.is_wsl2()[source]ΒΆ

Return True only if current platform is Windows Subsystem for Linux v2.

Return type:

bool

extra_platforms.is_xenserver()[source]ΒΆ

Return True only if current platform is XenServer.

Return type:

bool

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

Bases: object

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.

id: strΒΆ

Unique ID of the platform.

name: strΒΆ

User-friendly name of the platform.

icon: str = '❓'ΒΆ

Icon of the platform.

current: boolΒΆ

True if current environment runs on this platform.

info()[source]ΒΆ

Returns all platform attributes we can gather.

Return type:

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

extra_platforms.reduce(items, target_pool=None)[source]ΒΆ

Reduce a collection of platforms to a minimal set.

Returns a deduplicated set of Group and Platform that covers the same exact platforms as the original input, but group as much platforms as possible, to reduce the number of items.

Only the groups defined in the target_pool are considered for the reduction. If no reference pool is provided, use all known groups. :rtype: frozenset[Group | Platform]

Hint

Maybe this could be solved with some Euler diagram algorithms, like those implemented in eule.

This is being discussed upstream at trouchet/eule#120.

Todo

Should we rename or alias this method to collapse()? Cannot decide if it is more descriptive or not…

SubmodulesΒΆ

extra_platforms.detection moduleΒΆ

Heuristics to detect each platform.

All these heuristics can be hard-cached as the underlying system is not changing between code execution.

We mostly rely on distro to detect the Linux distribution, as it is the recommended replacement for Python’s original platform.linux_distribution function (which was removed in Python 3.8).

We then fill in the gaps with sys.platform and environment variables to detect systems not covered by distro.

This collection of heuristics is designed as a set of separate function with minimal logic and dependencies. That way we can double-check during execution that no heuristics are conflicting or matching multiple systems at the same time.

Note

Heuristics for unrecognized platforms can be transplanted from Rust’s sysinfo crate.

extra_platforms.detection.is_aix()[source]ΒΆ

Return True only if current platform is AIX.

Return type:

bool

extra_platforms.detection.is_altlinux()[source]ΒΆ

Return True only if current platform is ALT Linux.

Return type:

bool

extra_platforms.detection.is_amzn()[source]ΒΆ

Return True only if current platform is Amazon Linux.

Return type:

bool

extra_platforms.detection.is_android()[source]ΒΆ

Return True only if current platform is Android.

Source: https://github.com/kivy/kivy/blob/master/kivy/utils.py#L429

Return type:

bool

extra_platforms.detection.is_arch()[source]ΒΆ

Return True only if current platform is Arch Linux.

Return type:

bool

extra_platforms.detection.is_buildroot()[source]ΒΆ

Return True only if current platform is Buildroot.

Return type:

bool

extra_platforms.detection.is_centos()[source]ΒΆ

Return True only if current platform is CentOS.

Return type:

bool

extra_platforms.detection.is_cloudlinux()[source]ΒΆ

Return True only if current platform is CloudLinux OS.

Return type:

bool

extra_platforms.detection.is_cygwin()[source]ΒΆ

Return True only if current platform is Cygwin.

Return type:

bool

extra_platforms.detection.is_debian()[source]ΒΆ

Return True only if current platform is Debian.

Return type:

bool

extra_platforms.detection.is_exherbo()[source]ΒΆ

Return True only if current platform is Exherbo Linux.

Return type:

bool

extra_platforms.detection.is_fedora()[source]ΒΆ

Return True only if current platform is Fedora.

Return type:

bool

extra_platforms.detection.is_freebsd()[source]ΒΆ

Return True only if current platform is FreeBSD.

Return type:

bool

extra_platforms.detection.is_gentoo()[source]ΒΆ

Return True only if current platform is GenToo Linux.

Return type:

bool

extra_platforms.detection.is_guix()[source]ΒΆ

Return True only if current platform is Guix System.

Return type:

bool

extra_platforms.detection.is_hurd()[source]ΒΆ

Return True only if current platform is GNU/Hurd.

Return type:

bool

extra_platforms.detection.is_ibm_powerkvm()[source]ΒΆ

Return True only if current platform is IBM PowerKVM.

Return type:

bool

extra_platforms.detection.is_kvmibm()[source]ΒΆ

Return True only if current platform is KVM for IBM z Systems.

Return type:

bool

extra_platforms.detection.is_linuxmint()[source]ΒΆ

Return True only if current platform is Linux Mint.

Return type:

bool

extra_platforms.detection.is_macos()[source]ΒΆ

Return True only if current platform is macOS.

Return type:

bool

extra_platforms.detection.is_mageia()[source]ΒΆ

Return True only if current platform is Mageia.

Return type:

bool

extra_platforms.detection.is_mandriva()[source]ΒΆ

Return True only if current platform is Mandriva Linux.

Return type:

bool

extra_platforms.detection.is_midnightbsd()[source]ΒΆ

Return True only if current platform is MidnightBSD.

Return type:

bool

extra_platforms.detection.is_netbsd()[source]ΒΆ

Return True only if current platform is NetBSD.

Return type:

bool

extra_platforms.detection.is_openbsd()[source]ΒΆ

Return True only if current platform is OpenBSD.

Return type:

bool

extra_platforms.detection.is_opensuse()[source]ΒΆ

Return True only if current platform is openSUSE.

Return type:

bool

extra_platforms.detection.is_oracle()[source]ΒΆ

Return True only if current platform is Oracle Linux (and Oracle Enterprise Linux).

Return type:

bool

extra_platforms.detection.is_parallels()[source]ΒΆ

Return True only if current platform is Parallels.

Return type:

bool

extra_platforms.detection.is_pidora()[source]ΒΆ

Return True only if current platform is Pidora.

Return type:

bool

extra_platforms.detection.is_raspbian()[source]ΒΆ

Return True only if current platform is Raspbian.

Return type:

bool

extra_platforms.detection.is_rhel()[source]ΒΆ

Return True only if current platform is RedHat Enterprise Linux.

Return type:

bool

extra_platforms.detection.is_rocky()[source]ΒΆ

Return True only if current platform is Rocky Linux.

Return type:

bool

extra_platforms.detection.is_scientific()[source]ΒΆ

Return True only if current platform is Scientific Linux.

Return type:

bool

extra_platforms.detection.is_slackware()[source]ΒΆ

Return True only if current platform is Slackware.

Return type:

bool

extra_platforms.detection.is_sles()[source]ΒΆ

Return True only if current platform is SUSE Linux Enterprise Server.

Return type:

bool

extra_platforms.detection.is_solaris()[source]ΒΆ

Return True only if current platform is Solaris.

Return type:

bool

extra_platforms.detection.is_sunos()[source]ΒΆ

Return True only if current platform is SunOS.

Return type:

bool

extra_platforms.detection.is_tuxedo()[source]ΒΆ

Return True only if current platform is Tuxedo OS.

Return type:

bool

extra_platforms.detection.is_ubuntu()[source]ΒΆ

Return True only if current platform is Ubuntu.

Return type:

bool

extra_platforms.detection.is_unknown_linux()[source]ΒΆ

Return True only if current platform is an unknown Linux.

Excludes WSL1 and WSL2 from this check to avoid false positives.

Return type:

bool

extra_platforms.detection.is_windows()[source]ΒΆ

Return True only if current platform is Windows.

Return type:

bool

extra_platforms.detection.is_wsl1()[source]ΒΆ

Return True only if current platform is Windows Subsystem for Linux v1. :rtype: bool

Caution

The only difference between WSL1 and WSL2 is the case of the kernel release version:

  • WSL 1:

    $ uname -r
    4.4.0-22572-Microsoft
    
  • WSL 2:

    $ uname -r
    5.10.102.1-microsoft-standard-WSL2
    
extra_platforms.detection.is_wsl2()[source]ΒΆ

Return True only if current platform is Windows Subsystem for Linux v2.

Return type:

bool

extra_platforms.detection.is_xenserver()[source]ΒΆ

Return True only if current platform is XenServer.

Return type:

bool

extra_platforms.docs_update moduleΒΆ

Automation to keep extra-platforms documentation up-to-date.

Tip

When the module is called directly, it will update all documentation files in-place:

$ run python -m extra_platforms.docs_update

See how it is used in .github/workflows/docs.yaml workflow.

extra_platforms.docs_update.replace_content(filepath, start_tag, end_tag, new_content)[source]ΒΆ

Replace in the provided file the content surrounded by the provided tags.

Return type:

None

extra_platforms.docs_update.generate_platform_sankey()[source]ΒΆ

Produce a Sankey diagram to map all platforms to their platforms.

Return type:

str

extra_platforms.docs_update.generate_platforms_graph(graph_id, description, groups)[source]ΒΆ

Generates an Euler diagram of platform and their grouping.

Euler diagrams are not supported by mermaid yet so we fallback on a flowchart without arrows.

Returns a ready to use and properly indented MyST block.

Return type:

str

extra_platforms.docs_update.update_docs()[source]ΒΆ

Update documentation with dynamic content.

Return type:

None

extra_platforms.group moduleΒΆ

Group models collection of platforms. Also referred as families or categories.

class extra_platforms.group.Group(id, name, icon='❓', platforms=<factory>)[source]ΒΆ

Bases: object

A Group identify a collection of Platform.

Used to group platforms of the same family.

set-like methods are available and performed on the platform objects the group contains (in the self.platforms data field).

id: strΒΆ

Unique ID of the group.

name: strΒΆ

User-friendly description of a group.

icon: str = '❓'ΒΆ

Icon of the group.

platforms: tuple[Platform, ...]ΒΆ

Sorted list of platforms that belong to this group.

platform_ids: frozenset[str]ΒΆ

Set of platform IDs that belong to this group.

isdisjoint(other)[source]ΒΆ

Return True if the group has no platforms in common with other.

Groups are disjoint if and only if their intersection is an empty set.

other can be an arbitrarily nested Iterable of Group and Platform.

Return type:

bool

fullyintersects(other)[source]ΒΆ

Return True if the group has all platforms in common with other.

Return type:

bool

issubset(other)[source]ΒΆ

Test whether every platforms in the group is in other.

Return type:

bool

issuperset(other)[source]ΒΆ

Test whether every platform in other is in the group.

Return type:

bool

union(*others)[source]ΒΆ

Return a new Group with platforms from the group and all others.

Return type:

Group

..caution::

The new Group will inherits the metadata of the first one. All other groups’ metadata will be ignored.

intersection(*others)[source]ΒΆ

Return a new Group with platforms common to the group and all others.

Return type:

Group

..caution::

The new Group will inherits the metadata of the first one. All other groups’ metadata will be ignored.

difference(*others)[source]ΒΆ

Return a new Group with platforms in the group that are not in the others.

Return type:

Group

..caution::

The new Group will inherits the metadata of the first one. All other groups’ metadata will be ignored.

symmetric_difference(other)[source]ΒΆ

Return a new Group with platforms in either the group or other but not both.

Return type:

Group

..caution::

The new Group will inherits the metadata of the first one. All other groups’ metadata will be ignored.

copy(id=None, name=None, icon=None, platforms=None)[source]ΒΆ

Return a shallow copy of the group.

Fields can be overridden by passing new values as arguments.

Return type:

Group

extra_platforms.group.reduce(items, target_pool=None)[source]ΒΆ

Reduce a collection of platforms to a minimal set.

Returns a deduplicated set of Group and Platform that covers the same exact platforms as the original input, but group as much platforms as possible, to reduce the number of items.

Only the groups defined in the target_pool are considered for the reduction. If no reference pool is provided, use all known groups. :rtype: frozenset[Group | Platform]

Hint

Maybe this could be solved with some Euler diagram algorithms, like those implemented in eule.

This is being discussed upstream at trouchet/eule#120.

Todo

Should we rename or alias this method to collapse()? Cannot decide if it is more descriptive or not…

extra_platforms.group_data moduleΒΆ

Definitions of ready-to-use groups.

extra_platforms.group_data.ALL_PLATFORMS: Group = Group(id='all_platforms', name='All platforms', platform_ids=frozenset({'solaris', 'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'macos', 'mandriva', 'hurd', 'oracle', 'raspbian', 'mageia', 'scientific', 'kvmibm', 'ubuntu', 'tuxedo', 'pidora', 'aix', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'sunos', 'windows', 'guix', 'wsl2', 'gentoo', 'cygwin', 'centos', 'openbsd', 'fedora', 'midnightbsd', 'slackware', 'android', 'freebsd', 'netbsd', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'}))ΒΆ

All recognized platforms.

extra_platforms.group_data.ANY_WINDOWS = Group(id='any_windows', name='Any Windows', platform_ids=frozenset({'windows'}))ΒΆ

All Windows operating systems.

extra_platforms.group_data.UNIX = Group(id='unix', name='Any Unix', platform_ids=frozenset({'solaris', 'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'macos', 'mandriva', 'hurd', 'oracle', 'raspbian', 'mageia', 'scientific', 'kvmibm', 'ubuntu', 'tuxedo', 'pidora', 'aix', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'sunos', 'guix', 'wsl2', 'gentoo', 'cygwin', 'centos', 'openbsd', 'fedora', 'midnightbsd', 'slackware', 'android', 'freebsd', 'netbsd', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'}))ΒΆ

All Unix-like operating systems and compatibility layers.

extra_platforms.group_data.UNIX_WITHOUT_MACOS = Group(id='unix_without_macos', name='Any Unix but macOS', platform_ids=frozenset({'solaris', 'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'mandriva', 'hurd', 'oracle', 'raspbian', 'mageia', 'scientific', 'kvmibm', 'ubuntu', 'tuxedo', 'pidora', 'aix', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'sunos', 'guix', 'wsl2', 'gentoo', 'cygwin', 'centos', 'openbsd', 'fedora', 'midnightbsd', 'slackware', 'android', 'freebsd', 'netbsd', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'}))ΒΆ

All Unix platforms, without macOS.

This is useful to avoid macOS-specific workarounds on Unix platforms.

extra_platforms.group_data.BSD = Group(id='bsd', name='Any BSD', platform_ids=frozenset({'freebsd', 'netbsd', 'openbsd', 'sunos', 'midnightbsd', 'macos'}))ΒΆ

All BSD platforms.

Note

Are considered of this family (according Wikipedia):

  • 386BSD (FreeBSD, NetBSD, OpenBSD, DragonFly BSD)

  • NeXTSTEP

  • Darwin (macOS, iOS, audioOS, iPadOS, tvOS, watchOS, bridgeOS)

  • SunOS

  • Ultrix

extra_platforms.group_data.BSD_WITHOUT_MACOS = Group(id='bsd_without_macos', name='Any BSD but macOS', platform_ids=frozenset({'freebsd', 'netbsd', 'openbsd', 'midnightbsd', 'sunos'}))ΒΆ

All BSD platforms, without macOS.

This is useful to avoid macOS-specific workarounds on BSD platforms.

extra_platforms.group_data.LINUX = Group(id='linux', name='Any Linux distribution', platform_ids=frozenset({'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'mandriva', 'raspbian', 'oracle', 'scientific', 'mageia', 'ubuntu', 'kvmibm', 'tuxedo', 'pidora', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'guix', 'gentoo', 'centos', 'fedora', 'slackware', 'android', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'debian', 'xenserver'}))ΒΆ

All distributions based on a Linux kernel.

Note

Are considered of this family (according Wikipedia):

  • Android

  • ChromeOS

  • any other distribution

extra_platforms.group_data.LINUX_LAYERS = Group(id='linux_layers', name='Any Linux compatibility layers', platform_ids=frozenset({'wsl1', 'wsl2'}))ΒΆ

Interfaces that allows Linux binaries to run on a different host system.

Note

Are considered of this family (according Wikipedia):

  • Windows Subsystem for Linux

extra_platforms.group_data.LINUX_LIKE = Group(id='linux_like', name='Any Linux and compatibility layers', platform_ids=frozenset({'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'mandriva', 'raspbian', 'oracle', 'scientific', 'mageia', 'ubuntu', 'kvmibm', 'tuxedo', 'pidora', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'guix', 'wsl2', 'gentoo', 'centos', 'fedora', 'slackware', 'android', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'}))ΒΆ

Sum of all Linux distributions and Linux compatibility layers.

extra_platforms.group_data.SYSTEM_V = Group(id='system_v', name='Any Unix derived from AT&T System Five', platform_ids=frozenset({'solaris', 'aix'}))ΒΆ

All Unix platforms derived from AT&T System Five.

Note

Are considered of this family (according Wikipedia):

  • A/UX

  • AIX

  • HP-UX

  • IRIX

  • OpenServer

  • Solaris

  • OpenSolaris

  • Illumos

  • Tru64

  • UNIX

  • UnixWare

extra_platforms.group_data.UNIX_LAYERS = Group(id='unix_layers', name='Any Unix compatibility layers', platform_ids=frozenset({'cygwin'}))ΒΆ

Interfaces that allows Unix binaries to run on a different host system.

Note

Are considered of this family (according Wikipedia):

  • Cygwin

  • Darling

  • Eunice

  • GNV

  • Interix

  • MachTen

  • Microsoft POSIX subsystem

  • MKS Toolkit

  • PASE

  • P.I.P.S.

  • PWS/VSE-AF

  • UNIX System Services

  • UserLAnd Technologies

  • Windows Services for UNIX

extra_platforms.group_data.OTHER_UNIX = Group(id='other_unix', name='Any other Unix', platform_ids=frozenset({'hurd'}))ΒΆ

All other Unix platforms.

Note

Are considered of this family (according Wikipedia):

  • Coherent

  • GNU/Hurd

  • HarmonyOS

  • LiteOS

  • LynxOS

  • Minix

  • MOS

  • OSF/1

  • QNX

  • BlackBerry 10

  • Research Unix

  • SerenityOS

extra_platforms.group_data.NON_OVERLAPPING_GROUPS: frozenset[Group] = frozenset({Group(id='system_v', name='Any Unix derived from AT&T System Five', platform_ids=frozenset({'solaris', 'aix'})), Group(id='other_unix', name='Any other Unix', platform_ids=frozenset({'hurd'})), Group(id='linux_layers', name='Any Linux compatibility layers', platform_ids=frozenset({'wsl1', 'wsl2'})), Group(id='any_windows', name='Any Windows', platform_ids=frozenset({'windows'})), Group(id='bsd', name='Any BSD', platform_ids=frozenset({'freebsd', 'netbsd', 'openbsd', 'sunos', 'midnightbsd', 'macos'})), Group(id='linux', name='Any Linux distribution', platform_ids=frozenset({'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'mandriva', 'raspbian', 'oracle', 'scientific', 'mageia', 'ubuntu', 'kvmibm', 'tuxedo', 'pidora', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'guix', 'gentoo', 'centos', 'fedora', 'slackware', 'android', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'debian', 'xenserver'})), Group(id='unix_layers', name='Any Unix compatibility layers', platform_ids=frozenset({'cygwin'}))})ΒΆ

Non-overlapping groups.

extra_platforms.group_data.EXTRA_GROUPS: frozenset[Group] = frozenset({Group(id='bsd_without_macos', name='Any BSD but macOS', platform_ids=frozenset({'freebsd', 'netbsd', 'openbsd', 'midnightbsd', 'sunos'})), Group(id='linux_like', name='Any Linux and compatibility layers', platform_ids=frozenset({'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'mandriva', 'raspbian', 'oracle', 'scientific', 'mageia', 'ubuntu', 'kvmibm', 'tuxedo', 'pidora', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'guix', 'wsl2', 'gentoo', 'centos', 'fedora', 'slackware', 'android', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'})), Group(id='unix_without_macos', name='Any Unix but macOS', platform_ids=frozenset({'solaris', 'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'mandriva', 'hurd', 'oracle', 'raspbian', 'mageia', 'scientific', 'kvmibm', 'ubuntu', 'tuxedo', 'pidora', 'aix', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'sunos', 'guix', 'wsl2', 'gentoo', 'cygwin', 'centos', 'openbsd', 'fedora', 'midnightbsd', 'slackware', 'android', 'freebsd', 'netbsd', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'})), Group(id='unix', name='Any Unix', platform_ids=frozenset({'solaris', 'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'macos', 'mandriva', 'hurd', 'oracle', 'raspbian', 'mageia', 'scientific', 'kvmibm', 'ubuntu', 'tuxedo', 'pidora', 'aix', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'sunos', 'guix', 'wsl2', 'gentoo', 'cygwin', 'centos', 'openbsd', 'fedora', 'midnightbsd', 'slackware', 'android', 'freebsd', 'netbsd', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'})), Group(id='all_platforms', name='All platforms', platform_ids=frozenset({'solaris', 'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'macos', 'mandriva', 'hurd', 'oracle', 'raspbian', 'mageia', 'scientific', 'kvmibm', 'ubuntu', 'tuxedo', 'pidora', 'aix', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'sunos', 'windows', 'guix', 'wsl2', 'gentoo', 'cygwin', 'centos', 'openbsd', 'fedora', 'midnightbsd', 'slackware', 'android', 'freebsd', 'netbsd', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'}))})ΒΆ

Overlapping groups, defined for convenience.

extra_platforms.group_data.ALL_GROUPS: frozenset[Group] = frozenset({Group(id='linux_like', name='Any Linux and compatibility layers', platform_ids=frozenset({'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'mandriva', 'raspbian', 'oracle', 'scientific', 'mageia', 'ubuntu', 'kvmibm', 'tuxedo', 'pidora', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'guix', 'wsl2', 'gentoo', 'centos', 'fedora', 'slackware', 'android', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'})), Group(id='system_v', name='Any Unix derived from AT&T System Five', platform_ids=frozenset({'solaris', 'aix'})), Group(id='other_unix', name='Any other Unix', platform_ids=frozenset({'hurd'})), Group(id='linux_layers', name='Any Linux compatibility layers', platform_ids=frozenset({'wsl1', 'wsl2'})), Group(id='any_windows', name='Any Windows', platform_ids=frozenset({'windows'})), Group(id='bsd_without_macos', name='Any BSD but macOS', platform_ids=frozenset({'freebsd', 'netbsd', 'openbsd', 'midnightbsd', 'sunos'})), Group(id='bsd', name='Any BSD', platform_ids=frozenset({'freebsd', 'netbsd', 'openbsd', 'sunos', 'midnightbsd', 'macos'})), Group(id='linux', name='Any Linux distribution', platform_ids=frozenset({'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'mandriva', 'raspbian', 'oracle', 'scientific', 'mageia', 'ubuntu', 'kvmibm', 'tuxedo', 'pidora', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'guix', 'gentoo', 'centos', 'fedora', 'slackware', 'android', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'debian', 'xenserver'})), Group(id='unix_layers', name='Any Unix compatibility layers', platform_ids=frozenset({'cygwin'})), Group(id='unix_without_macos', name='Any Unix but macOS', platform_ids=frozenset({'solaris', 'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'mandriva', 'hurd', 'oracle', 'raspbian', 'mageia', 'scientific', 'kvmibm', 'ubuntu', 'tuxedo', 'pidora', 'aix', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'sunos', 'guix', 'wsl2', 'gentoo', 'cygwin', 'centos', 'openbsd', 'fedora', 'midnightbsd', 'slackware', 'android', 'freebsd', 'netbsd', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'})), Group(id='unix', name='Any Unix', platform_ids=frozenset({'solaris', 'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'macos', 'mandriva', 'hurd', 'oracle', 'raspbian', 'mageia', 'scientific', 'kvmibm', 'ubuntu', 'tuxedo', 'pidora', 'aix', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'sunos', 'guix', 'wsl2', 'gentoo', 'cygwin', 'centos', 'openbsd', 'fedora', 'midnightbsd', 'slackware', 'android', 'freebsd', 'netbsd', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'})), Group(id='all_platforms', name='All platforms', platform_ids=frozenset({'solaris', 'unknown_linux', 'rhel', 'sles', 'arch', 'altlinux', 'opensuse', 'rocky', 'macos', 'mandriva', 'hurd', 'oracle', 'raspbian', 'mageia', 'scientific', 'kvmibm', 'ubuntu', 'tuxedo', 'pidora', 'aix', 'parallels', 'ibm_powerkvm', 'cloudlinux', 'sunos', 'windows', 'guix', 'wsl2', 'gentoo', 'cygwin', 'centos', 'openbsd', 'fedora', 'midnightbsd', 'slackware', 'android', 'freebsd', 'netbsd', 'buildroot', 'exherbo', 'linuxmint', 'amzn', 'wsl1', 'debian', 'xenserver'}))})ΒΆ

All groups.

extra_platforms.platform moduleΒΆ

Platforms, also known as Operating Systems.

Everything here can be aggressively cached and frozen, as it’s only compute platform-dependent values.

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

Bases: object

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.

id: strΒΆ

Unique ID of the platform.

name: strΒΆ

User-friendly name of the platform.

icon: str = '❓'ΒΆ

Icon of the platform.

current: boolΒΆ

True if current environment runs on this platform.

info()[source]ΒΆ

Returns all platform attributes we can gather.

Return type:

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

extra_platforms.platform_data moduleΒΆ

Platform definitions and metadata.

extra_platforms.platform_data.XENSERVER = Platform(id='xenserver', name='XenServer', current=False)ΒΆ

All individual platforms.

extra_platforms.pytest moduleΒΆ

Pytest decorators to skip tests depending on the platform they’re run on.

extra_platforms.pytest.skip_linux(*args, **kwargs) = MarkDecorator(mark=Mark(name='skipif', args=(True,), kwargs={'reason': 'Skip Linux'}))ΒΆ

Pytest mark to skip a test if run on a Linux system.

extra_platforms.pytest.skip_macos(*args, **kwargs) = MarkDecorator(mark=Mark(name='skipif', args=(False,), kwargs={'reason': 'Skip macOS'}))ΒΆ

Pytest mark to skip a test if run on a macOS system.

extra_platforms.pytest.skip_windows(*args, **kwargs) = MarkDecorator(mark=Mark(name='skipif', args=(False,), kwargs={'reason': 'Skip Windows'}))ΒΆ

Pytest mark to skip a test if run on a Windows system.

extra_platforms.pytest.unless_linux(*args, **kwargs) = MarkDecorator(mark=Mark(name='skipif', args=(False,), kwargs={'reason': 'Linux required'}))ΒΆ

Pytest mark to skip a test unless it is run on a Linux system.

extra_platforms.pytest.unless_macos(*args, **kwargs) = MarkDecorator(mark=Mark(name='skipif', args=(True,), kwargs={'reason': 'macOS required'}))ΒΆ

Pytest mark to skip a test unless it is run on a macOS system.

extra_platforms.pytest.unless_windows(*args, **kwargs) = MarkDecorator(mark=Mark(name='skipif', args=(True,), kwargs={'reason': 'Windows required'}))ΒΆ

Pytest mark to skip a test unless it is run on a Windows system.