extra_platforms package¶
Expose package-wide elements.
Submodules¶
extra_platforms.agent_data module¶
Agent definitions and metadata.
extra_platforms.architecture_data module¶
Architecture definitions and metadata.
Hint
Architecture’s canonical IDs are inspired by those used in the auditwheel project to encode the manylinux policies.
See also
Architecture variants from Rust’s target-lexicon.
Todo
Add mapping of architecture to manylinux Python targets? As per:
extra_platforms.ci_data module¶
CI definitions and metadata.
extra_platforms.detection module¶
Heuristics to detect all traits of the current environment.
This collection of heuristics is designed as a set of separate function with minimal logic and dependencies. They’re the building blocks to evaluate the current environment.
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 distributions relies on /etc/os-release, as specified by the
os-release specification.
Every modern Linux distribution (since 2012) ships this file.
For all other traits, we either rely on:
environment variables
Todo
hostnamectl could be used as a fallback detection source when
/etc/os-release is missing (e.g., stripped CloudLinux VMs). This approach was
proposed upstream in python-distro but rejected. The technique
is sound and could be implemented here.
extra_platforms.group module¶
Group a collection of traits. Also referred as families.
extra_platforms.group_data module¶
Definitions of ready-to-use groups.
This module contains all predefined Group instances and
frozenset collections that organize traits into logical categories.
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/starship/starship/blob/master/.github/config-schema.json
Some icons, especially Linux distributions, have their own dedicated codepoints in NerdFonts.
extra_platforms.shell_data module¶
Shell definitions and metadata.
extra_platforms.terminal_data module¶
Terminal definitions and metadata.
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.
extra_platforms.trait module¶
Trait base class for architectures, platforms, shells, terminals, CI systems, agents, and more.
A trait represents a distinguishing characteristic of a runtime environment. Each trait has a unique ID, a human-readable name, an icon, and the ability to detect if it matches the current environment.
Data associated with traits can be aggressively cached and frozen, as they’re only computed based on environment-dependent values.