Groups

Group usage

Todo

Explain high-level usage of groups here. Including membership testing and set operations. And how to create custom groups (from scratch or by combining existing groups).

All groups

All recognized groups and their properties:

Icon

Symbol

Description

Detection

Canonical

🏛️

ALL_ARCHITECTURES

All architectures

is_any_architecture()

📱

ALL_ARM

ARM architectures

is_any_arm()

ALL_CI

CI systems

is_any_ci()

🔲

ALL_MIPS

MIPS architectures

is_any_mips()

⚙️

ALL_PLATFORMS

All platforms

is_any_platform()

☀️

ALL_SPARC

SPARC architectures

is_any_sparc()

ALL_TRAITS

All architectures, platforms and CI systems

is_any_trait()

🪟

ALL_WINDOWS

All Windows

is_any_windows()

³²

ARCH_32_BIT

32-bit architectures

is_arch_32_bit()

⁶⁴

ARCH_64_BIT

64-bit architectures

is_arch_64_bit()

🅱️+

BSD

All BSD

is_bsd()

🅱️

BSD_WITHOUT_MACOS

All BSD excluding macOS

is_bsd_not_macos()

🏢

IBM_MAINFRAME

IBM mainframe

is_ibm_mainframe()

🐧

LINUX

Linux distributions

is_linux()

LINUX_LAYERS

Linux compatibility layers

is_linux_layers()

🐧+

LINUX_LIKE

All Linux & compatibility layers

is_linux_like()

🐉

LOONGARCH

LoongArch

is_loongarch()

🅟

OTHER_POSIX

Other POSIX-compliant platforms

is_other_posix()

POWERPC

PowerPC family

is_powerpc()

RISCV

RISC-V family

is_riscv()

𝐕

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

UNKNOWN

Unknown

is_unknown()

🌐

WEBASSEMBLY

WebAssembly

is_webassembly()

𝘅

X86

x86 family

is_x86()

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.

Predefined groups

extra_platforms.ALL_ARCHITECTURES = Group(id='all_architectures', name='All architectures')

All recognized architectures.

Caution

This group does not contain the UNKNOWN_ARCHITECTURE trait.

extra_platforms.ALL_ARM = Group(id='all_arm', name='ARM architectures')

All ARM-based architectures.

extra_platforms.ALL_CI = Group(id='all_ci', name='CI systems')

All recognized Continuous Integration systems.

Caution

This group does not contain the UNKNOWN_CI trait.

extra_platforms.ALL_MIPS = Group(id='all_mips', name='MIPS architectures')

All MIPS-based architectures.

extra_platforms.ALL_PLATFORMS = Group(id='all_platforms', name='All platforms')

All recognized platforms.

Caution

This group does not contain the UNKNOWN_PLATFORM trait.

extra_platforms.ALL_SPARC = Group(id='all_sparc', name='SPARC architectures')

All SPARC-based architectures.

extra_platforms.ALL_TRAITS = Group(id='all_traits', name='All architectures, platforms and CI systems')

All predefined architectures, platforms and CI systems.

Hint

This group includes all UNKNOWN_* traits.

extra_platforms.ALL_WINDOWS = Group(id='all_windows', name='All Windows')

All Windows operating systems.

extra_platforms.ARCH_32_BIT = Group(id='arch_32_bit', name='32-bit architectures')

All 32-bit architectures.

extra_platforms.ARCH_64_BIT = Group(id='arch_64_bit', name='64-bit architectures')

All 64-bit architectures.

extra_platforms.BSD = Group(id='bsd', name='All BSD')

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.BSD_WITHOUT_MACOS = Group(id='bsd_without_macos', name='All BSD excluding macOS')

All BSD platforms, without macOS.

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

extra_platforms.IBM_MAINFRAME = Group(id='ibm_mainframe', name='IBM mainframe')

IBM mainframe architectures.

extra_platforms.LINUX = Group(id='linux', name='Linux distributions')

All distributions based on a Linux kernel.

Note

Are considered of this family (according Wikipedia):

  • Android

  • ChromeOS

  • any other distribution

extra_platforms.LINUX_LAYERS = Group(id='linux_layers', name='Linux compatibility layers')

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.LINUX_LIKE = Group(id='linux_like', name='All Linux & compatibility layers')

