Platform-specific constants and implementations (xonsh.platform)

Functions

Module for platform-specific constants and implementations, as well as compatibility layers to make use of the ‘best’ implementation available on a platform.

xonsh.platform.has_prompt_toolkit[source]

Tests if the prompt_toolkit is available.

xonsh.platform.is_readline_available[source]

Checks if readline is available to import.

xonsh.platform.ptk_version[source]

Returns prompt_toolkit.__version__ if available, else None.

xonsh.platform.ptk_version_info[source]

Returns prompt_toolkit‘s version as tuple of integers.

xonsh.platform.scandir()

This is either os.scandir on Python 3.5+ or a function providing a compatibility layer for it. It is recommended for iterations over directory entries at a significantly higher speed than os.listdir on Python 3.5+. It also caches properties that are commonly used for filtering.

Parameters:path (str) – The path to scan for entries.
Returns:A generator yielding DirEntry instances.

Constants

xonsh.platform.BASH_COMPLETIONS_DEFAULT

A possibly empty tuple with default paths to Bash completions known for the current platform.

xonsh.platform.DEFAULT_ENCODING

Default string encoding.

xonsh.platform.HAS_PYGMENTS

True if pygments is available, else False.

xonsh.platform.LINUX_DISTRO

The id of the Linux distribution running on, possibly ‘unknown’. Ǹone on non-Linux platforms.

xonsh.platform.ON_ANACONDA

True if executed in an Anaconda instance, else False.

xonsh.platform.ON_DARWIN

True if executed on a Darwin platform, else False.

xonsh.platform.ON_LINUX

True if executed on a Linux platform, else False.

xonsh.platform.ON_POSIX

True if executed on a POSIX-compliant platform, else False.

xonsh.platform.ON_WINDOWS

True if executed on a native Windows platform, else False.

xonsh.platform.PLATFORM_INFO

The constants of this module as dictionary.

xonsh.platform.PYGMENTS_VERSION

pygments.__version__ version if available, else Ǹone.

xonsh.platform.PYTHON_VERSION_INFO

Version of Python interpreter as three-value tuple.