PlatformsΒΆ
Each platform represents an operating system or OS-like environment, and is associated with:
a unique platform ID
a human-readable name
an icon (emoji / unicode character)
various metadata in its
info()method
Each platform is materialized by a Platform object, from which you can access various metadata:
>>> from extra_platforms import DEBIAN
>>> DEBIAN
Platform(id='debian', name='Debian')
>>> DEBIAN.id
'debian'
>>> DEBIAN.current
False
>>> DEBIAN.info()
{'id': 'debian', 'name': 'Debian', 'icon': 'π', 'url': 'https://debian.org', 'current': False, 'distro_id': None, 'version': None, 'version_parts': {'major': None, 'minor': None, 'build_number': None}, 'like': None, 'codename': None}
To check if the current platform matches a specific platform, use the corresponding detection function:
>>> from extra_platforms import is_macos
>>> is_macos()
True
The current platform can be obtained via the current_platform() function:
>>> from extra_platforms import current_platform
>>> current_platform()
Platform(id='macos', name='macOS')
Recognized platformsΒΆ
Icon |
Name |
ID |
Detection function |
|---|---|---|---|
βΏ |
|
||
π§ |
|
||
β€» |
|
||
π€ |
|
||
ποΈ |
|
||
βοΈ |
|
||
β¬ |
|
||
π |
|
||
κ© |
|
||
ΟΎ |
|
||
π |
|
||
π½ |
|
||
π© |
|
||
π |
|
||
ποΈ |
|
||
π |
|
||
π |
|
||
π€Ή |
|
||
π€Ή |
|
||
πΏ |
|
||
π |
|
||
β₯ |
|
||
π« |
|
||
π |
|
||
π© |
|
||
ο |
|
||
π‘ |
|
||
π¦ |
|
||
𦴠|
|
||
β₯ |
|
||
π |
|
||
π |
|
||
π© |
|
||
β°οΈ |
|
||
βοΈ |
|
||
π¬ |
|
||
π¦ |
|
||
π |
|
||
βοΈ |
|
||
β» |
|
||
π€΅ |
|
||
π― |
|
||
π |
|
||
π§ |
|
||
πͺ |
|
||
β |
|
||
β |
|
||
β |
|
Groups of platformsΒΆ
All recognized platforms are grouped in families.
Canonical groupsΒΆ
All platforms are distributed in groups that are guaranteed to be non-overlapping.
Here is the canonical groups and all platforms, visualized as a Sankey diagram:
---
config:
sankey:
height: 800
showValues: false
width: 800
---
sankey-beta
ALL_PLATFORMS,LINUX,35
ALL_PLATFORMS,BSD,6
ALL_PLATFORMS,SYSTEM_V,2
ALL_PLATFORMS,LINUX_LAYERS,2
ALL_PLATFORMS,UNIX_LAYERS,1
ALL_PLATFORMS,OTHER_UNIX,1
ALL_PLATFORMS,ANY_WINDOWS,1
LINUX,altlinux,1
LINUX,amzn,1
LINUX,android,1
LINUX,arch,1
LINUX,buildroot,1
LINUX,cachyos,1
LINUX,centos,1
LINUX,cloudlinux,1
LINUX,debian,1
LINUX,exherbo,1
LINUX,fedora,1
LINUX,gentoo,1
LINUX,guix,1
LINUX,ibm_powerkvm,1
LINUX,kvmibm,1
LINUX,linuxmint,1
LINUX,mageia,1
LINUX,mandriva,1
LINUX,nobara,1
LINUX,opensuse,1
LINUX,oracle,1
LINUX,parallels,1
LINUX,pidora,1
LINUX,raspbian,1
LINUX,rhel,1
LINUX,rocky,1
LINUX,scientific,1
LINUX,slackware,1
LINUX,sles,1
LINUX,tumbleweed,1
LINUX,tuxedo,1
LINUX,ubuntu,1
LINUX,ultramarine,1
LINUX,unknown_linux,1
LINUX,xenserver,1
BSD,freebsd,1
BSD,macos,1
BSD,midnightbsd,1
BSD,netbsd,1
BSD,openbsd,1
BSD,sunos,1
SYSTEM_V,aix,1
SYSTEM_V,solaris,1
LINUX_LAYERS,wsl1,1
LINUX_LAYERS,wsl2,1
UNIX_LAYERS,cygwin,1
OTHER_UNIX,hurd,1
ANY_WINDOWS,windows,1
And the same groups visualized as a mindmap:
---
config:
mindmap:
padding: 5
---
mindmap
((βοΈ all_platforms))
)β UNIX_LAYERS(
(ΟΎ cygwin)
)β
€ SYSTEM_V(
(βΏ aix)
(π solaris)
)β OTHER_UNIX(
(π hurd)
)β LINUX_LAYERS(
(β wsl1)
(β wsl2)
)π§ LINUX(
(π§ altlinux)
(β€» amzn)
(π€ android)
(ποΈ arch)
(βοΈ buildroot)
(β¬ cachyos)
(π centos)
(κ© cloudlinux)
(π debian)
(π½ exherbo)
(π© fedora)
(ποΈ gentoo)
(π guix)
(π€Ή ibm_powerkvm)
(π€Ή kvmibm)
(πΏ linuxmint)
(β₯ mageia)
(π« mandriva)
(ο nobara)
(π¦ opensuse)
(𦴠oracle)
(β₯ parallels)
(π pidora)
(π raspbian)
(π© rhel)
(β°οΈ rocky)
(βοΈ scientific)
(π¬ slackware)
(π¦ sles)
(β» tumbleweed)
(π€΅ tuxedo)
(π― ubuntu)
(π ultramarine)
(π§ unknown_linux)
(β xenserver)
)π
±οΈ+ BSD(
(π freebsd)
(π macos)
(π midnightbsd)
(π© netbsd)
(π‘ openbsd)
(βοΈ sunos)
)πͺ ANY_WINDOWS(
(πͺ windows)
All groupsΒΆ
Here is a table listing all defined platform groups:
Icon |
Group ID |
Description |
Canonical |
Member count |
|---|---|---|---|---|
βοΈ |
|
All platforms |
48 |
|
πͺ |
|
Any Windows |
β |
1 |
π ±οΈ+ |
|
Any BSD |
β |
6 |
π ±οΈ |
|
Any BSD excluding macOS |
5 |
|
π§ |
|
Any Linux distribution |
β |
35 |
β |
|
Any Linux compatibility layers |
β |
2 |
π§+ |
|
Any Linux and compatibility layers |
37 |
|
β |
|
Any other Unix |
β |
1 |
β € |
|
AT&T System Five |
β |
2 |
β¨· |
|
Any Unix |
47 |
|
β |
|
Any Unix compatibility layers |
β |
1 |
β¨ |
|
Any Unix excluding macOS |
46 |
Hint
Canonical groups are non-overlapping groups that together cover all recognized platforms. 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.
Contribution guidelinesΒΆ
To add a new Linux distribution, you can get inspiration from these pull requests:
https://github.com/kdeldycke/extra-platforms/pull/156
https://github.com/kdeldycke/extra-platforms/pull/94
extra_platforms.platform APIΒΆ
classDiagram
Trait <|-- Platform
Platforms, also known as Operating Systems.
- class extra_platforms.platform.Platform(id, name, icon='β', url='')[source]ΒΆ
Bases:
TraitA 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.
extra_platforms.platform_data APIΒΆ
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.