Sum of all Linux distributions and Linux compatibility layers.

extra_platforms.LOONGARCH = Group(id='loongarch', name='LoongArch')

LoongArch architecture.

extra_platforms.OTHER_POSIX = Group(id='other_posix', name='Other POSIX-compliant platforms')

All other UNIX-like or POSIX-compliant 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.POWERPC = Group(id='powerpc', name='PowerPC family')

All PowerPC-based architectures.

extra_platforms.RISCV = Group(id='riscv', name='RISC-V family')

All RISC-V-based architectures.

extra_platforms.SYSTEM_V = Group(id='system_v', name='AT&T System Five')

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.UNIX = Group(id='unix', name='All Unix')

All Unix-like operating systems and compatibility layers.

extra_platforms.UNIX_LAYERS = Group(id='unix_layers', name='Unix compatibility layers')

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.UNIX_WITHOUT_MACOS = Group(id='unix_without_macos', name='All Unix excluding macOS')

All Unix platforms, without macOS.

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

extra_platforms.UNKNOWN = Group(id='unknown', name='Unknown')

Unknown or unrecognized traits.

extra_platforms.WEBASSEMBLY = Group(id='webassembly', name='WebAssembly')

WebAssembly architectures.

extra_platforms.X86 = Group(id='x86', name='x86 family')

All x86-based architectures (Intel-compatible).

Group collections

extra_platforms.group_data.ALL_ARCHITECTURE_GROUPS: frozenset[Group] = frozenset({Group(id='loongarch', name='LoongArch'), Group(id='ibm_mainframe', name='IBM mainframe'), Group(id='all_arm', name='ARM architectures'), Group(id='all_sparc', name='SPARC architectures'), Group(id='arch_32_bit', name='32-bit architectures'), Group(id='x86', name='x86 family'), Group(id='powerpc', name='PowerPC family'), Group(id='riscv', name='RISC-V family'), Group(id='webassembly', name='WebAssembly'), Group(id='arch_64_bit', name='64-bit architectures'), Group(id='all_mips', name='MIPS architectures'), Group(id='all_architectures', name='All architectures')})

All groups whose members are architectures.

extra_platforms.group_data.ALL_CI_GROUPS: frozenset[Group] = frozenset({Group(id='all_ci', name='CI systems')})

All groups whose members are CI systems.

Note

Not that useful currently, but provided for symmetry with architecture and platform groups.

extra_platforms.group_data.ALL_GROUPS: frozenset[Group] = frozenset({Group(id='loongarch', name='LoongArch'), Group(id='all_arm', name='ARM architectures'), Group(id='all_sparc', name='SPARC architectures'), Group(id='linux_layers', name='Linux compatibility layers'), Group(id='arch_32_bit', name='32-bit architectures'), Group(id='powerpc', name='PowerPC family'), Group(id='riscv', name='RISC-V family'), Group(id='unknown', name='Unknown'), Group(id='webassembly', name='WebAssembly'), Group(id='x86', name='x86 family'), Group(id='all_architectures', name='All architectures'), Group(id='linux', name='Linux distributions'), Group(id='bsd_without_macos', name='All BSD excluding macOS'), Group(id='unix_layers', name='Unix compatibility layers'), Group(id='linux_like', name='All Linux & compatibility layers'), Group(id='unix_without_macos', name='All Unix excluding macOS'), Group(id='bsd', name='All BSD'), Group(id='all_windows', name='All Windows'), Group(id='unix', name='All Unix'), Group(id='all_platforms', name='All platforms'), Group(id='all_ci', name='CI systems'), Group(id='system_v', name='AT&T System Five'), Group(id='other_posix', name='Other POSIX-compliant platforms'), Group(id='ibm_mainframe', name='IBM mainframe'), Group(id='arch_64_bit', name='64-bit architectures'), Group(id='all_mips', name='MIPS architectures'), Group(id='all_traits', name='All architectures, platforms and CI systems')})

All predefined groups.

Hint

This collection contains both canonical and non-canonical groups, including the UNKNOWN group.

