extra_platforms packageΒΆ
Expose package-wide elements.
- extra_platforms.current_os()[source]ΒΆ
Always returns the best matching platform for the current environment, excluding CI systems.
If multiple platforms match the current environment, this function will try to select the best, informative one.
Raises an error if we canβt decide on a single, appropriate platform.
- Return type:
- extra_platforms.current_platforms()[source]ΒΆ
Evaluates all heuristics and returns a list of
Platformmatching the current environment.Always raises an error if the current environment is not recognized.
Attention
At this point it is too late to worry about caching. This function has no choice but to evaluate all platforms detection heuristics.
- class extra_platforms.Group(id, name, icon='β', platforms=<factory>)[source]ΒΆ
Bases:
objectA
Groupidentify a collection ofPlatform.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.platformsdata field).Todo
Replace the
platforms/platform_idscombo fields with a singleplatformsfield that is a simple dict of platform ID to platform object. But maybe that going to be too much of a hassle because adictcannot be frozen.- 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:
- difference(*others)[source]ΒΆ
Return a new
Groupwith platforms in the group that are not in the others.Caution
The new
Groupwill inherits the metadata of the first one. All other groupsβ metadata will be ignored.- Return type:
- fullyintersects(other)[source]ΒΆ
Return True if the group has all platforms in common with
other.- Return type:
- intersection(*others)[source]ΒΆ
Return a new
Groupwith platforms common to the group and all others.Caution
The new
Groupwill inherits the metadata of the first one. All other groupsβ metadata will be ignored.- Return type:
- 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.
othercan be an arbitrarily nestedIterableofGroupandPlatform.- Return type:
- property short_desc: strΒΆ
Returns the group name with its first letter in lowercase to be used as a short description.
Mainly used to produce docstrings for function dynamically generated for each group.
- symmetric_difference(other)[source]ΒΆ
Return a new
Groupwith platforms in either the group or other but not both.Caution
The new
Groupwill inherits the metadata of the first one. All other groupsβ metadata will be ignored.- Return type:
- extra_platforms.groups_from_ids(*group_ids)[source]ΒΆ
Returns a deduplicated tuple of groups matching the provided IDs.
IDs are case-insensitive.
Order of the returned groups matches the order of the provided IDs.
Tip
If you want to reduce the returned set and removes as much overlaps as possible, you can use the
extra_platforms.reduce()function on the results.
- extra_platforms.invalidate_caches()[source]ΒΆ
Invalidate all cached properties.
Inspired by the new platform.invalidate_caches() from Python 3.14, which is also called here when available.
- extra_platforms.is_all_platforms()ΒΆ
Returns
Trueif the current platform is part of the group composed of all platforms,Falseotherwise.- Return type:
- extra_platforms.is_all_platforms_without_ci()ΒΆ
Returns
Trueif the current platform is part of the group composed of any platforms excluding CI systems,Falseotherwise.- Return type:
- extra_platforms.is_android()[source]ΒΆ
Return
Trueif current platform is Android.Source: https://github.com/kivy/kivy/blob/master/kivy/utils.py#L429
- Return type:
- extra_platforms.is_any_windows()ΒΆ
Returns
Trueif the current platform is part of the group composed of any Windows,Falseotherwise.- Return type:
- extra_platforms.is_azure_pipelines()[source]ΒΆ
Return
Trueif current platform is Azure Pipelines.Environment variables reference.
- Return type:
- extra_platforms.is_bamboo()[source]ΒΆ
Return
Trueif current platform is Bamboo.Environment variables reference.
- Return type:
- extra_platforms.is_bsd()ΒΆ
Returns
Trueif the current platform is part of the group composed of any BSD,Falseotherwise.- Return type:
- extra_platforms.is_bsd_without_macos()ΒΆ
Returns
Trueif the current platform is part of the group composed of any BSD excluding macOS,Falseotherwise.- Return type:
- extra_platforms.is_buildkite()[source]ΒΆ
Return
Trueif current platform is Buildkite.Environment variables reference.
- Return type:
- extra_platforms.is_ci()ΒΆ
Returns
Trueif the current platform is part of the group composed of cI systems,Falseotherwise.- Return type:
- extra_platforms.is_circle_ci()[source]ΒΆ
Return
Trueif current platform is Circle CI.Environment variables reference.
- Return type:
- extra_platforms.is_cirrus_ci()[source]ΒΆ
Return
Trueif current platform is Cirrus CI.Environment variables reference.
- Return type:
- extra_platforms.is_cloudlinux()[source]ΒΆ
Return
Trueif current platform is CloudLinux OS.- Return type:
- extra_platforms.is_codebuild()[source]ΒΆ
Return
Trueif current platform is CodeBuild.Environment variables reference.
- Return type:
- extra_platforms.is_exherbo()[source]ΒΆ
Return
Trueif current platform is Exherbo Linux.- Return type:
- extra_platforms.is_github_ci()[source]ΒΆ
Return
Trueif current platform is GitHub Actions runner.Environment variables reference.
- Return type:
- extra_platforms.is_gitlab_ci()[source]ΒΆ
Return
Trueif current platform is GitLab CI.Environment variables reference.
- Return type:
- extra_platforms.is_heroku_ci()[source]ΒΆ
Return
Trueif current platform is Heroku CI.Environment variables reference.
- Return type:
- extra_platforms.is_hurd()[source]ΒΆ
Return
Trueif current platform is GNU/Hurd.sys.platformcan returnsGNUorgnu0, see: https://github.com/kdeldycke/extra-platforms/issues/308- Return type:
- extra_platforms.is_ibm_powerkvm()[source]ΒΆ
Return
Trueif current platform is IBM PowerKVM.- Return type:
- extra_platforms.is_kvmibm()[source]ΒΆ
Return
Trueif current platform is KVM for IBM z Systems.- Return type:
- extra_platforms.is_linux()ΒΆ
Returns
Trueif the current platform is part of the group composed of any Linux distribution,Falseotherwise.- Return type:
- extra_platforms.is_linux_layers()ΒΆ
Returns
Trueif the current platform is part of the group composed of any Linux compatibility layers,Falseotherwise.- Return type:
- extra_platforms.is_linux_like()ΒΆ
Returns
Trueif the current platform is part of the group composed of any Linux and compatibility layers,Falseotherwise.- Return type:
- extra_platforms.is_linuxmint()[source]ΒΆ
Return
Trueif current platform is Linux Mint.- Return type:
- extra_platforms.is_mandriva()[source]ΒΆ
Return
Trueif current platform is Mandriva Linux.- Return type:
- extra_platforms.is_midnightbsd()[source]ΒΆ
Return
Trueif current platform is MidnightBSD.- Return type:
- extra_platforms.is_oracle()[source]ΒΆ
Return
Trueif current platform is Oracle Linux (and Oracle Enterprise Linux).- Return type:
- extra_platforms.is_other_unix()ΒΆ
Returns
Trueif the current platform is part of the group composed of any other Unix,Falseotherwise.- Return type:
- extra_platforms.is_rhel()[source]ΒΆ
Return
Trueif current platform is RedHat Enterprise Linux.- Return type:
- extra_platforms.is_scientific()[source]ΒΆ
Return
Trueif current platform is Scientific Linux.- Return type:
- extra_platforms.is_sles()[source]ΒΆ
Return
Trueif current platform is SUSE Linux Enterprise Server.- Return type:
- extra_platforms.is_system_v()ΒΆ
Returns
Trueif the current platform is part of the group composed of aT&T System Five,Falseotherwise.- Return type:
- extra_platforms.is_teamcity()[source]ΒΆ
Return
Trueif current platform is TeamCity.Environment variables reference.
- Return type:
- extra_platforms.is_travis_ci()[source]ΒΆ
Return
Trueif current platform is Travis CI.Environment variables reference.
- Return type:
- extra_platforms.is_tumbleweed()[source]ΒΆ
Return
Trueif current platform is openSUSE Tumbleweed.- Return type:
- extra_platforms.is_ultramarine()[source]ΒΆ
Return
Trueif current platform is Ultramarine.- Return type:
- extra_platforms.is_unix()ΒΆ
Returns
Trueif the current platform is part of the group composed of any Unix,Falseotherwise.- Return type:
- extra_platforms.is_unix_layers()ΒΆ
Returns
Trueif the current platform is part of the group composed of any Unix compatibility layers,Falseotherwise.- Return type:
- extra_platforms.is_unix_without_macos()ΒΆ
Returns
Trueif the current platform is part of the group composed of any Unix excluding macOS,Falseotherwise.- Return type:
- extra_platforms.is_unknown_ci()[source]ΒΆ
Return
Trueif current platform is an unknown CI.Some CI systems relies on generic environment variables to identify themselves:
CIBUILD_ID
- Return type:
- extra_platforms.is_unknown_linux()[source]ΒΆ
Return
Trueif current platform is an unknown Linux.- Return type:
- extra_platforms.is_wsl1()[source]ΒΆ
Return
Trueif current platform is running over Windows Subsystem for Linux v1.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
- Return type:
- extra_platforms.is_wsl2()[source]ΒΆ
Return
Trueif current platform is running over Windows Subsystem for Linux v2.- Return type:
- class extra_platforms.Platform(id, name, icon='β', url='')[source]ΒΆ
Bases:
objectA 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.
- property current: boolΒΆ
Returns whether the current platform is this one.
This is a property to avoid calling all platform detection heuristics on
Platformobjects creation, which happens at module import time.
- extra_platforms.platforms_from_ids(*platform_and_group_ids)[source]ΒΆ
Returns a deduplicated tuple of platforms matching the provided IDs.
IDs are case-insensitive, and can refer to any platforms or groups. Matching groups will be expanded to the platforms they contain.
Order of the returned platforms matches the order of the provided IDs.
Tip
If you want to reduce the returned set and removes as much overlaps as possible, you can use the
extra_platforms.reduce()function on the results.
- extra_platforms.reduce(items, target_pool=None)[source]ΒΆ
Reduce a collection of platforms to a minimal set.
Returns a deduplicated set of
GroupandPlatformthat 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_poolare considered for the reduction. If no reference pool is provided, use all known groups.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 platforms.
This collection of heuristics is designed as a set of separate function with minimal logic and dependencies.
All these heuristics can be hard-cached as the underlying system is not changing between code execution. They are still allowed to depends on each others, as long as youβre careful of not implementing circular dependencies.
Warning
Even if highly unlikely, it is possible to have multiple platforms detected for the same environment.
Typical example is Ubuntu WSL, which
will make both the is_wsl2() and is_ubuntu() functions return True at
the same time.
Thatβs because of the environment metadata, where:
$ uname -a
Linux 5.15.167.4-microsoft-standard-WSL2
$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.5 LTS"
That way we have the possibility elsewhere in extra-platforms to either decide
if we only allow one, and only one, heuristic to match the current system, or allow
for considering multiple systems at the same time.
Detection of Linux distribution rely on distro to gather as much details as possible.
And also because it is the recommended replacement for Pythonβs original
platform.linux_distribution function (which was removed in Python 3.8).
For all other platforms, we either rely on:
environment variables
- extra_platforms.detection.is_altlinux()[source]ΒΆ
Return
Trueif current platform is ALT Linux.- Return type:
- extra_platforms.detection.is_amzn()[source]ΒΆ
Return
Trueif current platform is Amazon Linux.- Return type:
- extra_platforms.detection.is_android()[source]ΒΆ
Return
Trueif current platform is Android.Source: https://github.com/kivy/kivy/blob/master/kivy/utils.py#L429
- Return type:
- extra_platforms.detection.is_arch()[source]ΒΆ
Return
Trueif current platform is Arch Linux.- Return type:
- extra_platforms.detection.is_azure_pipelines()[source]ΒΆ
Return
Trueif current platform is Azure Pipelines.Environment variables reference.
- Return type:
- extra_platforms.detection.is_bamboo()[source]ΒΆ
Return
Trueif current platform is Bamboo.Environment variables reference.
- Return type:
- extra_platforms.detection.is_buildkite()[source]ΒΆ
Return
Trueif current platform is Buildkite.Environment variables reference.
- Return type:
- extra_platforms.detection.is_buildroot()[source]ΒΆ
Return
Trueif current platform is Buildroot.- Return type:
- extra_platforms.detection.is_centos()[source]ΒΆ
Return
Trueif current platform is CentOS.- Return type:
- extra_platforms.detection.is_circle_ci()[source]ΒΆ
Return
Trueif current platform is Circle CI.Environment variables reference.
- Return type:
- extra_platforms.detection.is_cirrus_ci()[source]ΒΆ
Return
Trueif current platform is Cirrus CI.Environment variables reference.
- Return type:
- extra_platforms.detection.is_cloudlinux()[source]ΒΆ
Return
Trueif current platform is CloudLinux OS.- Return type:
- extra_platforms.detection.is_codebuild()[source]ΒΆ
Return
Trueif current platform is CodeBuild.Environment variables reference.
- Return type:
- extra_platforms.detection.is_cygwin()[source]ΒΆ
Return
Trueif current platform is Cygwin.- Return type:
- extra_platforms.detection.is_debian()[source]ΒΆ
Return
Trueif current platform is Debian.- Return type:
- extra_platforms.detection.is_exherbo()[source]ΒΆ
Return
Trueif current platform is Exherbo Linux.- Return type:
- extra_platforms.detection.is_fedora()[source]ΒΆ
Return
Trueif current platform is Fedora.- Return type:
- extra_platforms.detection.is_freebsd()[source]ΒΆ
Return
Trueif current platform is FreeBSD.- Return type:
- extra_platforms.detection.is_gentoo()[source]ΒΆ
Return
Trueif current platform is GenToo Linux.- Return type:
- extra_platforms.detection.is_github_ci()[source]ΒΆ
Return
Trueif current platform is GitHub Actions runner.Environment variables reference.
- Return type:
- extra_platforms.detection.is_gitlab_ci()[source]ΒΆ
Return
Trueif current platform is GitLab CI.Environment variables reference.
- Return type:
- extra_platforms.detection.is_guix()[source]ΒΆ
Return
Trueif current platform is Guix System.- Return type:
- extra_platforms.detection.is_heroku_ci()[source]ΒΆ
Return
Trueif current platform is Heroku CI.Environment variables reference.
- Return type:
- extra_platforms.detection.is_hurd()[source]ΒΆ
Return
Trueif current platform is GNU/Hurd.sys.platformcan returnsGNUorgnu0, see: https://github.com/kdeldycke/extra-platforms/issues/308- Return type:
- extra_platforms.detection.is_ibm_powerkvm()[source]ΒΆ
Return
Trueif current platform is IBM PowerKVM.- Return type:
- extra_platforms.detection.is_kvmibm()[source]ΒΆ
Return
Trueif current platform is KVM for IBM z Systems.- Return type:
- extra_platforms.detection.is_linuxmint()[source]ΒΆ
Return
Trueif current platform is Linux Mint.- Return type:
- extra_platforms.detection.is_macos()[source]ΒΆ
Return
Trueif current platform is macOS.- Return type:
- extra_platforms.detection.is_mageia()[source]ΒΆ
Return
Trueif current platform is Mageia.- Return type:
- extra_platforms.detection.is_mandriva()[source]ΒΆ
Return
Trueif current platform is Mandriva Linux.- Return type:
- extra_platforms.detection.is_midnightbsd()[source]ΒΆ
Return
Trueif current platform is MidnightBSD.- Return type:
- extra_platforms.detection.is_netbsd()[source]ΒΆ
Return
Trueif current platform is NetBSD.- Return type:
- extra_platforms.detection.is_nobara()[source]ΒΆ
Return
Trueif current platform is Nobara Linux.- Return type:
- extra_platforms.detection.is_openbsd()[source]ΒΆ
Return
Trueif current platform is OpenBSD.- Return type:
- extra_platforms.detection.is_opensuse()[source]ΒΆ
Return
Trueif current platform is openSUSE.- Return type:
- extra_platforms.detection.is_oracle()[source]ΒΆ
Return
Trueif current platform is Oracle Linux (and Oracle Enterprise Linux).- Return type:
- extra_platforms.detection.is_parallels()[source]ΒΆ
Return
Trueif current platform is Parallels.- Return type:
- extra_platforms.detection.is_pidora()[source]ΒΆ
Return
Trueif current platform is Pidora.- Return type:
- extra_platforms.detection.is_raspbian()[source]ΒΆ
Return
Trueif current platform is Raspbian.- Return type:
- extra_platforms.detection.is_rhel()[source]ΒΆ
Return
Trueif current platform is RedHat Enterprise Linux.- Return type:
- extra_platforms.detection.is_rocky()[source]ΒΆ
Return
Trueif current platform is Rocky Linux.- Return type:
- extra_platforms.detection.is_scientific()[source]ΒΆ
Return
Trueif current platform is Scientific Linux.- Return type:
- extra_platforms.detection.is_slackware()[source]ΒΆ
Return
Trueif current platform is Slackware.- Return type:
- extra_platforms.detection.is_sles()[source]ΒΆ
Return
Trueif current platform is SUSE Linux Enterprise Server.- Return type:
- extra_platforms.detection.is_solaris()[source]ΒΆ
Return
Trueif current platform is Solaris.- Return type:
- extra_platforms.detection.is_sunos()[source]ΒΆ
Return
Trueif current platform is SunOS.- Return type:
- extra_platforms.detection.is_teamcity()[source]ΒΆ
Return
Trueif current platform is TeamCity.Environment variables reference.
- Return type:
- extra_platforms.detection.is_travis_ci()[source]ΒΆ
Return
Trueif current platform is Travis CI.Environment variables reference.
- Return type:
- extra_platforms.detection.is_tumbleweed()[source]ΒΆ
Return
Trueif current platform is openSUSE Tumbleweed.- Return type:
- extra_platforms.detection.is_tuxedo()[source]ΒΆ
Return
Trueif current platform is Tuxedo OS.- Return type:
- extra_platforms.detection.is_ubuntu()[source]ΒΆ
Return
Trueif current platform is Ubuntu.- Return type:
- extra_platforms.detection.is_ultramarine()[source]ΒΆ
Return
Trueif current platform is Ultramarine.- Return type:
- extra_platforms.detection.is_unknown_ci()[source]ΒΆ
Return
Trueif current platform is an unknown CI.Some CI systems relies on generic environment variables to identify themselves:
CIBUILD_ID
- Return type:
- extra_platforms.detection.is_unknown_linux()[source]ΒΆ
Return
Trueif current platform is an unknown Linux.- Return type:
- extra_platforms.detection.is_windows()[source]ΒΆ
Return
Trueif current platform is Windows.- Return type:
- extra_platforms.detection.is_wsl1()[source]ΒΆ
Return
Trueif current platform is running over Windows Subsystem for Linux v1.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
- Return type:
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:
objectA
Groupidentify a collection ofPlatform.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.platformsdata field).Todo
Replace the
platforms/platform_idscombo fields with a singleplatformsfield that is a simple dict of platform ID to platform object. But maybe that going to be too much of a hassle because adictcannot be frozen.- property short_desc: strΒΆ
Returns the group name with its first letter in lowercase to be used as a short description.
Mainly used to produce docstrings for function dynamically generated for each 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.
othercan be an arbitrarily nestedIterableofGroupandPlatform.- Return type:
- fullyintersects(other)[source]ΒΆ
Return True if the group has all platforms in common with
other.- Return type:
- union(*others)[source]ΒΆ
Return a new
Groupwith platforms from the group and all others.Caution
The new
Groupwill inherits the metadata of the first one. All other groupsβ metadata will be ignored.- Return type:
- intersection(*others)[source]ΒΆ
Return a new
Groupwith platforms common to the group and all others.Caution
The new
Groupwill inherits the metadata of the first one. All other groupsβ metadata will be ignored.- Return type:
- difference(*others)[source]ΒΆ
Return a new
Groupwith platforms in the group that are not in the others.Caution
The new
Groupwill inherits the metadata of the first one. All other groupsβ metadata will be ignored.- Return type:
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({'raspbian', 'nobara', 'travis_ci', 'opensuse', 'github_ci', 'wsl1', 'openbsd', 'sunos', 'freebsd', 'macos', 'tuxedo', 'unknown_linux', 'xenserver', 'linuxmint', 'hurd', 'aix', 'mageia', 'windows', 'mandriva', 'arch', 'debian', 'cirrus_ci', 'cygwin', 'parallels', 'fedora', 'ibm_powerkvm', 'midnightbsd', 'circle_ci', 'ultramarine', 'rocky', 'ubuntu', 'cloudlinux', 'oracle', 'scientific', 'unknown_ci', 'centos', 'tumbleweed', 'slackware', 'rhel', 'sles', 'solaris', 'amzn', 'teamcity', 'azure_pipelines', 'heroku_ci', 'pidora', 'buildkite', 'altlinux', 'exherbo', 'kvmibm', 'wsl2', 'buildroot', 'bamboo', 'gentoo', 'gitlab_ci', 'guix', 'android', 'netbsd', 'codebuild'}))ΒΆ
All recognized platforms.
- extra_platforms.group_data.CI = Group(id='ci', name='CI systems', platform_ids=frozenset({'teamcity', 'azure_pipelines', 'circle_ci', 'heroku_ci', 'travis_ci', 'github_ci', 'buildkite', 'unknown_ci', 'bamboo', 'gitlab_ci', 'cirrus_ci', 'codebuild'}))ΒΆ
All Continuous Integration systems.
Note
- extra_platforms.group_data.ALL_PLATFORMS_WITHOUT_CI = Group(id='all_platforms_without_ci', name='Any platforms excluding CI systems', platform_ids=frozenset({'raspbian', 'nobara', 'wsl1', 'opensuse', 'openbsd', 'sunos', 'freebsd', 'macos', 'tuxedo', 'unknown_linux', 'xenserver', 'linuxmint', 'hurd', 'aix', 'mageia', 'windows', 'mandriva', 'arch', 'debian', 'cygwin', 'parallels', 'fedora', 'ibm_powerkvm', 'midnightbsd', 'ultramarine', 'rocky', 'ubuntu', 'cloudlinux', 'scientific', 'centos', 'tumbleweed', 'slackware', 'rhel', 'sles', 'solaris', 'amzn', 'pidora', 'wsl2', 'altlinux', 'exherbo', 'kvmibm', 'buildroot', 'gentoo', 'guix', 'android', 'netbsd', 'oracle'}))ΒΆ
All platforms, without CI systems.
- 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({'raspbian', 'nobara', 'wsl1', 'opensuse', 'openbsd', 'sunos', 'freebsd', 'macos', 'tuxedo', 'unknown_linux', 'xenserver', 'linuxmint', 'hurd', 'aix', 'mageia', 'mandriva', 'arch', 'debian', 'cygwin', 'parallels', 'fedora', 'ibm_powerkvm', 'midnightbsd', 'ultramarine', 'rocky', 'ubuntu', 'cloudlinux', 'scientific', 'centos', 'tumbleweed', 'slackware', 'rhel', 'sles', 'solaris', 'amzn', 'pidora', 'wsl2', 'altlinux', 'exherbo', 'kvmibm', 'buildroot', 'gentoo', 'guix', 'android', 'netbsd', 'oracle'}))ΒΆ
All Unix-like operating systems and compatibility layers.
- extra_platforms.group_data.UNIX_WITHOUT_MACOS = Group(id='unix_without_macos', name='Any Unix excluding macOS', platform_ids=frozenset({'raspbian', 'nobara', 'wsl1', 'opensuse', 'openbsd', 'sunos', 'freebsd', 'tuxedo', 'unknown_linux', 'xenserver', 'linuxmint', 'hurd', 'aix', 'mageia', 'mandriva', 'arch', 'debian', 'cygwin', 'parallels', 'fedora', 'ibm_powerkvm', 'midnightbsd', 'ultramarine', 'rocky', 'ubuntu', 'cloudlinux', 'scientific', 'centos', 'tumbleweed', 'slackware', 'rhel', 'sles', 'solaris', 'amzn', 'pidora', 'wsl2', 'altlinux', 'exherbo', 'kvmibm', 'buildroot', 'gentoo', 'guix', 'android', 'netbsd', 'oracle'}))ΒΆ
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({'midnightbsd', 'sunos', 'openbsd', 'netbsd', 'freebsd', '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 excluding macOS', platform_ids=frozenset({'midnightbsd', 'netbsd', 'openbsd', 'sunos', 'freebsd'}))ΒΆ
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({'raspbian', 'nobara', 'opensuse', 'unknown_linux', 'tuxedo', 'xenserver', 'linuxmint', 'mageia', 'mandriva', 'arch', 'debian', 'parallels', 'fedora', 'ibm_powerkvm', 'ultramarine', 'rocky', 'ubuntu', 'cloudlinux', 'scientific', 'centos', 'tumbleweed', 'slackware', 'rhel', 'sles', 'amzn', 'pidora', 'altlinux', 'exherbo', 'kvmibm', 'buildroot', 'gentoo', 'guix', 'android', 'oracle'}))ΒΆ
All distributions based on a Linux kernel.
- 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.
- extra_platforms.group_data.LINUX_LIKE = Group(id='linux_like', name='Any Linux and compatibility layers', platform_ids=frozenset({'raspbian', 'nobara', 'wsl1', 'opensuse', 'unknown_linux', 'tuxedo', 'xenserver', 'linuxmint', 'mageia', 'mandriva', 'arch', 'debian', 'parallels', 'fedora', 'ibm_powerkvm', 'ultramarine', 'rocky', 'ubuntu', 'cloudlinux', 'scientific', 'centos', 'tumbleweed', 'slackware', 'rhel', 'sles', 'amzn', 'pidora', 'wsl2', 'altlinux', 'exherbo', 'kvmibm', 'buildroot', 'gentoo', 'guix', 'android', 'oracle'}))ΒΆ
Sum of all Linux distributions and Linux compatibility layers.
- extra_platforms.group_data.SYSTEM_V = Group(id='system_v', name='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='any_windows', name='Any Windows', platform_ids=frozenset({'windows'})), Group(id='unix_layers', name='Any Unix compatibility layers', platform_ids=frozenset({'cygwin'})), Group(id='ci', name='CI systems', platform_ids=frozenset({'teamcity', 'azure_pipelines', 'circle_ci', 'heroku_ci', 'travis_ci', 'github_ci', 'buildkite', 'unknown_ci', 'bamboo', 'gitlab_ci', 'cirrus_ci', 'codebuild'})), Group(id='system_v', name='AT&T System Five', platform_ids=frozenset({'solaris', 'aix'})), Group(id='other_unix', name='Any other Unix', platform_ids=frozenset({'hurd'})), Group(id='linux', name='Any Linux distribution', platform_ids=frozenset({'raspbian', 'nobara', 'opensuse', 'unknown_linux', 'tuxedo', 'xenserver', 'linuxmint', 'mageia', 'mandriva', 'arch', 'debian', 'parallels', 'fedora', 'ibm_powerkvm', 'ultramarine', 'rocky', 'ubuntu', 'cloudlinux', 'scientific', 'centos', 'tumbleweed', 'slackware', 'rhel', 'sles', 'amzn', 'pidora', 'altlinux', 'exherbo', 'kvmibm', 'buildroot', 'gentoo', 'guix', 'android', 'oracle'})), Group(id='bsd', name='Any BSD', platform_ids=frozenset({'midnightbsd', 'sunos', 'openbsd', 'netbsd', 'freebsd', 'macos'})), Group(id='linux_layers', name='Any Linux compatibility layers', platform_ids=frozenset({'wsl1', 'wsl2'}))})ΒΆ
Non-overlapping groups.
- extra_platforms.group_data.EXTRA_GROUPS: frozenset[Group] = frozenset({Group(id='bsd_without_macos', name='Any BSD excluding macOS', platform_ids=frozenset({'midnightbsd', 'netbsd', 'openbsd', 'sunos', 'freebsd'})), Group(id='linux_like', name='Any Linux and compatibility layers', platform_ids=frozenset({'raspbian', 'nobara', 'wsl1', 'opensuse', 'unknown_linux', 'tuxedo', 'xenserver', 'linuxmint', 'mageia', 'mandriva', 'arch', 'debian', 'parallels', 'fedora', 'ibm_powerkvm', 'ultramarine', 'rocky', 'ubuntu', 'cloudlinux', 'scientific', 'centos', 'tumbleweed', 'slackware', 'rhel', 'sles', 'amzn', 'pidora', 'wsl2', 'altlinux', 'exherbo', 'kvmibm', 'buildroot', 'gentoo', 'guix', 'android', 'oracle'})), Group(id='unix_without_macos', name='Any Unix excluding macOS', platform_ids=frozenset({'raspbian', 'nobara', 'wsl1', 'opensuse', 'openbsd', 'sunos', 'freebsd', 'tuxedo', 'unknown_linux', 'xenserver', 'linuxmint', 'hurd', 'aix', 'mageia', 'mandriva', 'arch', 'debian', 'cygwin', 'parallels', 'fedora', 'ibm_powerkvm', 'midnightbsd', 'ultramarine', 'rocky', 'ubuntu', 'cloudlinux', 'scientific', 'centos', 'tumbleweed', 'slackware', 'rhel', 'sles', 'solaris', 'amzn', 'pidora', 'wsl2', 'altlinux', 'exherbo', 'kvmibm', 'buildroot', 'gentoo', 'guix', 'android', 'netbsd', 'oracle'})), Group(id='unix', name='Any Unix', platform_ids=frozenset({'raspbian', 'nobara', 'wsl1', 'opensuse', 'openbsd', 'sunos', 'freebsd', 'macos', 'tuxedo', 'unknown_linux', 'xenserver', 'linuxmint', 'hurd', 'aix', 'mageia', 'mandriva', 'arch', 'debian', 'cygwin', 'parallels', 'fedora', 'ibm_powerkvm', 'midnightbsd', 'ultramarine', 'rocky', 'ubuntu', 'cloudlinux', 'scientific', 'centos', 'tumbleweed', 'slackware', 'rhel', 'sles', 'solaris', 'amzn', 'pidora', 'wsl2', 'altlinux', 'exherbo', 'kvmibm', 'buildroot', 'gentoo', 'guix', 'android', 'netbsd', 'oracle'})), Group(id='all_platforms_without_ci', name='Any platforms excluding CI systems', platform_ids=frozenset({'raspbian', 'nobara', 'wsl1', 'opensuse', 'openbsd', 'sunos', 'freebsd', 'macos', 'tuxedo', 'unknown_linux', 'xenserver', 'linuxmint', 'hurd', 'aix', 'mageia', 'windows', 'mandriva', 'arch', 'debian', 'cygwin', 'parallels', 'fedora', 'ibm_powerkvm', 'midnightbsd', 'ultramarine', 'rocky', 'ubuntu', 'cloudlinux', 'scientific', 'centos', 'tumbleweed', 'slackware', 'rhel', 'sles', 'solaris', 'amzn', 'pidora', 'wsl2', 'altlinux', 'exherbo', 'kvmibm', 'buildroot', 'gentoo', 'guix', 'android', 'netbsd', 'oracle'})), Group(id='all_platforms', name='All platforms', platform_ids=frozenset({'raspbian', 'nobara', 'travis_ci', 'opensuse', 'github_ci', 'wsl1', 'openbsd', 'sunos', 'freebsd', 'macos', 'tuxedo', 'unknown_linux', 'xenserver', 'linuxmint', 'hurd', 'aix', 'mageia', 'windows', 'mandriva', 'arch', 'debian', 'cirrus_ci', 'cygwin', 'parallels', 'fedora', 'ibm_powerkvm', 'midnightbsd', 'circle_ci', 'ultramarine', 'rocky', 'ubuntu', 'cloudlinux', 'oracle', 'scientific', 'unknown_ci', 'centos', 'tumbleweed', 'slackware', 'rhel', 'sles', 'solaris', 'amzn', 'teamcity', 'azure_pipelines', 'heroku_ci', 'pidora', 'buildkite', 'altlinux', 'exherbo', 'kvmibm', 'wsl2', 'buildroot', 'bamboo', 'gentoo', 'gitlab_ci', 'guix', 'android', 'netbsd', 'codebuild'}))})ΒΆ
Overlapping groups, defined for convenience.
- extra_platforms.group_data.ALL_GROUPS: frozenset[Group] = frozenset({Group(id='any_windows', name='Any Windows', platform_ids=frozenset({'windows'})), Group(id='unix_layers', name='Any Unix compatibility layers', platform_ids=frozenset({'cygwin'})), Group(id='ci', name='CI systems', platform_ids=frozenset({'teamcity', 'azure_pipelines', 'circle_ci', 'heroku_ci', 'travis_ci', 'github_ci', 'buildkite', 'unknown_ci', 'bamboo', 'gitlab_ci', 'cirrus_ci', 'codebuild'})), Group(id='system_v', name='AT&T System Five', platform_ids=frozenset({'solaris', 'aix'})), Group(id='other_unix', name='Any other Unix', platform_ids=frozenset({'hurd'})), Group(id='bsd_without_macos', name='Any BSD excluding macOS', platform_ids=frozenset({'midnightbsd', 'netbsd', 'openbsd', 'sunos', 'freebsd'})), Group(id='linux', name='Any Linux distribution', platform_ids=frozenset({'raspbian', 'nobara', 'opensuse', 'unknown_linux', 'tuxedo', 'xenserver', 'linuxmint', 'mageia', 'mandriva', 'arch', 'debian', 'parallels', 'fedora', 'ibm_powerkvm', 'ultramarine', 'rocky', 'ubuntu', 'cloudlinux', 'scientific', 'centos', 'tumbleweed', 'slackware', 'rhel', 'sles', 'amzn', 'pidora', 'altlinux', 'exherbo', 'kvmibm', 'buildroot', 'gentoo', 'guix', 'android', 'oracle'})), Group(id='linux_like', name='Any Linux and compatibility layers', platform_ids=frozenset({'raspbian', 'nobara', 'wsl1', 'opensuse', 'unknown_linux', 'tuxedo', 'xenserver', 'linuxmint', 'mageia', 'mandriva', 'arch', 'debian', 'parallels', 'fedora', 'ibm_powerkvm', 'ultramarine', 'rocky', 'ubuntu', 'cloudlinux', 'scientific', 'centos', 'tumbleweed', 'slackware', 'rhel', 'sles', 'amzn', 'pidora', 'wsl2', 'altlinux', 'exherbo', 'kvmibm', 'buildroot', 'gentoo', 'guix', 'android', 'oracle'})), Group(id='bsd', name='Any BSD', platform_ids=frozenset({'midnightbsd', 'sunos', 'openbsd', 'netbsd', 'freebsd', 'macos'})), Group(id='linux_layers', name='Any Linux compatibility layers', platform_ids=frozenset({'wsl1', 'wsl2'})), Group(id='unix_without_macos', name='Any Unix excluding macOS', platform_ids=frozenset({'raspbian', 'nobara', 'wsl1', 'opensuse', 'openbsd', 'sunos', 'freebsd', 'tuxedo', 'unknown_linux', 'xenserver', 'linuxmint', 'hurd', 'aix', 'mageia', 'mandriva', 'arch', 'debian', 'cygwin', 'parallels', 'fedora', 'ibm_powerkvm', 'midnightbsd', 'ultramarine', 'rocky', 'ubuntu', 'cloudlinux', 'scientific', 'centos', 'tumbleweed', 'slackware', 'rhel', 'sles', 'solaris', 'amzn', 'pidora', 'wsl2', 'altlinux', 'exherbo', 'kvmibm', 'buildroot', 'gentoo', 'guix', 'android', 'netbsd', 'oracle'})), Group(id='unix', name='Any Unix', platform_ids=frozenset({'raspbian', 'nobara', 'wsl1', 'opensuse', 'openbsd', 'sunos', 'freebsd', 'macos', 'tuxedo', 'unknown_linux', 'xenserver', 'linuxmint', 'hurd', 'aix', 'mageia', 'mandriva', 'arch', 'debian', 'cygwin', 'parallels', 'fedora', 'ibm_powerkvm', 'midnightbsd', 'ultramarine', 'rocky', 'ubuntu', 'cloudlinux', 'scientific', 'centos', 'tumbleweed', 'slackware', 'rhel', 'sles', 'solaris', 'amzn', 'pidora', 'wsl2', 'altlinux', 'exherbo', 'kvmibm', 'buildroot', 'gentoo', 'guix', 'android', 'netbsd', 'oracle'})), Group(id='all_platforms_without_ci', name='Any platforms excluding CI systems', platform_ids=frozenset({'raspbian', 'nobara', 'wsl1', 'opensuse', 'openbsd', 'sunos', 'freebsd', 'macos', 'tuxedo', 'unknown_linux', 'xenserver', 'linuxmint', 'hurd', 'aix', 'mageia', 'windows', 'mandriva', 'arch', 'debian', 'cygwin', 'parallels', 'fedora', 'ibm_powerkvm', 'midnightbsd', 'ultramarine', 'rocky', 'ubuntu', 'cloudlinux', 'scientific', 'centos', 'tumbleweed', 'slackware', 'rhel', 'sles', 'solaris', 'amzn', 'pidora', 'wsl2', 'altlinux', 'exherbo', 'kvmibm', 'buildroot', 'gentoo', 'guix', 'android', 'netbsd', 'oracle'})), Group(id='all_platforms', name='All platforms', platform_ids=frozenset({'raspbian', 'nobara', 'travis_ci', 'opensuse', 'github_ci', 'wsl1', 'openbsd', 'sunos', 'freebsd', 'macos', 'tuxedo', 'unknown_linux', 'xenserver', 'linuxmint', 'hurd', 'aix', 'mageia', 'windows', 'mandriva', 'arch', 'debian', 'cirrus_ci', 'cygwin', 'parallels', 'fedora', 'ibm_powerkvm', 'midnightbsd', 'circle_ci', 'ultramarine', 'rocky', 'ubuntu', 'cloudlinux', 'oracle', 'scientific', 'unknown_ci', 'centos', 'tumbleweed', 'slackware', 'rhel', 'sles', 'solaris', 'amzn', 'teamcity', 'azure_pipelines', 'heroku_ci', 'pidora', 'buildkite', 'altlinux', 'exherbo', 'kvmibm', 'wsl2', 'buildroot', 'bamboo', 'gentoo', 'gitlab_ci', 'guix', 'android', 'netbsd', 'codebuild'}))})ΒΆ
All groups.
extra_platforms.operations moduleΒΆ
Operations on a mix of Groups and Platforms.
- extra_platforms.operations.ALL_PLATFORM_IDS: frozenset[str] = frozenset({'aix', 'altlinux', 'amzn', 'android', 'arch', 'azure_pipelines', 'bamboo', 'buildkite', 'buildroot', 'centos', 'circle_ci', 'cirrus_ci', 'cloudlinux', 'codebuild', 'cygwin', 'debian', 'exherbo', 'fedora', 'freebsd', 'gentoo', 'github_ci', 'gitlab_ci', 'guix', 'heroku_ci', 'hurd', 'ibm_powerkvm', 'kvmibm', 'linuxmint', 'macos', 'mageia', 'mandriva', 'midnightbsd', 'netbsd', 'nobara', 'openbsd', 'opensuse', 'oracle', 'parallels', 'pidora', 'raspbian', 'rhel', 'rocky', 'scientific', 'slackware', 'sles', 'solaris', 'sunos', 'teamcity', 'travis_ci', 'tumbleweed', 'tuxedo', 'ubuntu', 'ultramarine', 'unknown_ci', 'unknown_linux', 'windows', 'wsl1', 'wsl2', 'xenserver'})ΒΆ
Set of all recognized platform IDs.
- extra_platforms.operations.ALL_GROUP_IDS: frozenset[str] = frozenset({'all_platforms', 'all_platforms_without_ci', 'any_windows', 'bsd', 'bsd_without_macos', 'ci', 'linux', 'linux_layers', 'linux_like', 'other_unix', 'system_v', 'unix', 'unix_layers', 'unix_without_macos'})ΒΆ
Set of all recognized group IDs.
- extra_platforms.operations.ALL_IDS: frozenset[str] = frozenset({'aix', 'all_platforms', 'all_platforms_without_ci', 'altlinux', 'amzn', 'android', 'any_windows', 'arch', 'azure_pipelines', 'bamboo', 'bsd', 'bsd_without_macos', 'buildkite', 'buildroot', 'centos', 'ci', 'circle_ci', 'cirrus_ci', 'cloudlinux', 'codebuild', 'cygwin', 'debian', 'exherbo', 'fedora', 'freebsd', 'gentoo', 'github_ci', 'gitlab_ci', 'guix', 'heroku_ci', 'hurd', 'ibm_powerkvm', 'kvmibm', 'linux', 'linux_layers', 'linux_like', 'linuxmint', 'macos', 'mageia', 'mandriva', 'midnightbsd', 'netbsd', 'nobara', 'openbsd', 'opensuse', 'oracle', 'other_unix', 'parallels', 'pidora', 'raspbian', 'rhel', 'rocky', 'scientific', 'slackware', 'sles', 'solaris', 'sunos', 'system_v', 'teamcity', 'travis_ci', 'tumbleweed', 'tuxedo', 'ubuntu', 'ultramarine', 'unix', 'unix_layers', 'unix_without_macos', 'unknown_ci', 'unknown_linux', 'windows', 'wsl1', 'wsl2', 'xenserver'})ΒΆ
Set of all recognized platform and group IDs.
- extra_platforms.operations.platforms_from_ids(*platform_and_group_ids)[source]ΒΆ
Returns a deduplicated tuple of platforms matching the provided IDs.
IDs are case-insensitive, and can refer to any platforms or groups. Matching groups will be expanded to the platforms they contain.
Order of the returned platforms matches the order of the provided IDs.
Tip
If you want to reduce the returned set and removes as much overlaps as possible, you can use the
extra_platforms.reduce()function on the results.
- extra_platforms.operations.groups_from_ids(*group_ids)[source]ΒΆ
Returns a deduplicated tuple of groups matching the provided IDs.
IDs are case-insensitive.
Order of the returned groups matches the order of the provided IDs.
Tip
If you want to reduce the returned set and removes as much overlaps as possible, you can use the
extra_platforms.reduce()function on the results.
- extra_platforms.operations.reduce(items, target_pool=None)[source]ΒΆ
Reduce a collection of platforms to a minimal set.
Returns a deduplicated set of
GroupandPlatformthat 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_poolare considered for the reduction. If no reference pool is provided, use all known groups.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.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='β', url='')[source]ΒΆ
Bases:
objectA 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.
- property short_desc: strΒΆ
Returns a short description of the platform.
Mainly used to produce docstrings for function dynamically generated for each group.
extra_platforms.platform_data moduleΒΆ
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.pytest moduleΒΆ
Pytest decorators to skip tests depending on the platform theyβre run on.
Generates a pair of ready-to-use @skip_<id> and @unless_<id> decorators for
each platform and group.