extra-platforms

raw JSON →
12.0.3 verified Fri May 01 auth: no python

Detect architectures, platforms, shells, terminals, CI systems and agents, grouped by family. Current version: 12.0.3, requires Python >=3.10. Active development with frequent releases.

pip install extra-platforms
error ModuleNotFoundError: No module named 'extra_platforms'
cause Package not installed or installed in wrong environment.
fix
Run pip install extra-platforms
error AttributeError: module 'extra_platforms' has no attribute 'is_linux'
cause Importing from subpackage instead of top-level, or using old version.
fix
Use from extra_platforms import is_linux
error TypeError: is_linux() missing 1 required positional argument: 'self'
cause Trying to import classes or instantiate incorrectly.
fix
Detection functions are plain functions, not methods. Use from extra_platforms import is_linux and call is_linux() directly.
breaking In v12.0.0, shell detection was overhauled; the `is_sh()` function was added and symlink resolution changed. Code relying on shell detection may need updates.
fix Update checks for shell traits; use new `is_sh()` if needed.
deprecated Importing from submodules like `extra_platforms.platform` is deprecated in favor of top-level imports.
fix Use `from extra_platforms import function_name`.
gotcha Detection functions return booleans but may raise exceptions if called in very restricted environments (e.g., BusyBox without any shell). Tests skip these scenarios, but production code should handle gracefully.
fix Wrap calls in try/except or check `is_shell()` first.

Basic usage: detect platform traits and list all active ones.

from extra_platforms import is_linux, is_macos, is_windows, is_ci, ALL_TRAITS

print('Linux:', is_linux())
print('macOS:', is_macos())
print('Windows:', is_windows())
print('CI:', is_ci())
print('All traits:', [t for t in ALL_TRAITS if getattr(__import__('extra_platforms'), t)()])