extra_platforms.group_data.ALL_PLATFORM_GROUPS: frozenset[Group] = frozenset({Group(id='linux_layers', name='Linux compatibility layers'), Group(id='linux_like', name='All Linux & compatibility layers'), Group(id='system_v', name='AT&T System Five'), Group(id='other_posix', name='Other POSIX-compliant platforms'), Group(id='bsd_without_macos', name='All BSD excluding macOS'), Group(id='unix_layers', name='Unix compatibility layers'), Group(id='unix_without_macos', name='All Unix excluding macOS'), Group(id='bsd', name='All BSD'), Group(id='linux', name='Linux distributions'), Group(id='unix', name='All Unix'), Group(id='all_windows', name='All Windows'), Group(id='all_platforms', name='All platforms')})

All groups whose members are platforms.

extra_platforms.group_data.EXTRA_GROUPS: frozenset[Group] = frozenset({Group(id='arch_32_bit', name='32-bit architectures'), Group(id='bsd_without_macos', name='All BSD excluding macOS'), Group(id='linux_like', name='All Linux & compatibility layers'), Group(id='unix_without_macos', name='All Unix excluding macOS'), Group(id='unix', name='All Unix'), Group(id='all_platforms', name='All platforms'), Group(id='arch_64_bit', name='64-bit architectures'), Group(id='all_architectures', name='All architectures'), Group(id='all_traits', name='All architectures, platforms and CI systems')})

Overlapping groups, defined for convenience.

Hint

None of these groups are marked as canonical.

extra_platforms.group_data.NON_OVERLAPPING_GROUPS: frozenset[Group] = frozenset({Group(id='loongarch', name='LoongArch'), Group(id='ibm_mainframe', name='IBM mainframe'), Group(id='all_arm', name='ARM architectures'), Group(id='all_sparc', name='SPARC architectures'), Group(id='all_ci', name='CI systems'), Group(id='linux_layers', name='Linux compatibility layers'), Group(id='powerpc', name='PowerPC family'), Group(id='x86', name='x86 family'), Group(id='riscv', name='RISC-V family'), Group(id='system_v', name='AT&T System Five'), Group(id='unknown', name='Unknown'), Group(id='webassembly', name='WebAssembly'), Group(id='other_posix', name='Other POSIX-compliant platforms'), Group(id='unix_layers', name='Unix compatibility layers'), Group(id='bsd', name='All BSD'), Group(id='linux', name='Linux distributions'), Group(id='all_mips', name='MIPS architectures'), Group(id='all_windows', name='All Windows')})

Non-overlapping groups.

Hint

These groups together cover all predefined architectures, platforms, and CI systems, including traits from the UNKNOWN group.

All groups in this collection are marked as canonical.

ID collections

extra_platforms.group_data.ALL_GROUP_IDS: frozenset[str] = frozenset({'all_architectures', 'all_arm', 'all_ci', 'all_mips', 'all_platforms', 'all_sparc', 'all_traits', 'all_windows', 'arch_32_bit', 'arch_64_bit', 'bsd', 'bsd_without_macos', 'ibm_mainframe', 'linux', 'linux_layers', 'linux_like', 'loongarch', 'other_posix', 'powerpc', 'riscv', 'system_v', 'unix', 'unix_layers', 'unix_without_macos', 'webassembly', 'x86'})

A frozenset of all recognized group IDs.

Attention

This collection does not contain the UNKNOWN group.

extra_platforms.group_data.ALL_IDS: frozenset[str] = frozenset({'aarch64', 'aix', 'all_architectures', 'all_arm', 'all_ci', 'all_mips', 'all_platforms', 'all_sparc', 'all_traits', 'all_windows', 'altlinux', 'amzn', 'android', 'arch', 'arch_32_bit', 'arch_64_bit', 'arm', 'armv5tel', 'armv6l', 'armv7l', 'armv8l', 'azure_pipelines', 'bamboo', 'bsd', 'bsd_without_macos', 'buildkite', 'buildroot', 'cachyos', 'centos', 'circle_ci', 'cirrus_ci', 'cloudlinux', 'codebuild', 'cygwin', 'debian', 'dragonfly_bsd', 'exherbo', 'fedora', 'freebsd', 'gentoo', 'github_ci', 'gitlab_ci', 'guix', 'haiku', 'heroku_ci', 'hurd', 'i386', 'i586', 'i686', 'ibm_mainframe', 'ibm_powerkvm', 'illumos', 'kvmibm', 'linux', 'linux_layers', 'linux_like', 'linuxmint', 'loongarch', 'loongarch64', 'macos', 'mageia', 'mandriva', 'midnightbsd', 'mips', 'mips64', 'mips64el', 'mipsel', 'netbsd', 'nobara', 'openbsd', 'opensuse', 'oracle', 'other_posix', 'parallels', 'pidora', 'powerpc', 'ppc', 'ppc64', 'ppc64le', 'raspbian', 'rhel', 'riscv', 'riscv32', 'riscv64', 'rocky', 's390x', 'scientific', 'slackware', 'sles', 'solaris', 'sparc', 'sparc64', 'sunos', 'system_v', 'teamcity', 'travis_ci', 'tumbleweed', 'tuxedo', 'ubuntu', 'ultramarine', 'unix', 'unix_layers', 'unix_without_macos', 'wasm32', 'wasm64', 'webassembly', 'windows', 'wsl1', 'wsl2', 'x86', 'x86_64', 'xenserver'})

A frozenset of all recognized traits and group IDs.

Attention

This collection does not contain all the UNKNOWN_* traits and the UNKNOWN group.

extra_platforms.group_data.ALL_TRAIT_IDS: frozenset[str] = frozenset({'aarch64', 'aix', 'altlinux', 'amzn', 'android', 'arch', 'arm', 'armv5tel', 'armv6l', 'armv7l', 'armv8l', 'azure_pipelines', 'bamboo', 'buildkite', 'buildroot', 'cachyos', 'centos', 'circle_ci', 'cirrus_ci', 'cloudlinux', 'codebuild', 'cygwin', 'debian', 'dragonfly_bsd', 'exherbo', 'fedora', 'freebsd', 'gentoo', 'github_ci', 'gitlab_ci', 'guix', 'haiku', 'heroku_ci', 'hurd', 'i386', 'i586', 'i686', 'ibm_powerkvm', 'illumos', 'kvmibm', 'linuxmint', 'loongarch64', 'macos', 'mageia', 'mandriva', 'midnightbsd', 'mips', 'mips64', 'mips64el', 'mipsel', 'netbsd', 'nobara', 'openbsd', 'opensuse', 'oracle', 'parallels', 'pidora', 'ppc', 'ppc64', 'ppc64le', 'raspbian', 'rhel', 'riscv32', 'riscv64', 'rocky', 's390x', 'scientific', 'slackware', 'sles', 'solaris', 'sparc', 'sparc64', 'sunos', 'teamcity', 'travis_ci', 'tumbleweed', 'tuxedo', 'ubuntu', 'ultramarine', 'wasm32', 'wasm64', 'windows', 'wsl1', 'wsl2', 'x86_64', 'xenserver'})

A frozenset of all recognized traits IDs.

Attention

This collection does not contain all the UNKNOWN_* traits.

Trait and group operations

extra_platforms.extract_members(*other)[source]

Returns all traits found in other.

other can be an arbitrarily nested Iterable of Group, Trait, or their IDs. None values and empty iterables are silently ignored.

Caution

Can returns duplicates.

Return type:

Iterator[Trait]

extra_platforms.traits_from_ids(*trait_and_group_ids)[source]

Returns a deduplicated tuple of traits matching the provided IDs.

IDs are case-insensitive, and can refer to any traits or groups. Matching groups will be expanded to the Trait instances they contain.

Order of the returned traits 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 reduce() function on the results.

Return type:

tuple[Trait, ...]

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 Group instances 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 reduce() function on the results.

Return type:

tuple[Group, ...]

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

Reduce a collection of traits to a minimal set.

Returns a deduplicated set of Group and Trait that covers the same exact traits as the original input, but group as much traits 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.

Note

The algorithm is a variant of the Set Cover Problem, which is NP-hard. This implementation uses a greedy approximation that iteratively selects the largest group fitting the remaining uncovered traits.

Todo

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

Return type:

frozenset[Group | Trait]

Deprecated groups

extra_platforms.ALL_PLATFORMS_WITHOUT_CI(*args, **kwargs) = Group(id='all_platforms', name='All platforms')

Alias ALL_PLATFORMS_WITHOUT_CIALL_PLATFORMS.

Deprecated since version 6.0.0: Use ALL_PLATFORMS instead.

extra_platforms.ANY_ARM(*args, **kwargs) = Group(id='all_arm', name='ARM architectures')

Alias ANY_ARMALL_ARM.

Deprecated since version 7.0.0: Use ALL_ARM instead.

extra_platforms.ANY_MIPS(*args, **kwargs) = Group(id='all_mips', name='MIPS architectures')

Alias ANY_MIPSALL_MIPS.

Deprecated since version 7.0.0: Use ALL_MIPS instead.

extra_platforms.ANY_SPARC(*args, **kwargs) = Group(id='all_sparc', name='SPARC architectures')

Alias ANY_SPARCALL_SPARC.

Deprecated since version 7.0.0: Use ALL_SPARC instead.

extra_platforms.ANY_WINDOWS(*args, **kwargs) = Group(id='all_windows', name='All Windows')

Alias ANY_WINDOWSALL_WINDOWS.

Deprecated since version 7.0.0: Use ALL_WINDOWS instead.

extra_platforms.OTHER_UNIX(*args, **kwargs) = Group(id='other_posix', name='Other POSIX-compliant platforms')

Alias OTHER_UNIXOTHER_POSIX.

Deprecated since version 7.0.0: Use OTHER_POSIX instead.

Deprecated group utilities

extra_platforms.platforms_from_ids(*trait_and_group_ids)

Alias platforms_from_idstraits_from_ids().

Deprecated since version 6.0.0: Use traits_from_ids() instead.

Return type:

tuple[Trait, ...]

extra_platforms.ALL_PLATFORM_IDS = frozenset({'guix', 'codebuild', 'netbsd', 'ppc64le', 'armv5tel', 'centos', 'circle_ci', 'mageia', 'amzn', 'riscv32', 'parallels', 'midnightbsd', 'heroku_ci', 'cachyos', 'sparc64', 'opensuse', 'x86_64', 'pidora', 'github_ci', 'aix', 'nobara', 'xenserver', 'dragonfly_bsd', 'rocky', 'arch', 'debian', 'bamboo', 'teamcity', 'mandriva', 'buildkite', 'armv6l', 'mipsel', 'ppc', 'mips64', 'ibm_powerkvm', 'windows', 'altlinux', 'haiku', 'mips', 'i586', 'linuxmint', 'cloudlinux', 'ultramarine', 'illumos', 'azure_pipelines', 'sunos', 'aarch64', 'tuxedo', 'mips64el', 'gitlab_ci', 'raspbian', 'i386', 'ppc64', 'sparc', 'kvmibm', 'gentoo', 'rhel', 'macos', 'armv7l', 'riscv64', 'arm', 'wsl2', 's390x', 'wsl1', 'cygwin', 'hurd', 'oracle', 'openbsd', 'exherbo', 'scientific', 'tumbleweed', 'solaris', 'travis_ci', 'slackware', 'fedora', 'freebsd', 'buildroot', 'cirrus_ci', 'loongarch64', 'ubuntu', 'armv8l', 'sles', 'wasm32', 'wasm64', 'android', 'i686'})

Alias ALL_PLATFORM_IDSALL_TRAIT_IDS.

Deprecated since version 6.0.0: Use ALL_TRAIT_IDS instead.

Group implementation

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

Bases: _Identifiable

A Group identifies a collection of Trait members.

Additionally of the common fields inherited from _Identifiable, each group provides:

  • members: An iterable of Trait instances that belong to this group.

  • member_ids: A frozenset of member IDs for quick lookup.

  • canonical: A bool indicating if the group is canonical (non-overlapping).

  • various set-like operations (union, intersection, difference, etc.).

unknown_symbol: ClassVar[str] = 'UNKNOWN'

Groups use UNKNOWN instead of UNKNOWN_GROUP.

members: Iterable[Trait]

Traits in this group.

Normalized to MappingProxyType at init, providing O(1) lookup by ID.

property _members: MappingProxyType

Typed access to members as MappingProxyType.

Warning

The members field is typed as Iterable to accept any iterable at construction time. After __post_init__, it is always a MappingProxyType. This property provides a cast() to that type, avoiding # type: ignore comments throughout the class.

__post_init__()[source]

Normalize members to a sorted, deduplicated mapping.

Hint

Docstring generation is deferred to avoid circular imports during module initialization. See _docstrings._initialize_all_docstrings().

generate_docstring()[source]

Generate comprehensive docstring for this group instance.

Combines the attribute docstring from the source module with various metadata.

Return type:

str

property member_ids: frozenset[str]

A frozenset of member IDs that belong to this group.

__hash__()[source]

Hash based on group ID and member IDs.

Return type:

int

property canonical: bool

Returns True if the group is canonical (non-overlapping), False otherwise.

A canonical group is one that does not share any members with other canonical groups. All canonical groups are non-overlapping.

Non-canonical groups are provided for convenience, but overlap with each other or with canonical groups.

Hint

Canonical groups are denoted with a ⬥ symbol in the documentation and tables.

__iter__()[source]

Iterate over the members of the group.

Return type:

Iterator[Trait]

__len__()[source]

Return the number of members in the group.

Return type:

int

__bool__()[source]

Return True if the group has members, False otherwise.

Return type:

bool

__contains__(item)[source]

Test if Trait object or its ID is part of the group.

Return type:

bool

__getitem__(member_id)[source]

Return the trait whose ID is member_id.

Return type:

Trait

items()[source]

Iterate over the traits of the group as key-value pairs.

Return type:

Iterator[tuple[str, Trait]]

static _extract_members(*other)[source]

Deprecated alias for extract_members().

Deprecated since version 8.0.0: Use extract_members() instead.

Return type:

Iterator[Trait]

static _extract_platforms(*other)[source]

Deprecated alias for extract_members().

Deprecated since version 6.0.0: Use extract_members() instead.

Return type:

Iterator[Trait]

isdisjoint(other)[source]

Return True if the group has no members 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 Trait.

Return type:

bool

fullyintersects(other)[source]

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

Return type:

bool

issubset(other)[source]

Test whether every member in the group is in other.

Return type:

bool

__le__(other)

Test whether every member in the group is in other.

Return type:

bool

__lt__(other)[source]

Test whether every member in the group is in other, but not all.

Return type:

bool

issuperset(other)[source]

Test whether every member in other is in the group.

Return type:

bool

__ge__(other)

Test whether every member in other is in the group.

Return type:

bool

__gt__(other)[source]

Test whether every member in other is in the group, but not all.

Return type:

bool

union(*others)[source]

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

Caution

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

Return type:

Group

__or__(*others)

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

Caution

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

Return type:

Group

__ior__(*others)

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

Caution

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

Return type:

Group

intersection(*others)[source]

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

Caution

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

Return type:

Group

__and__(*others)

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

Caution

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

Return type:

Group

__iand__(*others)

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

Caution

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

Return type:

Group

difference(*others)[source]

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

Caution

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

Return type:

Group

__sub__(*others)

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

Caution

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

Return type:

Group

__isub__(*others)

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

Caution

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

Return type:

Group

symmetric_difference(other)[source]

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

Caution

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

Return type:

Group

__xor__(other)

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

Caution

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

Return type:

Group

__ixor__(other)

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

Caution

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

Return type:

Group

copy(id=None, name=None, icon=None, members=None)[source]

Return a shallow copy of the group.

Fields can be overridden by passing new values as arguments.

Return type:

Group

add(member)[source]

Return a new Group with the specified trait added.

If the trait is already in the group, returns a copy unchanged.

Return type:

Group

Args:

member: A Trait object or trait ID string to add.

Returns:

A new Group instance with the trait added.

Raises:

ValueError: If the trait ID is not recognized.

remove(member)[source]

Return a new Group with the specified trait removed.

Raises KeyError if the trait is not in the group.

Return type:

Group

Args:

member: A Trait object or trait ID string to remove.

Returns:

A new Group instance with the trait removed.

Raises:

KeyError: If the trait is not in the group.

discard(member)[source]

Return a new Group with the specified trait removed if present.

Unlike remove(), this does not raise an error if the trait is not found.

Return type:

Group

Args:

member: A Trait object or trait ID string to remove.

Returns:

A new Group instance with the trait removed, or a copy if not present.

pop(member_id=None)[source]

Remove and return a trait from the group.

Return type:

tuple[Trait, Group]

Args:
member_id: Optional trait ID to remove. If not provided, removes an arbitrary

trait (specifically, the first one in iteration order).

Returns:

A tuple of (removed Trait, new Group).

Raises:

KeyError: If member_id is provided but not found in the group. KeyError: If the group is empty.

clear()[source]

Return a new empty Group with the same metadata.

Return type:

Group

Returns:

A new Group instance with no members but same id, name, and icon.

__annotations__ = {'all_group': 'ClassVar[str]', 'data_module_id': 'ClassVar[str]', 'detection_func_id': 'str', 'doc_page': 'ClassVar[str]', 'icon': 'str', 'id': 'str', 'members': 'Iterable[Trait]', 'name': 'str', 'skip_decorator_id': 'str', 'symbol_id': 'str', 'type_id': 'ClassVar[str]', 'type_name': 'ClassVar[str]', 'unknown_symbol': 'ClassVar[str]', 'unless_decorator_id': 'str'}
__dataclass_fields__ = {'all_group': Field(name='all_group',type='ClassVar[str]',default='',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'data_module_id': Field(name='data_module_id',type='ClassVar[str]',default='',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'detection_func_id': Field(name='detection_func_id',type='str',default=<dataclasses._MISSING_TYPE object>,default_factory=<dataclasses._MISSING_TYPE object>,init=False,repr=False,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'doc_page': Field(name='doc_page',type='ClassVar[str]',default='',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'icon': Field(name='icon',type='str',default='❓',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=False,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'id': Field(name='id',type='str',default=<dataclasses._MISSING_TYPE object>,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'members': Field(name='members',type='Iterable[Trait]',default=<dataclasses._MISSING_TYPE object>,default_factory=<class 'tuple'>,init=True,repr=False,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'name': Field(name='name',type='str',default=<dataclasses._MISSING_TYPE object>,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'skip_decorator_id': Field(name='skip_decorator_id',type='str',default=<dataclasses._MISSING_TYPE object>,default_factory=<dataclasses._MISSING_TYPE object>,init=False,repr=False,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'symbol_id': Field(name='symbol_id',type='str',default=<dataclasses._MISSING_TYPE object>,default_factory=<dataclasses._MISSING_TYPE object>,init=False,repr=False,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'type_id': Field(name='type_id',type='ClassVar[str]',default='',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'type_name': Field(name='type_name',type='ClassVar[str]',default='',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'unknown_symbol': Field(name='unknown_symbol',type='ClassVar[str]',default='',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'unless_decorator_id': Field(name='unless_decorator_id',type='str',default=<dataclasses._MISSING_TYPE object>,default_factory=<dataclasses._MISSING_TYPE object>,init=False,repr=False,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)}
__dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=True,match_args=True,kw_only=False,slots=False,weakref_slot=False)
__delattr__(name)

Implement delattr(self, name).

__eq__(other)

Return self==value.

__init__(id, name, icon='❓', members=<factory>)
__match_args__ = ('id', 'name', 'icon', 'members')
__module__ = 'extra_platforms.group'
__repr__()

Return repr(self).

__setattr__(name, value)

Implement setattr(self, name, value).

all_group: ClassVar[str] = 'ALL_GROUPS'

The symbol name for the group containing all instances of this type.

data_module_id: ClassVar[str] = 'group_data'

The module name where instances of this type are defined.

doc_page: ClassVar[str] = 'groups.md'

The documentation page filename.

type_id: ClassVar[str] = 'group'

Machine-readable type identifier used to derive module and symbol names.

type_name: ClassVar[str] = 'group'

Human-readable type name for documentation.

id: str

Unique ID of the object.

symbol_id: str

Symbolic identifier.

This is the variable name under which the instance can be accessed at the root of the extra_platforms module.

Mainly useful for documentation generation.

detection_func_id: str

ID of the detection function for this object.

The detection function is expected to be named is_<id>() and available at the root of the extra_platforms module.

skip_decorator_id: str

ID of the Pytest skip decorator for this object.

The decorator is expected to be named @skip_<id> and available from the extra_platforms.pytest module.

unless_decorator_id: str

ID of the Pytest unless decorator for this object.

The decorator is expected to be named @unless_<id> and available from the extra_platforms.pytest module.

name: str

User-friendly name of the object.

        classDiagram
  _Identifiable <|-- Group
    

Group a collection of traits. Also referred as families.

Definitions of ready-to-use groups.

This module contains all predefined Group instances and frozenset collections that organize traits into logical categories.